
/////////////////////////////////////////////////////////////////////////////////////////
/// showmenow	-	new function which uses cookies 
///		strfname	:	skin name of the video player
///		strvdoname	:	video file name without the speed suffixes
///		strmode		:   mode of the player (optional)
////////////////////////////////////////////////////////////////////////////////////////
function showmenow(strfname, strvdoname, strmode)
{ var ptype=0;  //ptype=playertype  1 for new player and 0 for old player
var browser=navigator.appName;
var version=navigator.appVersion;
var frames=0;
var vdofile;
if (version.indexOf("Win")!=-1)	{
	  if(browser.indexOf("Microsoft")!=-1) { 
		ptype=1;
	    frames=1;
	  }
	  if(browser.indexOf("Netscape")!=-1){
	    if(version.indexOf("4.")!=-1){ptype=1;} 
			else {frames=1;}
	  }
}
	//checking cookies and deciding on the next window
	videomode = (strmode=="" || strmode==null ? readCookie("vdomode") : strmode);
	
	if(videomode == "" || videomode==null) {
		var strspdurl = "/thirdparty/vplayer/selectspeed.php?skin=" + strfname + "&vdo=" + strvdoname + "&plyr=" + ptype + "&frames=" + frames 
		var spdwin = window.open(strspdurl,"selspeedwin","height=340,width=275,left=280,top=100,scrollbar=0,location=0");
	
		// to bring back the focus to the window, if its already opened
		if (!(spdwin.closed))
			{spdwin.focus();}
	} else {
			if(strvdoname.substring(0,7) != "http://") {
				if(videomode=="l") {
					vdofile = strvdoname + "_048.asx";
				} else if(videomode=="m") {
					vdofile = strvdoname + "_120.asx";
				} else if(videomode == "h") {
					vdofile = strvdoname + "_300.asx";
				}
			} else { 
				vdofile = strvdoname;
			}
			var qrystr = "skin=" + strfname + "&vdo=" + vdofile + "&mode=" + videomode + "&plyr=" + ptype + "&frames=" + frames;
			var strurlstring = "/thirdparty/vplayer/videoframe.php?" + qrystr
			var winplayer = window.open(strurlstring,"playwin","height=375,width=675,left=180,top=180,scrollbar=0,location=0");
			// to bring back the focus to the window, if its already opened
			if (!(winplayer.closed)){winplayer.focus();}
	}
}


/////////////////////////////////////////////////////////////////////////////////////////
/// readCookie		-	reading a cookie on the user machine
///		name	-	name of the cookie to read
////////////////////////////////////////////////////////////////////////////////////////

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


