// Wimpy AV Single Play
// by Mike Gieson <info@wimpyplayer.com>
// available at http://www.wimpyplayer.com
// ©2002-2005 plaino

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
////////////                                     ////////////
////////////              OPTIONS                ////////////
////////////                                     ////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

// WimpyFolder is the location on your site where 
// you will be storing the wimpy files and all of 
// your mwhere your FLV, SWF and MP3 media files.
//
// Alternative examples:
// wimpyFolder = "http://www.yoursite.com/wimpy/";
// wimpyFolder = "wimpy/";
// wimpyFolder = "../wimpy/";
//
// The default is set to read the "wimpy" folder at 
// the "root" of your public HTML directory:
// 
// TRAILING SLASH REQUIRED (E.G. "path/")
wimpyFolder = "http://www.overdrivelive.tv/Media/interview/";
//
// transparentBkgd 
// This will anable you to use a custom HTML backgrounds on 
// the pages that contain the player (e.g. wimpyTemplate.html).
transparentBkgd = "yes";
//
// bkgdColor
// This is the default background color for the pop up page.
bkgdColor = "#000000";
//
// startPlayingOnload
// Setting this to "yes" will start to play automatically.
// Setting this to "no" will force the user to click the 
// "play" button to start playing the video
startPlayingOnload = "no";
//
// popUpHelp
// Setting this to "yes" will display little yellow "help" 
// boxes when the user hoovers over the control functions.
// Setting this to "no" will disable this feature.
popUpHelp = "yes";
//
// loopTrack
// Setting thei to "yes" will cause the video to repeat 
// once it has reached the end, and continue to loop 
// until the user clicks stop.
// Setting this to "no" will cause the video to 
// disappear once it has finished. 
loopTrack = "no";
//
// currentVolume
// You can controll the initial volume setting when 
// the player loads. The range is 0-100, where 0 is 
// no sound and 100 is full volume
currentVolume = "100";
//
// controllocation
// You can place the playback controls above or below 
// the video. To place the controls above the video, 
// set this to "top" - to place the controls below the video, 
// set this to "bottom"
controllocation = "bottom";
//
// wimpySWFfilename
// you can change the name of the wimpy.swf file here.
// Obviously, if you change the name here, then you will have to 
// change the name of the actual file in your wimpy folder too.
wimpySWFfilename = "wimpyAVsingle.swf";
//
// wimpyHTMLtemplateFilename
// You can change the name of the wimpyTemplate.html file here.
// Obviously, if you change the name here, then you will have to 
// change the name of the actual file in your wimpy folder too.
wimpyHTMLtemplateFilename = "wimpyTemplate.html";

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
////////////                                     ////////////
////////////   NO FURTHER CONFIGURATION NEEDED   ////////////
////////////                                     ////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////


function WimpyAVpopup (filename, width, height){
	rnum = (Math.round((Math.random()*1000000)+1));
	padControls = height+20
	theURL = wimpyFolder+wimpyHTMLtemplateFilename+'?theFile='+filename+'&wW='+width+'&wH='+padControls;
	winName = 'wimpy'+rnum;
	extras = 'width='+width+',height='+padControls
	window.open(theURL,winName,extras);
}

function writeSWFcode(fileSWF, fileIN, theWidth, theHeight){
	rnum = (Math.round((Math.random()*1000000)+1));
	padControls = theHeight+20
	queryString = '';
	queryString += "theFile="+fileIN;
	if(transparentBkgd == "yes"){
		tptBkgd_param = '<param name="wmode" value="transparent" />';
		tptBkgd_embed = 'wmode="transparent" ';
	} else {
		tptBkgd_param = "";
		tptBkgd_embed = "";
	}
	queryString += '&startPlayingOnload='+startPlayingOnload;
	queryString += '&popUpHelp='+popUpHelp;
	queryString += '&loopTrack='+loopTrack;
	queryString += '&controllocation='+controllocation;
	queryString += '&currentVolume='+currentVolume;
	flashCode = '';
	flashCode += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab// - version=7,0,0,0" width="'+theWidth+'" height="'+padControls+' name="wimpy'+rnum+'" id="wimpy'+rnum+'"">';
	flashCode += '<param name="movie" value="'+fileSWF+'?'+queryString+'" />';
	flashCode += '<param name="loop" value="false" />';
	flashCode += '<param name="menu" value="false" />';
	flashCode += '<param name="quality" value="high" />';
	flashCode += '<param name="scale" value="noscale" />';
	flashCode += '<param name="salign" value="lt" />';
	flashCode += '<param name="bgcolor" value="'+bkgdColor+'" />';
	flashCode += tptBkgd_param;
	flashCode += '<embed src="'+fileSWF+'?'+queryString+'" width="'+theWidth+'" height="'+padControls+'" bgcolor="'+bkgdColor+'" loop="false" menu="false" quality="high" scale="noscale" salign="lt" name="wimpy'+rnum+'" id="wimpy'+rnum+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"" '+tptBkgd_embed+'/></object>';
	document.write(flashCode);
}

function WimpyAV(){
	var qsParm = new Array();
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
	fileSWFsend = wimpyFolder+wimpySWFfilename;
	fileINsend = wimpyFolder+qsParm['theFile'];
	writeSWFcode(fileSWFsend, fileINsend, "100%", "100%");
}

function WimpyAVembed(theFileIN, theWidthIN, theHeightIN){
	fileSWFsend = wimpyFolder+wimpySWFfilename;
	fileINsend = wimpyFolder+theFileIN;
	writeSWFcode(fileSWFsend, fileINsend, theWidthIN, theHeightIN);
}


