
function showDIV(id){
	if (document.getElementById(id).style.display == "") 
		showit = "none"; 
	else 
		showit = ""; 
	document.getElementById(id).style.display = showit;
}





			function unblur() {
			      //  this.blur();				  
			}    
			function offNav() {
			        navState = 0;   
			}    
			function onNav() {
			        navState = 1;
			} 
			function blurAllLinks() {
			        if (!document.getElementById) return;
			        links = document.getElementsByTagName("a");
			        for(i=0; i<links.length; i++) {
			            links[i].onfocus = unblur;
			        }    
			        inputs = document.getElementsByTagName("input");
			        for(i=0; i<inputs.length; i++) {
			            inputs[i].onfocus = offNav;
			            inputs[i].onblur = onNav;
			        }      
			        texts = document.getElementsByTagName("textarea");
			        for(i=0; i<texts.length; i++) {
			            texts[i].onfocus = offNav;
			            texts[i].onblur = onNav;
			        } 
			}




function PopupPic(sPicURL) {
	window.open( "popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}
 
        
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) 
		selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
	var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
         

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function openMyPopup(url,target,W,H)
 {
    if (!W) W=200;
    if (!H) H=200;
    if (!target) target="_new";

    var X = (screen.width/2)-(W/2);
    var Y = (screen.height/2)-(H/2);

    var winPref = "width=" + W + ",height=" + H
                + ",innerWidth=" + W + ",innerHeight=" + H
                + ",left=" + X + ",top=" + Y
                + ",screenX=" + X + ",screenY=" + Y
                + ",dependent=yes,titlebar=no,scrollbars=no,resizable=no";


    openMyPopup.popup = window.open( url, target, winPref );
    openMyPopup.popup.resizeTo(1*W,1*H);
    openMyPopup.popup.focus();

    return true;
 }
 
 
 
var currentPanel = 101;

function showCurrent(id ){
	//hide visible panel, show selected panel, set tab
	hidePrevious();
	showit = "";
	selected = "#EEEEEE";	
	document.getElementById(id).style.display = showit;
	document.getElementById("tab"+id).style.backgroundColor = selected;
	currentPanel = id;
}

function hidePrevious(){
	showit = "none";
	unselected = "#FFFFFF"; 
	document.getElementById(currentPanel).style.display = showit;	
	document.getElementById("tab"+currentPanel).style.backgroundColor = unselected;
}




function validTimeNR(formField,fieldLabel)
{
  
  //allow the field to be empty	
  if(!formField.value){
    return true;
  }

  //if there is data, then it better be right
  var result = true;
  var elems = formField.value.split(":");     
     
  //first we deal with the HH:MM cases
  if (elems.length == 2){

    var hours = parseInt(elems[0],10);
    var minutes = parseInt(elems[1],10);
    result = !isNaN(hours) && (hours > 0) && (hours < 24) && (elems[0].length == 2) && !isNaN(minutes) && (minutes > 0) && (minutes < 60)&& (elems[1].length == 2);
   
   if (!result){
   
      alert('Please enter a time in the format HH:MM for the "' + fieldLabel +'" field.');
      formField.focus();    
   }
  
      return result;
  }
  
  else{
      alert('Please enter a time in the format HH:MM for the "' + fieldLabel +'" field.');
      formField.focus(); 
      return false;
  }   

}



function validDateNR(formField,fieldLabel)
{
  var result = true;

  if(!formField.value){
    return true;
  }

  var elems = formField.value.split("/");     
  result = (elems.length == 3); // should be three components
     

  if (result){

    var day = parseInt(elems[0],10);
    var month = parseInt(elems[1],10);
    var year = parseInt(elems[2],10);
    result = !isNaN(month) && (month > 0) && (month < 13) &&
		!isNaN(day) && (day > 0) && (day < 32) &&
            	!isNaN(year) && (elems[2].length == 4);
   }
     
     if (!result)
     {
       alert('Please enter a date in the format DD/MM/YYYY for the "' + fieldLabel +'" field.');
      formField.focus();    
     }
  
  return result;
}




function validDate(formField,fieldLabel,required)
{
  var result = true;

  if (required && !validRequired(formField,fieldLabel))
    result = false;
  
   if (result)
   {

     var elems = formField.value.split("/");     
     result = (elems.length == 3); // should be three components
     

     if (result)
     {
       var day = parseInt(elems[0],10);
       var month = parseInt(elems[1],10);
       var year = parseInt(elems[2],10);
       result = !isNaN(month) && (month > 0) && (month < 13) &&
		!isNaN(day) && (day > 0) && (day < 32) &&
            	!isNaN(year) && (elems[2].length == 4);
     }
 
    
     if (!result)
     {
       alert('Please enter a date in the format DD/MM/YYYY for the "' + fieldLabel +'" field.');
      formField.focus();    
     }


  } 
  
  return result;
}

function validRequired(formField,fieldLabel)
{
  var result = true;
  
  if (formField.value == "")
  {
    alert('Please enter a value for the "' + fieldLabel +'" field.');
    formField.focus();
    result = false;
  }
  
  return result;
}


function help_popup(URL) { 

day = new Date(); 
id = day.getTime(); 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=450,height=500');"); 

} 

function contact_rep_popup(URL) { 

day = new Date(); 
id = day.getTime(); 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width=500,height=460');"); 

}

function upload_popup(URL) { 

day = new Date(); 
id = day.getTime(); 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=530,height=330');"); 

} 

