
function openPopupRate(popurl)
{
	var winpops=window.open(popurl,"","location=no,status=no,scrollbars=yes,menubar=no,resizable=no,toolbar=no,width=425,height=500")
}

function openPopup(popurl)
{
	var winpops=window.open(popurl,"","location=no,status=no,scrollbars=yes,menubar=no,resizable=no,toolbar=no,width=620,height=500")
}

function openPopup750w(popurl)
{
	var winpops=window.open(popurl,"","location=yes,status=yes,scrollbars=yes,menubar=no,resizable=yes,toolbar=no,width=786,height=650")
}
//show-and-hide-popup functions
function showFrame(e, id){
		var floater = document.getElementById(id);
		floater.style.display = "inline";
		floater.style.visibility = "visible";
		var posx = 0;
		var posy = 0;
		var scrollX = 0;
		var scrollY = 0;
		if (!e) var e = window.event;

		scrollX = document.body.scrollLeft + document.documentElement.scrollLeft;
		scrollY = document.body.scrollTop + document.documentElement.scrollTop;

		if (e.clientX || e.clientY) {			
			posx = e.clientX + scrollX;
			posy = e.clientY + scrollY; 
		}else if (e.pageX || e.pageY) 	{
			posx = e.pageX;
			posy = e.pageY;
		}
		//alert(posx+", "+posy);
		//attempt to fit the popup in the screen
		if ( (posx + floater.offsetWidth) > (780 + scrollX)){
			posx = (780 + scrollX) - floater.offsetWidth;
			//have we moved the left edge of the popup out of the viewable area?
			if (posx < scrollX){
				posx = scrollX;
			}
		}
		if ( (posy + floater.offsetHeight) > (document.body.clientHeight + scrollY)){
			//posy = (document.body.clientHeight + scrollY) - floater.offsetHeight - 5;			
		//scroll up the window instead of moving the layer upward
			parent.window.scrollTo(0,posy-50);			
			
			//have we moved the top edge of the popup out of the viewable area?
			if (posy < scrollY){
			posy = scrollY;
			}
		}
		//alert(posx+", "+posy);
	if(!floater.style.left)
		floater.style.left = posx+"px";
	if(!floater.style.top)
		floater.style.top = posy+15+"px";
		
		
		if(document.getElementById("transFrame"))
		{			
			//document.getElementById("transDiv").style.display = "inline";
			document.getElementById("transFrame").style.display = "inline";
		}
	}
function hideFrame(id){
	var floater = document.getElementById(id);
	floater.style.display = "none";
	floater.style.visibility = "hidden";
	var player = document.getElementById("MediaPlayer");
	if (player && navigator.appName == "Microsoft Internet Explorer"){
               player.Stop();
	}
	if(document.getElementById("transFrame"))
	{document.getElementById("transFrame").style.display = "none";}}
//View Trailer popup functions
function changeSpeed(){
	var ul = document.getElementById("movieClipList");
	var links = ul.getElementsByTagName("a");
	for (var i=0; i<links.length; i++){
		if (links[i].className=="current"){
			//alert(links[i].getAttribute("vdID"));
			changeURL(links[i].getAttribute("vdID"));
			return;
		}		
	}
}
function changeURL(vidID, linkNode){
	var player = document.getElementById("player");
	if (vidID == 0){
		player.innerHTML = "";
		return;
	}
	var speed = document.getElementById("mediaPlayerSpeed");
	//alert(speed.selectedIndex);
	var rate = "100";
	if (speed && speed.selectedIndex!=-1){
		rate = speed.options[speed.selectedIndex].value;
	}
	var url = "http://www.videodetective.net/player.asp?cmd=3&customerid=97723";
	url = url + "&PublishedId="+vidID;
	url = url + "&VideoKbrate="+rate;
	//alert(url);
	var newHTML = '<object type="application/x-mplayer2" id="MediaPlayer" ';
	//alert(BrowserDetect.browser );
	if (BrowserDetect.browser != "Explorer"){
		newHTML = newHTML + 'width="320" height="300" ';
	}
	newHTML = newHTML + 'align="middle" ';
	newHTML = newHTML + 'data="'+url+'">';
	newHTML = newHTML + '<param name="autostart" value="true"/>';
	newHTML = newHTML + '<param name="ShowStatusBar" value="True"/>';
	newHTML = newHTML + '<param name="src" '
	newHTML = newHTML + 'value="'+url+'"/>';
	newHTML = newHTML + '</object>';
	player.innerHTML = newHTML;
	if (linkNode){
		var ul = document.getElementById("movieClipList");
		var links = ul.getElementsByTagName("a");
		for (var i=0; i<links.length; i++){
			links[i].className="";		
		}
		linkNode.className= 'current';
		linkNode.blur();
	}
}

//swappable content area functions
function swapAll(uniqueName, linkNode){	var target = 1;	var isExpanding = linkNode.className == 'expandLink';if (isExpanding){target = 2}for (var index=0; true;index++){var itemId = uniqueName+index;var item = document.getElementById(itemId);if (item){swap(itemId, target);}else {break;}}
	linkNode.className = isExpanding ? 'hideLink' : 'expandLink';linkNode.blur();}
function swap(uniqueName, index){var swapContainer = document.getElementById(uniqueName);swapContainer.className = "showSwapContent"+index;}
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;}
	function MM_changeProp(objName,x,theProp,theValue) { //v6.0
	  var obj = MM_findObj(objName);if (obj && (theProp.indexOf("style.")==-1 || obj.style)){if (theValue == true || theValue == false)eval("obj."+theProp+"="+theValue);
	    else eval("obj."+theProp+"='"+theValue+"'");}}    
	var BrowserDetect = {init: function () {this.browser = this.searchString(this.dataBrowser) || "An unknown browser";	this.version =this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)	|| "an unknown version";this.OS = this.searchString(this.dataOS) || "an unknown OS";},
	searchString: function (data) {	for (var i=0;i<data.length;i++)	{var dataString = data[i].string;var dataProp = data[i].prop;this.versionSearchString =data[i].versionSearch || data[i].identity;if (dataString) {if (dataString.indexOf(data[i].subString) != -1)return data[i].identity;}else if (dataProp)return data[i].identity;}},
	searchVersion: function (dataString) {var index = dataString.indexOf(this.versionSearchString);	if (index == -1) return;
	return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},
	dataBrowser: [	{ 	string: navigator.userAgent,subString: "OmniWeb",versionSearch: "OmniWeb/",	identity: "OmniWeb"	},{	string: navigator.vendor,subString:"Apple",	identity: "Safari"},{prop: window.opera,identity: "Opera"},{string: navigator.vendor,subString: "iCab",identity: "iCab"	},{string:navigator.vendor,	subString: "KDE",identity: "Konqueror"},{string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.vendor,subString:"Camino",identity: "Camino"},{		
// for newer Netscapes (6+)
			string: navigator.userAgent,subString: "Netscape",identity: "Netscape"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"},
		{string: navigator.userAgent,subString: "Gecko",identity: "Mozilla",versionSearch: "rv"	},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,subString: "Mozilla",identity: "Netscape",versionSearch: "Mozilla"}	],	dataOS : [{	string: navigator.platform,	subString: "Win",identity:"Windows"},{	string: navigator.platform,	subString: "Mac",identity: "Mac"},{	string: navigator.platform,	subString: "Linux",	identity: "Linux"}]};
BrowserDetect.init();
