	function getServerName(){
		return location.protocol +"//" + location.host ;
	}
	
	function getContextRoot(){
		return "";
	}
	function getServerURL(){
		return getServerName() + getContextRoot();
	}
	
	var xmlHttp;
	function ajaxFunction(){
		
		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!");	    	          
	   		    }
	      }  
   		} 
	}
	
	var xmlHttpS;
	function ajaxFunctionS(){
		
		try{  // Firefox, Opera 8.0+, Safari 
	  		 xmlHttpS=new XMLHttpRequest();
	    }catch (e){  // Internet Explorer  
	    	try{   
	    		 xmlHttpS=new ActiveXObject("Msxml2.XMLHTTP"); 
	    	}catch (e){
	    	    try{
	    	          xmlHttpS=new ActiveXObject("Microsoft.XMLHTTP");
	    	    }catch (e){
	    	          alert("Your browser does not support AJAX!");	    	          
	   		    }
	      }  
   		} 
	}
	
	function sendAjaxRequest(urlType , url , methodName){
		ajaxFunction();
		alert("ur" + url);
	    xmlHttp.onreadystatechange = showResult;
  		xmlHttp.open(urlType,url,true);
  		xmlHttp.send(null);
	}

    function showResult(){
    	if (xmlHttp.readyState==4){ 
			alert(xmlHttp.responseText);
		}

    }
    
    function signOut(){
		location.href = getServerURL()+"/signOut.action";
	}
    
    function isValidDate(date){ 
    
    	var RegExPattern = /^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$/;
    	
       	if ((date.match(RegExPattern)) && (date!='')) {
          return true
       	} 
     
       return false;
   }
   
   function isValidExpiry(data) {
	   if(!(data != "" && !/^\d{1,2}\/\d{4}$/.test(data))) {
		 return true
	   }
	   return false
   }
   
   function isValidity(data) {
	   if(/^\d{1,2}\/\d{4}$/.test(data)) {
		 return true
	   }
	   return false
   }
   
   function isValidNumber(data){
	   return /^-?\d+$/.test(data);
   }
   
   function isValidAlaphabet(data) {
		return /^[a-zA-Z]*$/.test(data); 
   }
   function homeAction(){
	   //location.href="home.action?date="+new Date();
	   location.href="sessionExp.action";
   }
   
   function consumerProfileAction(){
	   location.href="profile.action?date="+new Date();
   }
   function profile(){
    alert("Successfully uploaded the photo");
    location.href="docprofile.action?date="+new Date(); 
   }
   
   function consumerMedicareAction(){
	   
	   location.href="medicare.action?date="+new Date(); 
   }
   
   function consumerInsuranceAction(){
	   location.href="insurance.action?date="+new Date();
   }
   function searchDoctorAction(){
		location.href=getServerURL()+"/showSearchDoctors.action?"+new Date();
	}
	function showConsumerDairy(){
		location.href=getServerURL()+"/showConsumerDairy.action?"+new Date();
	}
    function providerProfileAction(){
        location.href="docprofile.action?date="+new Date(); 
    }    
	function providerNetworkAction(){
	      location.href="network.action?date="+new Date(); 
	}
	function getErrorTable(error){
		var errorTable="<table cellpadding=\"5\" width=\"100%\" cellspacing=\"8px\" class=\"warningMacro\" border=\"0\" align=\"left\">";
		
			errorTable += "<colgroup>";
			errorTable += "<col width=\"24\">";
			errorTable += "<col>";
			errorTable += "</colgroup>";
			errorTable += "<tbody>";
			errorTable += "<tr>";
			errorTable += "<td valign=\"top\">";
			errorTable += "<img src=\"http://cwiki.apache.org/confluence/images/icons/delete_16.png\" alt=\"\" width=\"16\" align=\"absmiddle\" border=\"0\" height=\"16\">";
			errorTable += "</td>";
			errorTable += "<td>";
			errorTable += error
			errorTable += "</td>";
			errorTable += "</tr>";
			errorTable += "</tbody>";
			errorTable += "</table>";
			
		    return errorTable;	
		}
	
	

