


/*** Checkout variable ***/

var dl = 0;

/*** ICOMMERCE ***/

function init(page)
{
    $(document).ready(function(){
        $("ul#topNavigation").superfish();
		var thePage = document.getElementById('page');
		var theWidth = getWidth(thePage);
		if (theWidth>1003) thePage.style.width = "1003px";
		if (theWidth<779)  thePage.style.width = "779px";
     });

}

// ** Show currency converter for Value 'thePrice' **
function cConvert(thePrice)
{
//	var theURL = "http://www.xe.net/pca/input.cgi?amount=" + thePrice + "&From=AUD";

	CurrencyWindow = window.open ("http://www.xe.net/pca/input.cgi?Amount=" + thePrice + "&From=AUD", 
									'CurrencyWindow', 
									'toolbar=0,location=0,directories=0=0,menubar=0,scrollbars=0,resizable=1,height=170,width=600');
	CurrencyWindow.focus();
}

function verifyQuantity(theField)
{
	var theValue				= theField.value;

	if (theValue.length < 1)	theField.value  = "1";
	if (isNaN(theValue))		theField.value  = "1";
	theValue					= theValue - 0;
	if (theValue < 1) 			theField.value	= "1";
}
function verifyPrice(theField)
{
	var theValue				= theField.value;

	if (theValue.length < 1)	theField.value  = "0.00";
	if (isNaN(theValue))		theField.value  = "0.00";
	theValue					= theValue - 0;
	if (theValue < 1) 			theField.value	= "0.00";
}

/*** COLUMN HEIGHTS ***/

function getWidth(theEl)
{
	return (theEl.currentStyle) ? theEl.offsetWidth : stripPX(document.defaultView.getComputedStyle(theEl,'').width);
}
function getHeight(theEl)
{
	return (theEl.currentStyle) ? theEl.offsetHeight : stripPX(document.defaultView.getComputedStyle(theEl,'').height);
}
function stripPX(theValue)
{
	return (theValue.substring(0, theValue.length - 2) - 0);
}
function setHeight(element)
{
	var leftSide		= document.getElementById("leftColumn");
	var theMiddle    	= document.getElementById("contentColumn");
	var theMiddleWide  	= document.getElementById("contentColumnWide");
	var rightSide   	= document.getElementById("rightColumn");
	
	leftSideHeight  	= (leftSide)		? Math.ceil(parseInt(getHeight(leftSide)))  		: 0;
	theMiddleHeight 	= (theMiddle)   	? Math.ceil(parseInt(getHeight(theMiddle))) 		: 0;
	theMiddleWideHeight = (theMiddleWide)   ? Math.ceil(parseInt(getHeight(theMiddleWide))) 	: 0;
	rightSideHeight 	= (rightSide)   	? Math.ceil(parseInt(getHeight(rightSide))) 		: 0;
	
	if (theMiddleWideHeight > theMiddleHeight) theMiddleHeight = theMiddleWideHeight;

	tallestColumn   	= (leftSideHeight > rightSideHeight)	? leftSideHeight	: rightSideHeight;
	tallestColumn   	= (tallestColumn > theMiddleHeight) 	? tallestColumn 	: theMiddleHeight;

	if (element.style.minHeight)
	{
		if (leftSide)   	leftSide.style.minHeight		= tallestColumn+"px";
		if (theMiddle)  	theMiddle.style.minHeight   	= tallestColumn+"px";
		if (theMiddleWide)  theMiddleWide.style.minHeight   = tallestColumn+"px";
		if (rightSide)  	rightSide.style.minHeight   	= tallestColumn+"px";
	}
	else
	{
		if (leftSide)   	leftSide.style.height   		= tallestColumn+"px";
		if (theMiddle)  	theMiddle.style.height  		= tallestColumn+"px";
		if (theMiddleWide)  theMiddleWide.style.height  	= tallestColumn+"px";
		if (rightSide)  	rightSide.style.height  		= tallestColumn+"px";
	}

	if (theMiddle)  	theMiddle.style.zIndex  		= "1";
	if (theMiddleWide)  theMiddleWide.style.zIndex  	= "1";


}

function rememberMe()
{
	if (document.getElementById("entLoginForm"))
	{
		if (document.getElementById("rememberMe").checked == true)
		{
			document.getElementById("rememberMeCheckboxImage").src = website+'statimages/checkbox.png';
			document.getElementById("rememberMe").checked = false;
		}
		else
		{
			document.getElementById("rememberMeCheckboxImage").src = website+'statimages/checkboxTicked.png';
			document.getElementById("rememberMe").checked = true;
		}
	}
    return true;
}


/*** GENERAL FORM CHECKING TOOLS ***/

