// panel switcher
function changePanel (panelname) {
document.getElementById('panel_featured_dvds').style.display = 'none';
document.getElementById('panel_new_releases').style.display = 'none';
document.getElementById('panel_top_rentals').style.display = 'none';
document.getElementById('panel_top_models').style.display = 'none';
document.getElementById('panel_'+panelname).style.display = 'block';
}
//panel tabs
// (normal, highlight, click)
var tabsData = new Array();
tabsData[1] = new Array('/graphics/skins/booble/tab_01_off.gif', '/graphics/skins/booble/tab_01_over.gif', '/graphics/skins/booble/tab_01_active.gif');
tabsData[2] = new Array('/graphics/skins/booble/tab_02_off.gif', '/graphics/skins/booble/tab_02_over.gif', '/graphics/skins/booble/tab_02_active.gif');
tabsData[3] = new Array('/graphics/skins/booble/tab_03_off.gif', '/graphics/skins/booble/tab_03_over.gif', '/graphics/skins/booble/tab_03_active.gif');
tabsData[4] = new Array('/graphics/skins/booble/tab_04_off.gif', '/graphics/skins/booble/tab_04_over.gif', '/graphics/skins/booble/tab_04_active.gif');

var startT=new Date(),currentSelection = 1;  // -1 = initial dummy value
function highlightItem(obj, state) {
    i = obj.getAttribute('id');
    if (i != currentSelection) {
        if (state == 1) {
            obj.setAttribute('src', tabsData[i][1]);
        } else {
            obj.setAttribute('src', tabsData[i][0]);
        }                    
    }
}
function selectItem(obj) {
    i = obj.getAttribute('id');
    tbar = document.getElementById('tabs');
    items = tbar.getElementsByTagName('img');
    for (x = 0; x < items.length; x++) {
        items[x].setAttribute('src', tabsData[(x+1)][0]);
    }
    obj.setAttribute('src', tabsData[i][2]);
    currentSelection = i;
}

function show_flash_banner(n,main,output_opt){
	swf='/graphics/skins/2007/swf/'+main+'?niche=introduction/'+n+
		'&fLink=http://www.urentdvds.com/rental.php?page=join';
	a="<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='600' height='277'>"+
 	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='"+swf+"' />"+
	"<param name='wmode'   value='transparent' /><param name='base' value='/graphics/skins/2007/swf' />"+
	"<embed src='"+swf+"' base='/graphics/skins/2007/swf' wmode='transparent' "+
	"allowScriptAccess='sameDomain' width='600' height='277' "+
	"type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>"+
	"</object>";
	if (output_opt==1) return(a); else document.write(a);	
}

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
// img replacement (i.e mouse-over) add on to the domRollover() for cases that the img wasn't there on-load.
function hl(imgObj,mode){ // spliting img.src to add/remove it "_over." part
	var i,src=imgObj.src,p1,p2;
	if ((i=src.indexOf('_over.'))>-1){
		p1=src.substring(0,i);
		p2=src.substring(i+5);
	} else {
		p1=src.substring(0,src.length-4);
		p2=src.substring(src.length-4);
	}
	if(mode) imgObj.src=p1+'_over'+p2; else imgObj.src=p1+p2;
}

// img replacement (i.e mouse-over) add on to the domRollover() for ie6 cases of transperent PNG
function hlie6(divObj,mode){ 
	// filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/pb_layerpop1.png',sizingMethod='scale')
	var i,src,p1,p2;
	src=divObj.style.filter;
	if ((i=src.indexOf('_over.'))>-1){
		p1=src.substring(0,i);
		p2=src.substring(i+5);
	} else {
		p1=src.substring(0,src.length-27);
		p2=src.substring(src.length-27);
	}
	if(mode) divObj.style.filter=p1+'_over'+p2; else divObj.style.filter=p1+p2;
}


function dvd1_DoFSCommand(command, args) {
	var w;
  if (command=="pop"){
	if (args.indexOf('http')==-1) args='http://www.urentdvds.com'+args;
	md=self.location.href;
	mdi=md.indexOf("/",8); omd=md.substring(0,mdi)+"/not.html";
	w=window.open(omd,"SI","fullscreen=0, scrollbars=0, resizable=0, top=-2900, left=-2900, width=100");
	w.document.open();
	wdoc="<head><title>Click to Close</title>\n<meta http-equiv='imagetoolbar' content='no'></head>\n"+
		"<body style='margin:0px' background='"+args+"' "+
		"onload=\"if (self.name=='SI') {resizeTo(425,675);moveTo(10,10);} else {"+
		"moveTo(2010,10); self.location.href='http://www.urentdvd.com/not.html'}\" "+
		"onmousedown='self.close()'></body>";
  	w.document.write(wdoc);
  	w.document.close();	
  }
  //else alert("comman="+command+"\r\nargs="+args);
}

function dvdBox(n,n1){
 if (navigator.userAgent.indexOf('WebTV')>-1){
	 	a="<img src='"+n+"-1.jpg'>";
 } else {
	swf="/graphics/skins/2007/swf/cover-test.swf?n="+n+"&n1="+n1;		
 	a="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' "+
 		"codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+ 
	 	"width=252 height=376 id=dvd1><param name='wmode'   value='transparent' />"+
		"<param name='allowScriptAccess' value='sameDomain' />"+
		"<param name='movie' value='"+swf+"' />"+
		"<embed src='"+swf+"' width=252 height=376 name=dvd1 allowScriptAccess='sameDomain' wmode='transparent' "+ 
		"type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
		"</object>";		
 }
 document.write(a);
}

function setCookie(name, value, expires, path, domain, secure)
{
        var curCookie = name + "=" + escape(value) +
                        ((expires) ? "; expires=" + expires.toGMTString() : "") +
                        ((path) ? "; path=" + path : "") +
                        ((domain) ? "; domain=" + domain : "") +
                        ((secure) ? "; secure" : "");
        document.cookie = curCookie;
}

function mail2friend(){
   u="http://www.urentdvds.com/mailFriend.php?prog=OUD";
   w="win"+"dow.op"+"en('"+u+"','newsletter','menubar=no,status=no,toolbar=no,width=400,height=400')";
   eval(w);
}

onload=function(){
	domRollover();
	var o,endT=new Date();
	o=document.getElementById('last_debug');
	mSec=endT.getTime()-startT.getTime();
	sec=(Math.round(mSec/100))/10;
	if(o) o.innerHTML='<font color="#dddd9f">'+mSec+" mSec ("+sec+" sec)";
}
