// JavaScript Document
//generic AJAX initialisation
//***Author: JMAMMOUS***
//***Date: Feb 11 2009***
	var xhr;
	if (window.XMLHttpRequest)     // Object of the current windows
		{ 
    		xhr = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else 
 			if (window.ActiveXObject)   // ActiveX version
 				{
    				xhr = new ActiveXObject("MSXML2.XMLHTTP");  // Internet Explorer 
 				} 
				
//****************************************************
//start your functions here

//this function cotnrols which actionFunction to call and which page to include
function actionMain(actionFunction, actionPage) {
	actionFunction(actionPage);
	return false;
}


function showProvinces(actionPage) {
	//alert('prov');
	xhr.open("GET", actionPage, false);		
	//xhr.onreadystatechange  = function()
    //{ 
     //    if(xhr.readyState  == 4)
     //   {
		 xhr.send(null);
	 	 document.getElementById("pafiliaProvincesDIV").innerHTML = xhr.responseText;
	 // 		 document.getElementById("pafiliaProvinces").style.display = '';
	 //		 alert(xhr.responseText);
	 //		 
     //   }
     //}
	 
	 
    // alert(xhr.responseText);
	
}


function tallyCount(actionPage) {
	if(document.getElementById("tallyCount").innerHTML == '') {
		var initValue = 0;
	} else {
		var initValue = document.getElementById("tallyCount").innerHTML;
	}
	
	
	xhr.open("GET", actionPage);		
	xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
			 //send the new responseText and the previous value through to the counter.
			 //searchTools.js
			 tallyCounter(initValue, xhr.responseText);
			 //document.getElementById("tallyCount").innerHTML = xhr.responseText;
			 //alert(xhr.responseText);
         }
    }
	
	    xhr.send(null);
	//alert(xhr.responseText);	
	
}
