function getIdFromQstring(field) {

	//Retrieve Document location and tear off the QueryString values for processing.
	var squareid = 'DLTV';

	var url = document.location + '';
	q=url.split('?');
	if (q[1]) {
	//Get all Name/Value pairs from the QueryString
		var pairs = q[1].split('&');
		for (i=0;i<pairs.length;i++) {

			//Get the Name from given Name/Value pair
			var keyval = pairs[i].split('=');

			if (keyval[0] == field) {
				//Get the Value from given Name/Value pair and set to the return ID
				squareid = keyval[1];
			}

			if (keyval[0] == field) {
				//Get the Value from given Name/Value pair and set to the return ID
				squareid = keyval[1];
			}

		}
	}

	return squareid;
}

function ShowTitle()
{
	var show = getIdFromQstring('show');
	
	if (show == 'DLTV')
		document.title =  '::DL.TV Player::';
	if (show == 'CG')
		document.title = 'Cranky Geeks Player';
	if (show == 'PCMAG')
		document.title = '::PCMag Video Reviews::';
}

function ShowPlayer()
{

	var showid;
	var movie = getIdFromQstring('movie');
	var show = getIdFromQstring('show');

	if (movie == 'episode083')
	{
		alert(show);
	}

	//  var movie="episode083";
	var sitebase = "http://zdpub.vo.llnwd.net/o2/ziffdavisplayer/";
	var moviename="zdvideoplayer.swf"; // Flash Movie Name
	var configurl= show + "/config.xml"; // Player Configuration File
	var ancillaryurl= show + "/ancillary.xml"; //Ancillary XML Episode Configuration
	var episodeurl= show +"/" + movie + "/" + movie + ".xml";	//Episode Configuration (Replaces any values in ancillaryurl)

	var moviestring=sitebase + moviename + "?configurl=" + configurl + "&ancillaryurl=" + ancillaryurl + "&episodeurl=" + episodeurl;

	document.write ('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="873" height="755" id="vidplayer" align="middle">');
	document.write ('<param name="allowScriptAccess" value="sameDomain" />');
	document.write ('<param name="movie" value="'+moviestring+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />');
	document.write ('<embed src="'+moviestring+'" quality="high" bgcolor="#000000" width="873" height="755" name="vidplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write ('</object>');
}