function ajaxFunction(a)
	{  
	var xmlHttp;
	try
		{    
  		// Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest();
  		}
	catch (e)
		{    
		// Internet Explorer    
		try
			{     
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      	
			}
		catch (e)
      		{
	  		try
       			{        
	   			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
	   			}
     		catch (e)
        		{        
				alert("Your browser does not support AJAX!");        
				return false;        
				}      
			}    
		}
		xmlHttp.onreadystatechange=function()
  			{
     		if(xmlHttp.readyState==4)
        		{
				setDivContents("content_info",xmlHttp.responseText)

       			}
			}
			xmlHttp.open("GET","/ajax/distributors.jsp?id="+a,true);
    		xmlHttp.send(null);  
		}
		
function ajaxFunction2(a)
	{  
	var xmlHttp;
	try
		{    
  		// Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest();
  		}
	catch (e)
		{    
		// Internet Explorer    
		try
			{     
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      	
			}
		catch (e)
      		{
	  		try
       			{        
	   			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
	   			}
     		catch (e)
        		{        
				alert("Your browser does not support AJAX!");        
				return false;        
				}      
			}    
		}
		xmlHttp.onreadystatechange=function()
  			{
     		if(xmlHttp.readyState==4)
        		{
				setDivContents("content_info",xmlHttp.responseText)

       			}
			}
			xmlHttp.open("GET","/ajax/distributors2.jsp?id="+a,true);
    		xmlHttp.send(null);  
		}

/* sets the html content of a specified DIV id - cross browser compatible */
function setDivContents(divName, string){
//salert(string);
	var type	=	getBrowser();
	var obj		=	getObjectReference(divName);
	if(type == "IE"){
		obj.innerHTML	=	string;
	}else if(type == "NN"){
		obj.document.open();
		obj.document.write(string);
		obj.document.close();
	}else if(type == "MO" || type == "OP"){
		obj.innerHTML	=	string;
	}
}

/* Returns the type of browser on the client side */
function getBrowser(){
	var type	=	"IE";//set the default type according to most common
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById){
		type	=	"OP";
	}
	if (document.all){
		type	=	"IE";
	}
	if (document.layers){
		type	=	"NN";
	}
	if (!document.all && document.getElementById){
		type	=	"MO";
	}
	return type;
}

/* get object reference according to browser - mainly used for styling objects */
function getObjectReference(divName){
	var type	=	getBrowser();
	var object	=	false;
	if(type == "IE"){
		object = document.getElementById(divName);
		//object = document.all[divName];
	}else if(type == "NN"){
		object = document.layers[divName];
	}else if(type == "MO" || type == "OP"){
		object = document.getElementById(divName);
	}
	return object;
}

function validate(a){

	 if(a.prefix.value==""){
		alert("Please enter your prefix");
		a.prefix.focus();		
	}else if(a.fname.value==""){
		alert("Please enter your first name");
		a.fname.focus();		
	}else if(a.sname.value==""){		
		alert("Please enter your surname");
		a.sname.focus();
	}else if(a.mailaddress.value==""){		
		alert("Please enter your mailing address");
		a.mailaddress.focus();
	}else if(a.city.value==""){		
		alert("Please enter your city");
		a.city.focus();
	}else if(a.province.value==""){		
		alert("Please enter your province");
		a.province.focus();
	}else if(a.postalcode.value==""){		
		alert("Please enter your postal code");
		a.postalcode.focus();
	}else if(a.country.selectedIndex==0){		
		alert("Please enter your country");
		a.country.focus();
	}else if(a.email.value==""){		
		alert("Please enter your email address");
		a.postalcode.focus();
	}else{
		a.submit();	
	}
	
	
	
}
