function chkSch(){
  var ss=document.getElementById("ss");
  if(ss!=null){
    if(ss.value==""){
	  alert("Please Enter Search Criteria");
	  ss.focus();
	  return false;
	}
  }
return true;
}
function cpShip(frm){
  if(frm.ship_first.value!=""){frm.bill_first.value=frm.ship_first.value;}
  if(frm.ship_last.value!=""){frm.bill_last.value=frm.ship_last.value;}
  if(frm.ship_comp.value!=""){frm.bill_comp.value=frm.ship_comp.value;}
  if(frm.ship_add.value!=""){frm.bill_add.value=frm.ship_add.value;}
  if(frm.ship_bldg.value!=""){frm.bill_bldg.value=frm.ship_bldg.value;}
  if(frm.ship_rm.value!=""){frm.bill_rm.value=frm.ship_rm.value;}
  if(frm.ship_lab.value!=""){frm.bill_lab.value=frm.ship_lab.value;}
  if(frm.ship_city.value!=""){frm.bill_city.value=frm.ship_city.value;}
  if(frm.ship_state.selectedIndex){frm.bill_state.selectedIndex=frm.ship_state.selectedIndex;}
  if(frm.ship_zip.value!=""){frm.bill_zip.value=frm.ship_zip.value;}
  if(frm.ship_phone.value!=""){frm.bill_phone.value=frm.ship_phone.value;}
}
function goPay(){
  var cof=document.getElementById('cof');
  if(cof!=null){
    //alert(cof.step.value);
    cof.step.value=4;
	cof.submit();
  }
}
function addProd(frm){
var pnum=0;
for(var i = 0;i < frm.elements.length;i++){
  switch(frm.elements[i].type){
     case "checkbox":
	   if(frm.elements[i].checked){pnum++;}
	 break;
  }
}
if(!pnum){alert('Please select an item(s) to order.');return false;}
return true;
}
function chgMnu(num){
  for(i=1;i<4;i++){
    var mnu=document.getElementById('mnu' + i);
	if(i==num){
	  mnu.className='current';
	}
	else{
	 mnu.className='';
	}
  }
  var eac=document.getElementById('eac');
  if(num==3){
	eac.action="/cart.php";
  }
  else{
    eac.action="/edit-account.php";
  }
 /* mnu=document.getElementById('mnu' + num);
  alert(mnu.className);*/
}
//std ajax stuff
function shoAni(dn,txt){
var ih="";
var dvi=document.getElementById(dn);
if(dvi!=null){
  ih='<br><br><img src="images/loading.gif" width="32" height="32" /></div>';
  //if(txt!=""){ih=ih + " " + txt;}
  alert(ih);
  dvi.innerHTML=ih;
}
}
function reqStuff(act,xmf,dv,wtd){//action,xml flag,div to render, what to do
if(xmf){
  var mreq=makeHttpRequest("mgx.php", act + "&act=" + wtd, "doXML", 1,dv,wtd);
}
else{
  //shoAni(dv,"Loading Page");
  var mreq=makeHttpRequest("mgx.php", act + "&act=" + wtd, "shoHTML", 0,dv,0);
}
}
function makeHttpRequest(url, data, callback_function, return_xml,epar,epar2) 
{ 
   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) { 
       alert('Unfortunatelly you browser doesn\'t support this feature.'); 
       return false; 
   } 
   http_request.onreadystatechange = function() {
       if (http_request.readyState == 4) { 
           if (http_request.status == 200) { 
               if (return_xml) {
			       var efun = callback_function + '(http_request.responseXML';
				   if(epar){ efun= efun + ",'" + epar + "'";}
				   if(epar2){ efun= efun + "," + epar2;}
				   efun= efun + ")";
                   eval(efun); 
               } else { 
			       var efun = callback_function + '(http_request.responseText';
				   if(epar){ efun= efun + ",'" + epar + "')";}
				   else { efun= efun + ")";}
                   eval(efun); 
               } 
           } else { 
               alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
           } 
       } 
   } 
   // wait a minute mr. postman
   if(data!=""){//Post
   		http_request.open('POST', url, true);
		http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http_request.send(data);
   }
   else{ // are you sure you don't have a letter for me
   		http_request.open('GET', url, true);
		http_request.send(null);
   }
}
function shoHTML(ret,dvn){
if(ret.indexOf('<?xml')==-1){
var dvr=document.getElementById(dvn);
if(dvr == null) return 0;
dvr.innerHTML=ret;
}
}