function addLoadEvent(func) { 	var oldonload = window.onload; 	if (typeof window.onload != 'function') { 		window.onload = func; 	} else { 		window.onload = function() { 	      if (oldonload) { 	        oldonload(); 	      } 	      func(); 	    } 	  } 	} 	 	/* GETS SEVER TIME */	addLoadEvent(ScrollBarLoad);			addLoadEvent(function() { 					  }) function ScrollBarLoad() {	//IF ScrollerLoad ID found load scroller	if(document.getElementById("Scrollarea")) {		ScrollerLoad('Scrollarea');	}}function AjaxCommand(ScriptPath, ElementID, LoadingID, LoadingContent, Commands, SendMethod) {	var url = ScriptPath;	var XHRequest = false;	//SHOWS LOADER	document.getElementById(LoadingID).innerHTML = LoadingContent;	document.getElementById(LoadingID).style.display="block";			if(window.XMLHttpRequest){	XHRequest = new XMLHttpRequest();	} else if(window.ActiveXObject){	XHRequest = new ActiveXObject("Microsoft.XMLHTTP");	}			if(XHRequest){	XHRequest.open(SendMethod, url);	XHRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	XHRequest.onreadystatechange = function(){	if(XHRequest.readyState < 4){		} else if(XHRequest.readyState == 4 && XHRequest.status == 200){		//IF LOADER IS NOT SAME AND CONTENT DIV THEN HIDE		if(ElementID!=LoadingID) {			document.getElementById(LoadingID).style.display="none";		}				document.getElementById(ElementID).innerHTML = XHRequest.responseText		delete XHRequest;		XHRequest = null;		}	}				XHRequest.send(Commands);	}	}function ProductLoad(ScriptPath, ElementID, LoadingID, LoadingContent, Commands, SendMethod, Type) {	var url = ScriptPath;	var XHRequest = false;	var CollectionType = "";	//SHOWS LOADER	document.getElementById(LoadingID).innerHTML = LoadingContent;	document.getElementById(LoadingID).style.display="block";			if(window.XMLHttpRequest){	XHRequest = new XMLHttpRequest();	} else if(window.ActiveXObject){	XHRequest = new ActiveXObject("Microsoft.XMLHTTP");	}			if(XHRequest){	XHRequest.open(SendMethod, url);	XHRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	XHRequest.onreadystatechange = function(){	if(XHRequest.readyState < 4){		} else if(XHRequest.readyState == 4 && XHRequest.status == 200){		//IF LOADER IS NOT SAME AND CONTENT DIV THEN HIDE		if(ElementID!=LoadingID) {			document.getElementById(LoadingID).style.display="none";		}				if (Type!=undefined && Type!="") {			self.setTimeout(function () {			var ProductGlide = new Glider('my-glider', {duration:0.5});			},1000);				}				document.getElementById(ElementID).innerHTML = XHRequest.responseText		delete XHRequest;		XHRequest = null;		}	}		if (Type!=undefined && Type!="") {		CollectionType = "&type=" + Type;	}		XHRequest.send(Commands + CollectionType);	}	}function DisplayProduct(ProductID) {	AjaxCommand("includes/functions.asp", "ProductDisplay", "ProductDisplay_loader", "Please wait...", "sAction=ProductView&ProdID=" + ProductID, "POST");	self.setTimeout(function () {		ScrollBarLoad();	},1000);}function ScrollerLoad(Scrollarea) {	// vertical slider control	var slider3 = new Control.Slider('handle3', 'track3', {		axis: 'vertical',		onSlide: function(v) { scrollVertical(v, $(Scrollarea), slider3);  },		onChange: function(v) { scrollVertical(v, $(Scrollarea), slider3); }	});		// scroll the element vertically based on its width and the slider maximum value	function scrollVertical(value, element, slider) {		element.scrollTop = Math.round(value/slider.maximum*(element.scrollHeight-element.offsetHeight));	}}function SwitchMainImg(imgSrc) {	var MainImg = document.getElementById("MainImg");	document.getElementById("MainImgSrc").value = imgSrc;	MainImg.style.background = "url('thumbimg.aspx?FileName=" + imgSrc + "&width=140') center no-repeat";}function EnlargeImg() {	var ImgSrc = document.getElementById("MainImgSrc").value;	var ImagePopup = document.getElementById("PopupImg");	ImagePopup.style.display="block";	ImagePopup.innerHTML = '<div class="close" onclick="ClosePopup();">CLOSE</div><img src="' +  ImgSrc + '" style="width:500px;" />';}function ClosePopup() {	var ImagePopup = document.getElementById("PopupImg");	ImagePopup.style.display="none";}function OrderItem(ProductID,Qty,ItemSize) {	//alert(ProductID + "@" + Qty);	//document.getElementById("MiniCart").style.display="block";	Effect.Appear('MiniCart', { duration: 1.0 });	AjaxCommand("includes/cartfunctions.asp", "MiniCartCost", "MiniCartCost", "Please wait...", "CartAction=AddtoCart&ProductID=" + ProductID + "&Qty=" + Qty + "&size=" + ItemSize, "POST");	}function UdpateMiniCart() {	AjaxCommand("includes/cartfunctions.asp", "MiniCartCost", "MiniCartCost", "Please wait...", "CartAction=ViewMiniCart", "POST");}function ImagePopup(ImageUrl) {	var gallery_popup = document.getElementById("gallery_popup");	Effect.DropOut('gallery_items');		Effect.Appear('gallery_popup', { duration: 1.0 });	gallery_popup.style.background="url('thumbimg.aspx?filename=" + ImageUrl + "&height=600') no-repeat center top";	//gallery_popup.innerHTML="<img src='thumbimg.aspx?filename=" + ImageUrl + "&height=600' />";}function ImagePopup_close() {	Effect.Fade('gallery_popup', { duration: 1.0 });	Effect.Grow('gallery_items');}function DelveryItemCheck () {	if (document.customerform.DeliverySame.checked) {		dsame=1;document.customerform.DeliveryAddress.value=''; 		document.customerform.DeliveryPostCode.value='';		Effect.SlideUp('deliveryitem1', { duration: 1.0 });		Effect.SlideUp('deliveryitem2', { duration: 1.0 });	} else {		dsame=0;document.customerform.DeliveryAddress.focus();		Effect.SlideDown('deliveryitem1', { duration: 1.0 });		Effect.SlideDown('deliveryitem2', { duration: 1.0 });	};}function SendContactForm(form) {	/*config*/	var url = "includes/ajax_mail.asp"; /*url of the mailer program*/	var loadingimg = "images/ajax-loader.gif"; /* Loading Image */		var XHRequest = false;		if(window.XMLHttpRequest){	XHRequest = new XMLHttpRequest();	} else if(window.ActiveXObject){	XHRequest = new ActiveXObject("Microsoft.XMLHTTP");	}		if(XHRequest){	//XHRequest.open("GET", url+"?to=" + form.to.value + "&from=" + form.from.value + "&subject=" + form.subject.value + "&body=" + form.body.value);	XHRequest.open("POST", url);	XHRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		XHRequest.onreadystatechange = function(){	if(XHRequest.readyState < 4){	document.getElementById("status").innerHTML = "<img src='"+loadingimg+"'> Please wait ...";	} 		else if(XHRequest.readyState == 4 && XHRequest.status == 200){	document.getElementById("status").innerHTML = '<input type="button" onclick="SendContactForm(this.form)" value="SEND" class="basket_btn" style="border:1px solid #999999;" />';	document.getElementById("messagebox").innerHTML = XHRequest.responseText;		delete XHRequest;	XHRequest = null;	}	}	//XHRequest.send(null);		XHRequest.send("name=" + escape(form.name.value) + "&tel=" + escape(form.tel.value) + "&email=" + escape(form.email.value) + "&message=" + escape(form.message.value));	}}
