MM_reloadPage(true);
                
function MM_displayStatusMsg(msgStr) 
{   //v1.0
    status=msgStr;
    document.MM_returnValue = true;
}

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();
}

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*
   This function dynamically size all product special boxes to the largest size to keep
   design aesthetic: tested under IE/NN/FF
*/
function resizeProductSpecials()
{		
    var tdTags;
    var maxHeight = 0;
    
    tdTags = document.getElementsByTagName("td");
    
    // loop through all td tags				
    for(i = 0; i < tdTags.length; i++) 
    {
        // if td contains class bg-product-desc
        if (tdTags.item(i).className == "bg-product-desc")
        {
            // determine largest size
            if (tdTags.item(i).offsetHeight > maxHeight)
                maxHeight = tdTags.item(i).offsetHeight;
        }
            
    }	
    
    // loop through again
    for(i = 0; i < tdTags.length; i++) 
    {
        if (tdTags.item(i).className == "bg-product-desc")
        {
            // set all heights to be max height
            tdTags.item(i).height = maxHeight;
        }						
    }					
}

function resizeHomeFeature()
{		
    var tdTags;
    var maxHeight = 0;
    
    tableTags = document.getElementsByTagName("table");
    tdTags = document.getElementsByTagName("td");
    
    // loop through all td tags				
    for(i = 0; i < tableTags.length; i++) 
    {
        // if td contains class product-table
        if (tableTags.item(i).className == "product-table")
        {
            // determine largest size
            if (tableTags.item(i).offsetHeight > maxHeight)
                maxHeight = tableTags.item(i).offsetHeight;
        }
            
    }	
    
    // deduct pixel space for top and bottom sections of banner
    maxHeight = maxHeight - 47;
    
    // loop through again
    for(i = 0; i < tdTags.length; i++) 
    {
        if (tdTags.item(i).className == "bg-home-feat" && maxHeight > 0)
        {
            // set all heights to be max height
            tdTags.item(i).height = maxHeight;
        }						
    }					
}	


function ActiveCastReplace(inStr)
{
	var ac_temp_outstr = inStr;
	if(inStr != null)
	{
		if(inStr.length > 0)
		{
			ac_temp_outstr = ac_temp_outstr.replace(/(&amp;)+/ig,'&');
			ac_temp_outstr = ac_temp_outstr.replace(/(&quot;)+/ig,'\"');
		}
	}
	return ac_temp_outstr;
}


function getActiveCastWidgetContent1()
{
	var ACObj = document.getElementById('ACTIVECAST-LT');
	var ACObjH = document.getElementById('AC_HEADER');
	var ACContent;
	if(ACObj != null && ACObjH != null)
	{
		ACHContent = ACObjH.innerHTML;
		if(ACHContent.length > 0)
		{
			ACContent = ACObj.innerHTML;
			ACContent = ActiveCastReplace(ACContent);
			ACObj.innerHTML = ACContent;
			return;
		}
		else
		{
			HideActiveCastWidget();
		}
	}
}
function getActiveCastWidgetContent()
{
	setTimeout("getActiveCastWidgetContent1();",1000);
	return;
}
function ShowActiveCastWidget()
{
	if(document.getElementById('ACWrapper'))
	{
		if(navigator.appName.toLowerCase() == "opera")
		{
			document.getElementById('ACWrapper').style.display='none';
		}
		else
		{
			document.getElementById('ACWrapper').style.display='';
		}
	}	
}
function HideActiveCastWidget()
{
	document.getElementById('ACWrapper').style.display='none';
}

function getFlashMovieObject(movieName)
{

  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function PlayFlashMovie(movieName)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.Rewind();
	flashMovie.Play();
}

function RewindFlashMovie(movieName)
{

	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.StopPlay();
}

function hidePlayer(playerID) {
	MM_findObj(playerID).innerHTML='';
}

function showPlayer(playerID, sWidth, sHeight, sURL) {
	document.getElementById(playerID).innerHTML='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="'+sHeight+'" viewastext="" width="'+sWidth+'" id="popover_mov">' +
	'<param name="movie" value="/marketing/_video/players/flv_player_'+sWidth+'x'+sHeight+'.swf?content_path='+escape(sURL)+'" />'+
	'<param name="quality" value="high" />'+
	'<param name="wmode" value="transparent" />'+
	'<embed name="popover_mov" height="'+sHeight+'" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="/marketing/_video/players/flv_player_'+sWidth+'x'+sHeight+'.swf?content_path='+escape(sURL)+'" type="application/x-shockwave-flash" width="'+sWidth+'"></embed>'+
	'</OBJECT>';
}


function HideBuyOnline(buyNowDivId, parentFormID, HrefURL, LoadingMessage)
{
	eval("document.getElementById('"+buyNowDivId+"').innerHTML  = '"+LoadingMessage+"'")
	if(parentFormID != null && parentFormID.length > 0)
	{
		eval("document.getElementById('"+parentFormID+"').submit();")
	}
	else if(HrefURL != null && HrefURL.length > 0)
	{
		document.location = HrefURL;
	}
	
}

function PSWC(id,lang) // PlayStation PDP popup
{
	if (lang == "FR") {
		onClick=window.open("http://www.playstation.ca/vendors/futureshop.aspx?language=1036&id="+id+"&utm_source=futureshop.ca&utm_medium=website%2Bbtn&utm_content=PS3%2BGames&utm_campaign=Retailer%2BWeblinks%2BFS","newwindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes");
	} else {
		onClick=window.open("http://www.playstation.ca/vendors/futureshop.aspx?id="+id+"&utm_source=futureshop.ca&utm_medium=website%2Bbtn&utm_content=PS3%2BGames&utm_campaign=Retailer%2BWeblinks%2BFS","newwindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes");
	}
}

//pdp pop up generator code
var popWinAdv;
function openWindowAdv(page, width, height, scrollbars, titlebar, resizable, status, menubar, toolbar) {
	if (scrollbars) scrollbars = "yes";
	else scrollbars = "no";

	if (popWinAdv != null && !popWinAdv.closed) popWinAdv.close();
	popWinAdv = window.open(page,"PopUp","width="+width+",height="+height+",dependent=yes,resizable,scrollbars="+scrollbars+",titlebar="+titlebar+",resizable="+resizable+",status="+status+",menubar="+menubar+",toolbar="+toolbar); 
}
