/*function getHTTPObject() {
  var xmlhttp;
 
  if(window.XMLHttpRequest){
    xmlhttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject){
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (!xmlhttp){
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    
}
  return xmlhttp;

  
}
var http = getHTTPObject();*/ // We create the HTTP Object
function getHTTPObject(){
	
		var xmlHttp = null;
		if (window.XMLHttpRequest){
          // If IE7, Mozilla, Safari, etc: Use native object
           xmlHttp = new XMLHttpRequest();
		   if (xmlHttp.overrideMimeType) {
                xmlHttp.overrideMimeType('text/html');
                // See note below about this line
            }
		}
		else
		{
			if (window.ActiveXObject){
          // ...otherwise, use the ActiveX control for IE5.x and IE6
          // xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			 if (xmlHttp.overrideMimeType) {
                xmlHttp.overrideMimeType('text/html');
                // See note below about this line
            }
		  //alert("Created by 2");
          }
		}
		return xmlHttp;
}
var http = getHTTPObject(); 

/*
	Funtion Name=requestInfo 
	Param = url >> Url to call : id = Passing div id for multiple use ~ as a seprator for eg. div1~div2 :
	redirectPage >> if you like to redirect to other page once the event success then 
	the response text = 1 and the redirectPage not left empty
*/

function requestInfo(url,id,redirectPage) {      
		var temp=new Array();
			http.open("GET", url, true);
			http.onreadystatechange = function() {
				
				                            if (http.readyState == 4) {
				                                 if(http.status==200) {
			  		                                   var results=http.responseText;
					                                   if(redirectPage=="" || results!="1") {
						
						                                     var temp=id.split("~"); // To display on multiple div 
						                                     //alert(temp.length);
						                                     var r=results.split("~"); // To display multiple data into the div 
						                                     //alert(temp.length);
						                                     if(temp.length>1) {
							                                     for(i=0;i<temp.length;i++) {	
								                                  //alert(temp[i]);
								                                     document.getElementById(temp[i]).innerHTML=r[i];
							                                      }
						                                     }
															 else {
																   
																   document.getElementById(id).innerHTML = results;
 						                                     }	
					                                    }
														else {
						                                     //alert(results);
						                                     window.location.href=redirectPage;			
					                                     }
				                                  } 
  				                              }
			                            };
			 http.send(null);
}

 
 
 function empty_Validation(fieldList,displayvalue,displayid,type) {
		
		var res   = "Please select or Enter ";
		
		var field = new Array();
		    field = fieldList.split("~");
			
	    var display = new Array();
		    display = displayvalue.split("~");
			
		var msgid  = new Array();
		    msgid  = displayid.split("~");
			
	   
			
		var counter=0;
		for(i=0;i<field.length;i++) {
			if(document.getElementById(field[i]).value=="") {
				document.getElementById(field[i]).style.border = '1px solid orange';
 				document.getElementById(msgid[i]).innerHTML =  '<font color="red" size="2" >'+display[i]+'</font>';
	   
				counter++;
				res+= field[i]+",";
			} else {
				document.getElementById(field[i]).style.border = '1px solid black';	
				document.getElementById(msgid[i]).innerHTML = '';
 			}
		}
		 if (type=='payment') {
			           
			      if(document.getElementById("txt_adlt").value!=''){	
			
		                 if(CheckNumeric(document.getElementById("txt_adlt").value)==false){
		                     document.getElementById("txt_adlt").style.border = '1px solid orange';
 			                    counter++;
		                  }
						  else{
							  if( (document.getElementById("txt_adlt").value<2) || (document.getElementById("txt_adlt").value>3)){
								  document.getElementById("txt_adlt").value = 2;
							  }
							  else{ 
 							    document.getElementById("txt_adlt").style.border = '1px solid black';	
								/* if(){
									 
								 }*/
								 
							  }
						 }
		          }
				  if(document.getElementById("txt_chld").value!=''){	
			
		                 if(CheckNumeric(document.getElementById("txt_chld").value)==false){
		                     document.getElementById("txt_chld").style.border = '1px solid orange';
 			                 counter++;
		                  }
						  else{
 							   document.getElementById("txt_chld").style.border = '1px solid black';	
						 }
		          }
 		          if(document.getElementById("terms").checked!=true){
					    document.getElementById('ck').innerHTML ='<font color="red" size="2" >Please accept the terms and conditions</font>';
					    counter++;
 				  }
				  else{
				       document.getElementById('ck').innerHTML ='';
				  }
				  if(document.getElementById("terms2").checked!=true){
					    document.getElementById('ck2').innerHTML ='<font color="red" size="2" >Please accept the terms and conditions</font>';
					    counter++;
 				  }
				  else{
				       document.getElementById('ck2').innerHTML ='';
				  }
				    if(document.getElementById("terms3").checked!=true){
					    document.getElementById('ck3').innerHTML ='<font color="red" size="2" >Please accept the terms and conditions</font>';
					    counter++;
 				  }
				  else{
				       document.getElementById('ck3').innerHTML ='';
				  }
 			      var emailPat = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		//var emailid=document.getElementById("<%=Txtmail.ClientID %>").value;
	              if(document.getElementById("txt_email").value!=''){
		                      
		                     var matchArray = document.getElementById("txt_email").value.match(emailPat);
		                  if (matchArray == null)
		                  {
				    	        document.getElementById("txt_email").style.border = '1px solid orange';
							    document.getElementById('em').innerHTML ='<font color="red" size="2" >Invalid format,please re-type email</font>';
 			                     counter++;
                          }
				          else{
					//alert('hai');
 				                document.getElementById("txt_email").style.border = '1px solid black';	
							    document.getElementById('em').innerHTML ='';
 				          }
		            }
		 
		}
	 
 
		if(counter>0) {
				//alert("The Field mark as red could not left empty");
			//	alert(res);
			    
				return false;
				
		}  else {
			return true;
		}
		
}
	
	 
function confirmLink(theLink)
{
   
    var is_confirmed = confirm('Are you sure to delete this record?\n\nThis will permanently delete the Record!');
    if (is_confirmed) {
        theLink.href += '';
    }
    return is_confirmed;
}