function doCheckOut(s,h) {
	new Ajax.Updater('messageBox', '/ajax/', {
		onComplete: changeCheckoutImg(s,h,1),
		method:'post', 
		postBody:'w=4&s='+s+'&hash=' + h}
		);		
} //function doCheckOut
	

function changeCheckoutImg(s,h,c) {
	if (c==1)
		setCookie(h,s);
	
	if ($('ok'+h) != undefined) {
		if (s==3) {
			$('ok'+h).innerHTML = '<img src="/i/ok_a.gif" alt="OK" />';
			$('bad'+h).innerHTML = '<img src="/i/bad_ap.gif" alt="BAD" />';
		} else if (s==2) {
			$('ok'+h).innerHTML = '<img src="/i/ok_ap.gif" alt="OK" />';
			$('bad'+h).innerHTML = '<img src="/i/bad_a.gif" alt="BAD" />';
		}
	}
	setTimeout(function () {$('messageBox').innerHTML = '';} ,1500);

} //function changeCheckoutImg


function getCookie(name) {
   var start = document.cookie.indexOf(name+"=");
//   alert(document.cookie);
   var len = start+name.length+1;
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";",len);
   if (end == -1) end = document.cookie.length;
   var res = unescape(document.cookie.substring(len,end));
  // alert(res);
   return res;
} //function getCookie

function setCookie(name,value,expires,path,domain,secure) {
    var cookieString = name + "=" +escape(value) +
       ( (expires) ? ";expires=" + expires.toGMTString() : "") +
       ( (path) ? ";path=" + path : "") +
       ( (domain) ? ";domain=" + domain : "") +
       ( (secure) ? ";secure" : "");
     
    document.cookie = cookieString;
} //function setCookie

function checkCheckOutCookie() {
	var oC = document.cookie.split("; ");
	for (var i=0; i<oC.length; i++){
	    var oD = oC[i].split("=");
	 //   alert (oD[0] + '==' +oD[1]);
	    changeCheckoutImg(oD[1],oD[0],0);
	} //for
} //function checkCheckOutCookie