/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

var baseheight='150px'

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

var toollocation='/public/tools/'
var rentalrenderer='rentaltooltip.aspx?titleid='
var retailrenderer='retailtooltip.aspx?titleid='
var titlerenderer='titletooltip.aspx?titleid='

var tipobj
var pointerobj
var iframeobj
var summaryobj
//print the tax voice, moved from the receipt page
function ShowPrintableReceipt(h)
			{
				if (document.all){
					var xMax = screen.width, yMax = screen.height;
				}else{
					if (document.layers){
						var xMax = window.outerWidth, yMax = window.outerHeight;
					}else{
						var xMax = 640, yMax=480;
					}
				}
				var xOffset = (xMax-450)/2;
				var yOffset = (yMax-230)/2;

				window.open('/shop/secure/PrintableReceipt.aspx','PrintableReceipt','width=590,height='+h+',directories=no,location=no,menubar=yes,scrollbars=yes,status=no,toolbar=no,resizable=no,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');	
			}

function WriteTip(){
return;
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ShowTip(id, type, thewidth, thecolor)
{
return;
}

function ShowFrame(){
return;
}

function positiontip(e){
return;
}

function HideTip(){
return;
}

function RefreshSummary(){
	if (document.getElementById('SummaryDisplay') != null){
		document.getElementById('SummaryDisplay').src = document.getElementById('SummaryDisplay').src;
	}
}

function AddToFavorites() {
window.external.AddFavorite('http://www.quickflix.com.au','Quickflix - the smart way to rent and buy DVDs')
}

var processing = 'false';				

function AddTitleToCart(retailInventoryID,titleName)
{
	
	tempobj = document.getElementById('SummaryDisplay');
	if (tempobj)
	{
		tempobj.hiddenBySite='false';
	}
	
	if (processing == 'false')
	{
		processing = 'true';
		AddTitleToCartPage = '/public/tools/addtitletocart.aspx?RetailInventoryID=' + retailInventoryID;
		if (document.getElementById('ratingsiframe') != null)
		{
			document.getElementById('ratingsiframe').src = AddTitleToCartPage;
		}
		window.status = 'Added ' + titleName + ' to your cart.';
		processing = 'false';
	}
	return false;
	
}

function CheckedAll(chkName,chkChildName)
{
	// Toggles through all of the checkboxes defined in the CheckBoxIDs array
	// and updates their value to the checkState input parameter
	for(i=0;i<document.Form1.elements.length;i++)
	{
		var chkObj;
		if(document.Form1.elements[i].type=="checkbox"&&document.Form1.elements[i].name.indexOf(chkName)!=-1)
		{
			chkObj = document.Form1.elements[i];
		}
	}
	for(i=0;i<document.Form1.length;i++)
	{
		
		if(document.Form1.elements[i].type=="checkbox"&&document.Form1.elements[i].name.indexOf(chkChildName)!=-1)
		{
			if(chkObj)
			{
				document.Form1.elements[i].checked = chkObj.checked;
			}
		}
	}
}

function ShowText(id,flagit) {
if (flagit=="1")
	{
		if (document.layers) document.layers[''+id+''].visibility = "show"
		else if (document.all) document.all[''+id+''].style.visibility = "visible"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
	}
else if (flagit=="0")
	{
		if (document.layers) document.layers[''+id+''].visibility = "hide"
		else if (document.all) document.all[''+id+''].style.visibility = "hidden"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
	}
}

/*
	Creates a new cookie
	
	@param Name: The name of your cookie
	@param Value: The value of the cookie
	@param Days: How many days before the cookie expires
*/

function createCookie(name, value, days) {
	if (days) 
	{
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	}
	else
	{ 
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}		

/*
	Reads the value of the given cookies name
	[CookieName]=[CookieValue]; expires=[ExpireDate]; path=/
*/

function readCookie(name) {

	var nameEQ = name + "=";
	
	// split the cookie by the ;
	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;
}
