if (document.images){
   var cimg = new Image();
   cimg.src = "/checkout.gif";
   var atco = new Image();
   atco.src = "/images/atco.gif";}
function chkLog(dataForm){
if (dataForm.user.value=="" || dataForm.user.value=="email"){
	alert("Please Enter Email");
	dataForm.user.focus();
	return false;}
if (dataForm.pass.value==""){
	alert("Please Enter Password");
	dataForm.pass.focus();
	return false;}
return true;
}
function isIE(){
  var rv = 0; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function atc_tgl(tgl,id){
  var atc=document.getElementById(id);
  if(atc!=null){
    (tgl) ? (atc.src='/images/atco.gif') : (atc.src='/images/atc.gif');
  }
}
function set_bk(mib){
//#333366 #BFACE6
if(mib=="ukl" || mib=="eul"){
document.getElementById(mib).style.backgroundColor="#333366";}
else if(mib.indexOf("l")==0){
document.getElementById(mib).style.backgroundImage="url('/ar2b.gif')";
document.getElementById(mib + 'a').style.backgroundImage="";
}
else{
document.getElementById(mib).style.backgroundColor="#CCCCFF";
}
}
function do_clear(mib){
if(mib.indexOf("l")==0){
document.getElementById(mib).style.backgroundImage="";
if(mib=="l0")
document.getElementById(mib + 'a').style.backgroundImage="url('/ars1.gif')";
else
document.getElementById(mib + 'a').style.backgroundImage="url('/ar1c.gif')";
}
else{
document.getElementById(mib).style.backgroundColor="";}
//alert (document.getElementById('cl2').style.background);
}
function openPop(pURL,sx,sy){
iMyWidth = (window.screen.width/2) - (sx/2 + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (sy/2 + 50); //half the screen height minus half the new window height (plus title and status bars).
popwindow = window.open(pURL,'unew', "status,height=" + sy + ",width=" + sx + ",resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes,resizable=no,location=no,directories=no");
popwindow.focus();
if (popwindow.opener == null) popwindow.opener = window; 
popwindow.opener.name = "opener";  
}
function shp_cc(id,wt){
if(id==2 || id==3 || id==5){
  //if(document.getElementById('us_zip')!=null){
    //document.getElementById('srow').deleteCell(2);
	document.getElementById("us_zip").innerHTML='&nbsp;';
	document.getElementById("srate").innerHTML='***Calculating';
	var req=makeHttpRequest('shippy.php', 'cc=' + id + '&wt=' + wt,'sho_rate',1);
  //}
}
else{
  //if(document.getElementById('us_zip')!=null){
    //document.getElementById('srow').insertCell(2);
	document.getElementById("us_zip").innerHTML='<input type="text" name="zip" id="zip" value="" style="height: 13px; width: 40px; "oninput="get_shp(this.value,this.form.wt.value);" onpaste="get_shp(clipboardData.getData(\'Text\'),this.form.wt.value);" onkeyup="get_shp(this.value,this.form.wt.value);">&nbsp;';
	document.getElementById("srate").innerHTML='<- Enter Zip Code';
  //}
}
}
function get_shp(zip,wt){
if(zip.length<5){return true;}//not entered yet
else if(zip.length>5){zip=zip.substring(0,5);document.getElementById("zip").value=zip;}
//else{
	if(isNaN(parseInt(zip))){
		alert("Please Enter a Numeric Five Digit Zip Code");
		document.getElementById("zip").focus();
		return false;
	}
	if(document.getElementById("zip")!=null)document.getElementById("zip").blur();
	document.getElementById("srate").innerHTML="***Calculating";
	var req=makeHttpRequest('shippy.php', 'zip=' + zip + '&wt=' + wt,'sho_rate',1);
//}
}
function bookmark(title,url) {
  var ie=isIE();
  if (window.sidebar != null && !ie) { 
    window.sidebar.addPanel(title, url,""); 
  } 
  else if( window.external !=null) {
    window.external.AddFavorite( url, title);
  } 
  /*else if( window.opera && window.print ) {
    return true;
  }*/
}

function sho_rate(stuff){
/*alert(stuff);
return true;*/
var rate=stuff.getElementsByTagName('rate');
//alert(getNodeValue(rate[0],'amt'));
var rate=getNodeValue(rate[0],'amt');
if(rate.indexOf('not found')!=-1){document.getElementById("srate").innerHTML='&nbsp;' + rate + '*';}
else {document.getElementById("srate").innerHTML='&nbsp;$' + rate + '*';}
//document.getElementById("atc").focus();
}
function getNodeValue(obj,tag)
{
	return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
}

function makeHttpRequest(url, data, callback_function, return_xml) 
{ 
   var http_request = false; 

   if (window.XMLHttpRequest) { // Mozilla, Safari,... 
       http_request = new XMLHttpRequest(); 
       if (http_request.overrideMimeType) { 
           http_request.overrideMimeType('text/xml'); 
       } 
   } else if (window.ActiveXObject) { // IE 
       try { 
           http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
       } catch (e) { 
           try { 
               http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
           } catch (e) {} 
       } 
   } 

   if (!http_request) { 
       document.getElementById("srate").innerHTML="5.95 - 7.36";
       document.getElementById("atc").focus(); 
       return false; 
   } 
   http_request.onreadystatechange = function() {
       if (http_request.readyState == 4) { 
           if (http_request.status == 200) { 
               if (return_xml) {
                   eval(callback_function + '(http_request.responseXML)'); 
               } else { 
                   eval(callback_function + '(http_request.responseText)'); 
               } 
           } else { 
               //alert('There was a problem with the request.(Code: ' + http_request.status + ')');
			   document.getElementById("srate").innerHTML="5.95 - 7.36";
       		   document.getElementById("atc").focus(); 
           } 
       } 
   } 
   // add some cookies hold the milk
   if(data!=""){//Post
   		http_request.open('POST', url, true);
		http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_request.send(data);
   }
   else{
   http_request.open('GET', url, true); 
   //http_request.setRequestHeader("Cookie","sea=biscuit");
   http_request.send(null); 
   }
}
