	function createRequestObject() 
	{
		var ua;
	
		if(window.XMLHttpRequest) {
			try {
				ua = new XMLHttpRequest();
			} catch(e) {
				ua = false;
			}
		} else if(window.ActiveXObject) {
			try {
				ua = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				ua = false;
			}
		}
		return ua;

	}
	
	global_option_id = "";
	global_option_id2 = "";
	
	function sndReq(action,divObj) 
	{	
		var xhReq = createRequestObject();
 		xhReq.open("get", action, true);
 		xhReq.onreadystatechange = function() {
   			if (xhReq.readyState != 4)  { return; }
   			var serverResponse = xhReq.responseText;
			document.getElementById(divObj).innerHTML = serverResponse;
 			}
 		xhReq.send(null);
 	}
	
	function sndAddCartReq(action) 
	{	
		var xhReq = createRequestObject();
 		xhReq.open("get", action, true);
 		xhReq.onreadystatechange = function() {
   			if (xhReq.readyState != 4)  { return; }
   			var serverResponse = xhReq.responseText;
			var cart_prod_id = serverResponse;
				
			//sndImgReq("ajax.php?action=GetCartProductImage&id="+cart_productID, 'cartproduct_image');
			sndReq("ajax.php?action=GetCartProductName&id="+cart_prod_id, 'cartproduct_name');
			sndReq("ajax.php?action=GetCartProductSubtotal&id="+cart_prod_id, 'cartproduct_subtotal');	
			sndReq("ajax.php?action=GetCartProductItem&id="+cart_prod_id, 'cartproduct_options');
			/////////////////////////sndReq("ajax.php?action=GetCartItemCount", 'itemsincart');
			showCart();
			//document.getElementById("cartButton").style.display="inline";
    		//document.getElementById("cartButtonOff").style.display="none";
				
		}
		
		xhReq.send(null);	
					
	}

	
	function showCart() {
//		document.getElementById("mycartoverlay").style.top = "0px";
	
		document.getElementById("mycartoverlay").style.display = "block";
		new Effect.SlideDown(document.getElementById("mycart"));
	}
	
	function hideCart()
	{
		document.getElementById("mycartoverlay").style.display= "none";
		new Effect.SlideUp(document.getElementById("mycart"));
	}
	
	
	function getPageSize(){
	
		var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			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
			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 = windowWidth;
		} else {
			pageWidth = xScroll;
		}
	
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
	}
	
	function autotab(original,destination){
		if (original.getAttribute&&original.value.length==original.getAttribute("maxlength")) destination.focus();
	}
	
	function IsNumeric(sText)

	{
	   var ValidChars = "0123456789.";
	   var IsNumber=true;
	   var Char;
	
	 
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
		  { 
		  Char = sText.charAt(i); 
		  if (ValidChars.indexOf(Char) == -1) 
			 {
			 IsNumber = false;
			 }
		  }
	   return IsNumber;
   
   }
   
   