
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function showCalendar(i) {
   var tbm;
   if(i==1) tbm='basket.sodate';
   if(i==2) tbm='basket.followupdate';

   window.open('../calpop.php?tbm='+tbm,'ncal','width=220, height=220');
}

function showPerson(i) {
   var tbm;
   if(i==2){
    tbm='basket.custname&tbi=basket.custid&coe=cust&rto=npo&ad1=basket.ad1&ad2=basket.ad2&ad3=basket.ad3&bad1=basket.bad1&bad2=basket.bad2&bad3=basket.bad3&coe=cust&searchv='+basket.custname.value;
    }
    window.open('../custpop.php?dct=subdso&tbm='+tbm,'ncal','scrollbars=yes,width=220, height=220');
}

  function newloc(url){
   window.open(url);
   window.close();
  }

function showContact(i) {
   var tbm;
   if(i==3){
    tbm='basket.contname&tbi=basket.contactid&coe=cont&searchv='+basket.custid.value;
   }
   window.open('engpop2.php?tbm='+tbm,'ncal','scrollbars=yes,width=220, height=220');
}


function pgclicked(pg){
 var pg;
// alert(pg);
 document.pgchoice.olpg.value=pg;
 document.pgchoice.submit();

}

function subgclicked(pg){
 var pg;
// alert(pg);
 document.subpgchoice.subg.value=pg;
 document.subpgchoice.submit();

}

function lil(pid){
// window.open('largeimage.php?pid='+pid,'ncal','width=460, height=360');
 //alert('opening large image for '+pid);
 //window.open('./largeimage.php?pid='+pid,'ncal','width=460, height=360');
// window.open('./largeimage.php?pid='+pid,'ncal');
 window.open('./largeimage.php?pid='+pid,fullscreen=0,menubar=0,resizable=1,scrollbars='on',toolbar=0);
}



function numbersonly(event) {
	var charCode =(navigator.appName == "Netscape") ? event.which : event.keyCode
	status = charCode
	if(charCode != 4 && charCode != 31 && (charCode < 48 || charCode > 57))   {
		return false
	}
	return true
}

function changeto(highlightcolor){
source=event.srcElement
if (source.tagName=="TR2"||source.tagName=="TABLE")
return
while(source.tagName!="TR")
source=source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
{
source.style.backgroundColor=highlightcolor;

}
}

function changeback(originalcolor){
if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
return
if (event.toElement!=source && source.tagName=="TR")
source.style.backgroundColor=originalcolor
}

function gowebcheckout(form){
// alert('checking out');
 var pval;
 pval=round(document.basket.prodval.value,2);
// alert(pval);

    if (!checkBasicInput(document.basket.firstname,50,true) ||
        !checkBasicInput(document.basket.surname,50,true) ||
        !checkBasicInput(document.basket.email,50,true) ||
        !checkBasicInput(document.basket.shipaddress1,50,true) ||
        !checkBasicInput(document.basket.shipstate,50,true) ||
        !checkBasicInput(document.basket.shipsuburb,50,true))
     {
      return false;
    }
 if (pval>11){
  document.basket.webneworder.value=1;
//   alert('go checkout ticked');
    //alert('submitting order');
    document.basket.submit();
   }else{
   alert('this order has no value');
   return false;
 }
}

function round(number,X) {
// rounds number to X decimal places, defaults to 2
//alert('now rouding='+X)
//X = (!X ? 2 : X);
//alert(X)
//X=0;
//return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

 function sendmail(){
 window.open('sendmail.php');
 }

// -->

 function testt(){
  alert('hey');
 }


/*standard form processing*/
function getForm(fobj){
 var str ='';
 var ft ='';
 var fv ='';
 var fn ='';
 var els ='';  

 for(var i = 0;i < fobj.elements.length;i++) {
	 els = fobj.elements[i];
	 ft = els.title;
	 fv = els.value;
	 fn = els.name;  
	 if(fn!=''){
	 //alert(fn+' '+fv+' '+els.type);
	 switch(els.type) {
		case "text": 
		case "hidden":  
		case "password":
		case "textarea":    
		// is it a required field?
		if(encodeURI(ft) == "required" && encodeURI(fv).length < 1) {
			alert(''+fn+' is a required field, please complete.');   
			els.focus(); 
			return false;
		}

		str += fn + "=" + encodeURI(fv) + "!I!";     
		break;  

		case "checkbox":
		case "radio":  
		if(els.checked) str += fn + "=" + encodeURI(fv) + "!I!";     
		break;
		
		case "select-one":
		str += fn + "=" +       els.options[els.selectedIndex].value + "!I!";
		break;
        }	// switch 
        }//has name
 }
 str = str.substr(0,(str.length - 3));
 return str
}