function isFieldEmpty(theField)
{
	return (theField.value.length < 1) ? true : false;
}
function isFieldBadEmail(theField)
{
	theEmail = theField.value;
	if (theEmail.indexOf('@')==-1 || theEmail.indexOf('.')==-1 || theEmail.length<6) return true;
	return false;
}
function clearQuotes(theForm)
{
	for (i = 0; i < theForm.elements.length; i++)
	{
		if (theForm.elements[i].value) theForm.elements[i].value = theForm.elements[i].value.replace(/'/gi,"`");
	}
}

/*** MAKE DROPDOWN MENUS WORK IN EXPLORER ***/
/*

sfHover = function()
{
	var sfEls = document.getElementById("navHome").getElementsByTagName("LI");

	for (var i=0; i<sfEls.length; i++)
	{
		sfEls[i].onmouseover=function()
		{
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function()
		{
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}

	if (document.getElementById("leftNavMenu"))
	{
		var sfEls = document.getElementById("leftNavMenu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++)
		{
			sfEls[i].onmouseover=function()
			{
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function()
			{
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}

}
if (window.attachEvent) window.attachEvent("onload", sfHover);

*/

/*** REMEMBER ME ***/

function rememberMe()
{
	if (document.getElementById("entLoginForm"))
	{
		if (document.getElementById("rememberMe").checked == true)
		{
			document.getElementById("rememberMeCheckboxImage").src = website+'statimages/checkbox.png';
			document.getElementById("rememberMe").checked = false;
		}
		else
		{
			document.getElementById("rememberMeCheckboxImage").src = website+'statimages/checkboxTicked.png';
			document.getElementById("rememberMe").checked = true;
		}
	}
    return true;
}

function getremcookie()
{
    var allcookies  = document.cookie;
    var pos 		= allcookies.indexOf("gtprem=");
	var value;

	if (document.entLoginForm)
	{
		if (pos != -1)
		{
			var start   = pos + 7;
			var end 	= allcookies.indexOf(";",start);
			if (end == -1) end = allcookies.length;
			
			value   									= allcookies.substring(start, end);
			value   									= unescape(value);
			value   									= value.split("|");
	
			if (document.entLoginForm.id)
			{
				document.entLoginForm.id.value  			= value[0];
				document.entLoginForm.pw.value  			= value[1];
				document.entLoginForm.rememberMe.checked	= true;
			}
		}
		else
		{
			if (document.entLoginForm.id)
			{
				document.entLoginForm.id.value  			= "";
				document.entLoginForm.pw.value  			= "";
				document.entLoginForm.rememberMe.checked	= false;
			}
		}
	}
}
function showPicture(theImage,width,height)
{
	if (width > 800)	width = 800;
	if (height > 600)   height = 600;
	
	pathname = self.location.pathname.substr(0, self.location.pathname.lastIndexOf("/") + 1);
	if (pathname.indexOf("gallery/") != -1) pathname = pathname.substr(0, pathname.indexOf("gallery/"));
	url = "http://"+self.location.host+pathname+"story/showPicture.php?id=" + theImage;
	showPictureWindow = window.open (url, 'showPicture', 'toolbar=0,location=0,directories=0=0,menubar=0,scrollbars=1,resizable=1,height='+height+',width='+width);
	showPictureWindow.focus();
}

function addBookmarkForBrowser() {
  if (document.all)
  {
    window.external.AddFavorite(document.location.href, document.title);
  } 
}
function gotoCheckout(theform, whichcheckout)
{
	whichcheckout = whichcheckout+"";
	theform.whichCheckout.value = whichcheckout;
	theform.submit();
}
$(document).ready(function () {

		$('.footerProductsMenu').easyListSplitter({
			colNumber: 4// Insert here the number of columns you want. Consider that the plugin will create the number of cols requested only if there's enough items in the list.
		});

setHeight(document.getElementById('bodyBlock'));

});


var defaultDescHeight = 0;
var defaultDescTextHeight = 0;
var defaultSpecTextHeight = 0;
var defaultHeightDiff = 0;


		function ___getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;
			}
			arrayPageScroll = new Array(xScroll,yScroll);
			return arrayPageScroll;
		};
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth;
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else {
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){
				pageWidth = xScroll;
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};

$(document).ready(function(){
  $("#wat").inFieldLabels();



         			    $("#videoContentLink").click(function () {
					$("#videoContentBack").css("display","block");
					$("#videoContentBack").css("z-index","99999999");

					$("#videoContent").css("top","block");
					$("#videoContent").css("left","block");

						var arrPageSizes = ___getPageSize();
						var arrPageScroll = ___getPageScroll();

						// Calculate top and left offset for the jquery-lightbox div object and show it
						$('#videoContent').css({
							top:		(arrPageSizes[3] / 10),   // arrPageScroll[1] +
							left:		30,
							width:		510,
							height:		320
						});

					$("#videoContent").css("display","block");
					$("#videoContent").css("z-index","99999999");
			    });
			    $("#closeVideoContent").click(function () {
					$("#videoContentBack").css("display","none");
					$("#videoContent").css("display","none");
			    });











         			    $("#videoContentLink2").click(function () {
					$("#videoContentBack2").css("display","block");
					$("#videoContentBack2").css("z-index","99999999");

					$("#videoContent2").css("top","block");
					$("#videoContent2").css("left","block");

						var arrPageSizes = ___getPageSize();
						var arrPageScroll = ___getPageScroll();

						// Calculate top and left offset for the jquery-lightbox div object and show it
						$('#videoContent2').css({
							top:		(arrPageSizes[3] / 10),   // arrPageScroll[1] +
							left:		-530,
							width:		510,
							height:		320
						});

					$("#videoContent2").css("display","block");
					$("#videoContent2").css("z-index","99999999");
			    });
			    $("#closeVideoContent2").click(function () {
					$("#videoContentBack2").css("display","none");
					$("#videoContent2").css("display","none");
			    });





});
