// specific client-server comms - ajax
function requestor(func,myObj) {
	//alert( func + "    " + myObj);
	//var ser = new PHP_Serializer(true);  // using plain text for now
	//var mySer = ser.serialize(myObj);
	myRand=parseInt(Math.random()*99999);
	//var url = "extras/jt.php?func="+ func +"&myser=" + mySer + "&rand=" + myRand;
	var url = "/extras/sess_change.php?func="+ func +"&val=" + myObj + "&rand=" + myRand;
	XMLHttpRequestObject=new GetXmlHttpObject();
	//alert(url);
	if (XMLHttpRequestObject==null) {
		alert ("Your browser does not support AJAX!");
		return;
	}
	if(XMLHttpRequestObject) {
		XMLHttpRequestObject.open("GET", url, true);
		XMLHttpRequestObject.onreadystatechange = function() {
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
				try {
					//var stuff = JSON.parse(XMLHttpRequestObject.responseText); // hell no
					//var desc =  stuff[0];
					//var myObj =  stuff[1];
					// return
					var stuff = XMLHttpRequestObject.responseText;
					var desc =  stuff.substr(0,4);
					var mesg =  stuff.substr(4);
					//alert(back +"  "+ stuff);
					switch (desc) {
						case 'brow':
							// nothing done
							break;
						case 'addc': // add item to cart
							// echo qty on cart link
							document.getElementById("cartlaunch").innerHTML = "(" + mesg + ") CART";
							// exception not handled
							break; // case 
						case 'c2pp':
							if (mesg == "1") { // success
								// nothing done
							}
							break;
						case 'ifmht':
							if (mesg == "1") {
								// nothing done
							}
							break;
					} // switch
				} // try
				catch(err) {
					// ignore error. debug code below
					// alert(err);
					// document.getElementById("ress").innerHTML = "Description not found. ERROR";
					// return 'HTTP requestor error';
				} // catch
			} // if ready 4 status 200
		} // state change
		XMLHttpRequestObject.send(null);
	}
};   ////// requestor

function GetXmlHttpObject() { // create requestor object
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
return xmlHttp;
};

function resizeIframe() {
	var w = document.body.clientWidth;
	var ww = w*.6;
//	document.imagg.width = ww;
	// 1280 x 963 img
	var htt = (ww/900) * 600;
	if (window.innerHeight){var h=window.innerHeight;}else if(document.documentElement && document.documentElement.clientHeight){var h=document.documentElement.clientHeight;}else if(document.body){var h=document.body.clientHeight;}else{var h=40;}
	if (h > 600) {
		var top = (h/8);
	}
	else {
		var top = 30;
	}
	document.getElementById('blank').style.height = top + 'px';
	document.getElementById('eco-friendly').style.height = (h - (top*2)) + 'px';
};
