function populateGet() {
    if (!location.search) return null;
    var request = new Object();
    var pairs = unescape(location.search.substr(1)).split('&');
    for (var i in pairs) {
        var pair = pairs[i].split('=');
        request[pair[0]]=pair[1];
    }
    return request;
}

function openPreview(_width, _height, _contenturl){
	// height: clip width
	// width: clip height
	// url: clip url, for best results should be within the main site url
	// THIS VALUES ARE HARDCODED AND INDICATE THE CURRENT INTERFACE SIZE
	var widthGain = 74;
	var heightGain = 185;
	var _templatepath = "fdpreview.php";
	
	var _size = "," + "width=" + (_width + widthGain) + ",height=" + (_height + heightGain);
	var _params = "toolbar=no,resizable=no,location=no,menubar=no,scrollbars=no, directories=no, status=no" + _size;
	var _url = (_templatepath + "?content=" + _contenturl + "&w=" + _width + "&h=" + _height);
	
	
	//myWindow = window.open("", "previewWindow", 'toolbar,width=150,height=100') 
	var windoref = window.open(_url, "previewWindow", _params)

	return windowref;
}

function openMusicPreview(_contenttitle, _contenturl){
	
	var _width = 300;
	var _height = 250;
	var _templatepath = "realtone_preview.php";	
	var _size = "," + "width=" + _width + ",height=" + _height;
	var _params = "toolbar=no,resizable=no,location=no,menubar=no,scrollbars=no, directories=no, status=no" + _size;
	var _url = (_templatepath + "?title=" + _contenttitle + "&url=" + _contenturl);
	//alert(_url);
	var windowref = window.open(_url, "previewWindow", _params)

	return windowref;
	
}


function makeFlashCode(_parameters){
	
	// _parameters: object with field corresponding to those in GET request

	var _flashpath = "fdpreview.swf";
	/*var _source = _flashpath + "?";
	
		for(var i in _parameters){
		
			_source += i;
			_source += _parameters[i];
			_source += "&";
		
		}*/
		
	var _source = _flashpath + _parameters;
	//alert(_source);

document.write("<object style='display:block' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='100%' height='100%' id='fdpreview' align='top'>" + 
"<param name='allowScriptAccess' value='sameDomain' />" +
"<param name='movie' value='" + _source + "' />" +
"<param name='quality' value='high' />" +
"<param name='scale' value='noscale' />" +
"<param name='salign' value='tl' />" +
"<param name='bgcolor' value='#244277' />" +
"<embed src='" + _source + "' quality='high' scale='noscale' salign='tl' bgcolor='#244277' width='100%' height='100%' name='fdpreview' align='top' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
"</object>");

}

function makeMusicCode(_parameters){


	
}