function show_load() { 
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE 
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth; 
    myHeight = document.documentElement.clientHeight; 
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth; 
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight ); 
 //var lft = 0, top = 0;
 var lft = (myWidth/2)-75;
 var top = (myHeight/2)-50 ; 
 //alert(lft + " 000 " + top );
 var str = "<table border=0 cellpadding=4 cellspacing=1 width=100% height=100% align=center style=BORDER-RIGHT:#888888 2px solid; BORDER-TOP:#888888 2px solid; BORDER-LEFT:#888888 2px solid; CURSOR:default; BORDER-BOTTOM:#888888 2px solid; BACKGROUND-COLOR:#ffffff bgcolor=#cccccc><tr><td align=center class=text11><IMG src=/images/spinner.gif>&nbsp;&nbsp;<b>Loading ...</b></td></tr></table>";
 
 document.getElementById('load_splash').style.left=lft;
 document.getElementById('load_splash').style.top=top;
 document.getElementById('load_splash').style.width="150px";
 document.getElementById('load_splash').style.height="100px";
 document.getElementById('load_splash').innerHTML= str;
 document.getElementById('load_splash').style.visibility="visible";
 
}
//---------------------------------------------------------------------------------------------------------

function hide_load(){
document.getElementById('load_splash').style.visibility="hidden"; 
}

function GetXmlHttpObject(handler)
{ 
	var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
	return objXMLHttp
}

var xmlHttp;
var _xt;
var _div_id;
var _param;

function show_data(param,xt,_div)
{
//show_load();
//alert("from this field " + param);
var obj = document.getElementById(param);
var str = obj.value;
//alert(obj.options[obj.selectedIndex].text);
_div_id = _div;
//alert("This value passed " + str);
_xt = xt;
_param = param;
//alert("Task number : " + _xt);
//alert("going to effect this : " + _div_id);

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
		//var url="http://zannebikinis.com/xjax/xjax.php"
		
		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 



function send_data(param,xt,_div)
{
//show_load();
//alert(param);
//var obj = document.getElementById(param);
var str = param;

//alert(str);
_xt = xt;
_div_id = _div;
_param = param;
//alert(_xt);

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
		var url=location.protocol + "//" + location.hostname +"/xjax/xjax.php";
		url=url+"?xt="+xt
		url=url+"&var="+str
		url=url+"&sid="+sid
		url=url+"&xid="+Math.random()
		//alert(url);
		
		xmlHttp.onreadystatechange=stateChanged
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		
} 
		


function stateChanged() 
{ 
  if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	//alert(_xt);
	//alert(xmlHttp.responseText);
	//alert(_div_id);
	//hide_load();
	
			if (_xt==1){
				
				var res = xmlHttp.responseText
				//alert(res);
				if (res=="false") { 
					alert("Couldnt add the product to your cart. \nPlease try again");
				}else{
					document.location = res;
				}
				//document.getElementById('result').value =xmlHttp.responseText;
			}else if ((_xt==2)){
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				//document.getElementById('result').value =xmlHttp.responseText;
				send_data(_param,3,'grand_total');
			}else{
				document.getElementById(_div_id).innerHTML =xmlHttp.responseText;
				//document.getElementById('result').value =xmlHttp.responseText;
			}
	} 
} 

	
