
function menuSetup(currentPage){
$('.menuLink').height("27px");
$('#leftBumper > img').width("104px");
$('#aboutLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_04.png");},function(){ $(this).attr("src","sprites/menu_04.png");});
$('#aboutLink > a > img').width("91px");
$('#whatsnewLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_05.png");},function(){ $(this).attr("src","sprites/menu_05.png");});
$('#whatsnewLink > a > img').width("109px");
$('#quotesLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_06.png");},function(){ $(this).attr("src","sprites/menu_06.png");});
$('#quotesLink > a > img').width("77px");
$('#billingLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_07.png");},function(){ $(this).attr("src","sprites/menu_07.png");});
$('#billingLink > a > img').width("73px");
$('#claimsLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_09.png");},function(){ $(this).attr("src","sprites/menu_09.png");});
$('#claimsLink > a > img').width("72px");
$('#staffLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_10.png");},function(){ $(this).attr("src","sprites/menu_10.png");});
$('#staffLink > a > img').width("62px");
$('#productsLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_11.png");},function(){ $(this).attr("src","sprites/menu_11.png");});
$('#productsLink > a > img').width("96px");
$('#companiesLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_12.png");},function(){ $(this).attr("src","sprites/menu_12.png");});
$('#companiesLink > a > img').width("102px");
$('#contactLink > a > img').hover(function(){ $(this).attr("src","sprites/menuOver_13.png");},function(){ $(this).attr("src","sprites/menu_13.png");});
$('#contactLink > a > img').width("107px");
$('#rightBumper > img').width("107px");
$('#'+currentPage+'Link > a > img').unbind();
}

//shorten getElementByID
function gbID(elementID){ return document.getElementById(elementID);}
//debug script for Ajax calls
function alertJAX(responseText, responseStatus) {  if (responseStatus==200) { alert(responseText); return false; } else {    alert(responseStatus +' -- Error Processing Request');  }}
// Best Ajax object to date, multiple concurrent calls with queue, function callback and notification handler
// based on The Ultimate Ajax Object
function ajaxObject(url, callbackFunction) {
  var that=this;      
  this.update = function(passNames,passValues,notifierArray,postMethod) { 
    //notifier array is [notifier element ID, loading HTML, ok HTML, bad HTML]
    that.notifier='';
    if(notifierArray[0] != ''){
    that.notifier=gbID(notifierArray[0]);
    that.notifier.innerHTML=notifierArray[1];
    }
    
    that.sendString='';
    that.cleanValue=new Array();
    for(i in passNames){
      
      passValues[i]=String(passValues[i]).replace(/&/g, "%26").replace(/\+/g,"%2B");
      that.sendString+=passNames[i]+'='+passValues[i]+'&';
      
      }
    
    if (that.updating) { return false; }
    that.AJAX = null; 

    if (window.XMLHttpRequest) {              
      that.AJAX=new XMLHttpRequest(); //non IE             
    } else {                                  
      that.AJAX=new ActiveXObject("Microsoft.XMLHTTP"); //IE
    }                                             
    if (that.AJAX==null) {                             
      return false;  //no ajax
    } else {
      that.AJAX.onreadystatechange = function() {  
        if (that.AJAX.readyState==4 && that.AJAX.status == 200) {             
          that.notifier.innerHTML=notifierArray[2];                            
          that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);        
          that.AJAX=null;                
          
        } else if(that.AJAX.readyState==4 && that.AJAX.status != 200){
          that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML);        
          that.AJAX=null; 
          that.notifier.innerHTML=notifierArray[3];
          }                                                     
      }                                                       
      if (/post/i.test(postMethod)) {
        var uri=urlCall;
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        that.AJAX.setRequestHeader("Content-Length",that.sendString);
        that.AJAX.send(that.sendString);
      } else {
        var uri=urlCall+'?'+that.sendString; 
        that.AJAX.open("GET", uri, true);                             
        that.AJAX.send(null);                                         
      }              
      return true;                                             
    }                                                                           
  }
  var urlCall = url;        
  this.callback = callbackFunction || function () { };
}

function validateInput(source,type){
text=source.value;
sourceID=source.id;
noteID=source.id+'Note';
var regArray = [];
regArray['email']='^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$';
regArray['name']='^[a-zA-Z \']+$';
regArray['phone']='^[0-9-\(\)]{7,}$';
regArray['street']='^[a-zA-Z0-9 \\.-]+$';
regArray['any']='^.+$';
regArray['num']='^[0-9. ]+$';
regArray['zip']='^[0-9]{5}$';
regArray['alpha']='^[a-zA-Z. ]+$';
regArray['alphaNum']='^[a-zA-Z0-9 ]+$';
regArray['none']='^$';

fieldRegex=new RegExp(regArray[type]);
if(!fieldRegex.test(text)){
$('#'+sourceID).css("border-color","rgb(200,0,0)");
gbID(noteID).innerHTML=" ";
return false;
} else {
$('#'+sourceID).css("border-color","rgb(177,177,177)");
gbID(noteID).innerHTML="";
return true;
}
}

function validateAll(){
validOK=true;
	$("input").focus();
	$('.validateNote').each(function(){
		if($(this).html()==" "){validOK=false;}
	});
if(validOK==false){alert("Please correct the items bordered in red.");}
return validOK;
}
