function getPage(Pagename,destination,selType,vOption,vOption2){
	
    document.getElementById(destination).innerHTML = '';

   if(selType!=''){

	 var doc = null; 

   if (typeof window.ActiveXObject != 'undefined' ) 
   { 
       doc = new ActiveXObject("Microsoft.XMLHTTP"); 
   } 
   else 
   { 
       doc = new XMLHttpRequest(); 
   }
	
		if (doc){ 	
            doc.open("GET", Pagename+"?Type="+selType+"&Options="+vOption+"&Options2="+vOption2, false);
	        doc.send(null);
			document.getElementById(destination).innerHTML= ''
			document.getElementById(destination).innerHTML = doc.responseText;
		}else{
		
			destination.innerHTML = 'Browser unable to create XMLHttp Object';
		}
		
	}else{
	
			destination.innerHTML= '' ;
		}
	

} 

// name-value pairs can be passed as extra arguments eg:
//
// getPage2("getCustomer.asp","customer","customer","123456");
// getPage2("branchSearch.asp","branches","name","coventry","brand","tp");
//
function getPage2(url, destinationId) {
	var destination = document.getElementById(destinationId);
	var doc = null; 
	
	//create xml request object
	if(typeof window.ActiveXObject != "undefined") { 
		doc = new ActiveXObject("Microsoft.XMLHTTP"); 
	} else {
		doc = new XMLHttpRequest(); 
	}
	
	//contstruct url (uses variable arguments)
	noPairs = arguments.length / 2 - 1;
	if(noPairs) {
		url += "?" + arguments[2] + "=" + arguments[3];
	}
	for(pair = 1; pair < noPairs; pair++) {
			url += "&" + arguments[pair * 2 + 2] + "=" + arguments[pair * 2 + 3];
	}
	
	//retrieve page and stick in destination element
	if(doc) { 	
		doc.open("GET", url, false);
		doc.send(null);
		destination.innerHTML = doc.responseText;
	} else {
		destination.innerHTML = "";
	}
} 

// name-value pairs can be passed as extra arguments eg:
//
// getXml("getCustomer.asp","customer","123456");
// getXml("branchSearch.asp","name","coventry","brand","tp");
//
function getXml(url) {

	//create xml request object
	var doc = null;
	if(typeof window.ActiveXObject != "undefined") { 
		doc = new ActiveXObject("Microsoft.XMLHTTP"); 
	} else {
		doc = new XMLHttpRequest(); 
	}
	
	//contstruct url (uses variable arguments)
	noPairs = (arguments.length - 1) / 2;
	if(noPairs) {
		url += "?" + arguments[1] + "=" + arguments[2];
	}
	for(pair = 1; pair < noPairs; pair++) {
			url += "&" + arguments[pair * 2 + 1] + "=" + arguments[pair * 2 + 2];
	}
	
	//retrieve page and stick in destination element
	if(doc) { 	
		doc.open("GET", url, false);
		doc.send(null);
	}
	
	return doc.responseXML;
} 

function getPageWithArray(Pagename,destination,selType,namesArray,valuesArray){
    document.getElementById(destination).innerHTML = '';

   if(selType!=''){

	 var doc = null; 

   if (typeof window.ActiveXObject != 'undefined' ) 
   { 
       doc = new ActiveXObject("Microsoft.XMLHTTP"); 
   } 
   else 
   { 
       doc = new XMLHttpRequest(); 
   }
	
		if (doc){ 	
		    var querystring = "?Type="+selType
			for(var qs=0;qs<namesArray.length;qs++)
		    {
		     querystring = querystring + "&"+namesArray[qs]+"="+valuesArray[qs]
			}
            doc.open("GET", Pagename+querystring, false);
	        doc.send(null);
			document.getElementById(destination).innerHTML= ''
			document.getElementById(destination).innerHTML = doc.responseText;
		}else{
		
			destination.innerHTML = 'Browser unable to create XMLHttp Object';
		}
		
	}else{
	
			destination.innerHTML= '' ;
		}
	

} 


