function frmemailvalidator(theForm)
{
  // E-mail Validator Code
  if ((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.txtVisitor_Name.value))) 
  {
		//  do nothing
  }
  else
  {
	alert("Invalid E-mail Address! Please re-enter.")
	theForm.txtEmail.focus();
	return (false);
  }
   return (true);
}


function fnOpenWindow(theURL)
{
 var winName = "Character";
 var features = "toolbar=0,left=50,top=50,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=400,height=400"
 window.open(theURL,winName,features);
}
function fnOpenWindow1(theURL)
{
 var winName = "Character";
 var features = "toolbar=0,left=10,top=10,location=0,status=0,menubar=1,scrollbars=1,resizable=0,width=450,height=450"
 window.open(theURL,winName,features);
}

function fnOpenWindow2(theURL)
{
 var winName = "Character";
 var features = "toolbar=0,left=10,top=10,location=0,status=0,menubar=1,scrollbars=1,resizable=0,width=700,height=550"
 window.open(theURL,winName,features);
}

function fnOpenWindowForPDF(theURL)
{
 var winName = "Character";
 window.open(theURL,winName);
}
function fnclose()
{
	window.close()
}

var xmlHttp;
var msie = (window.ActiveXObject) ? true : false;
var moz = (document.implementation && document.implementation.createDocument) ? true : false;
function ajax_server_check(){
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		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;
			}
		}
	}
}
function fnxmlHttp(method,url,passData){
	xmlHttp.open(method,url,true);
	if((method == "post")||(method == "POST")){
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
		xmlHttp.send(passData);
	}else{
		xmlHttp.send(null);
	}
}
function show_progressbar(id) {
	document.getElementById(id).innerHTML = '<table width="100%" height="100%"><tr><td align="center" VALIGN="MIDDLE" class="NormalBR"><img src="images/progress.gif" border="0" alt="Loading, please wait..." /></td></tr></table>';
}
function fnChange_Speciality(){
	var speciality_ID 	= document.getElementById("SpecialtyID").value;
	if(document.getElementById("SpecialtyID").value == "other"){
		document.getElementById("div_SpecialtyID_other").style.display = "block";
		document.getElementById("SubspecialtyID").options.length = 0;
		document.getElementById("div_SubSpecialtyID_other").style.display = "block";
		document.getElementById("div_SubSpecialtyID_1").style.display = "none";
	}else{
		document.getElementById("div_SpecialtyID_other").style.display = "none";
		document.getElementById("div_SubSpecialtyID_other").style.display = "none";
		document.getElementById("div_SubSpecialtyID_1").style.display = "block";
		show_progressbar("div_SubspecialtyID");
		ajax_server_check();
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
				document.getElementById("div_SubspecialtyID").innerHTML = xmlHttp.responseText;
			}
		}
		var url;
		url = "Ajax_function_return_Value.asp?speciality=1&speciality_ID="+speciality_ID;
		fnxmlHttp("GET",url,'');
	}
}

function fnchange_schoolName(){
	for(var i = 0; i <  document.frmNewUser.elements["MedCountry"].length; i++){
		if(document.frmNewUser.elements["MedCountry"][i].checked ==true)	
			req_Countery = document.frmNewUser.elements["MedCountry"][i].value;
	}
	show_progressbar("div_school_name");
	ajax_server_check();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("div_school_name").innerHTML = xmlHttp.responseText;
		}
	}
	var url;
	url = "Ajax_function_return_Value.asp?Countery_change=1&Countery="+req_Countery;
	fnxmlHttp("GET",url,'');
}
function fncheck_next(){
	var chk,passData="&chk[]=";
	ajax_server_check();
	total_no_of_chk = document.getElementById("total_cnt").value;
	for(i=1;i<=total_no_of_chk;i++){
		if(document.getElementById("chk_Name"+i)){
			req_value = document.getElementById("chk_Name"+i).value;
			if (document.getElementById("chk_Name"+i).checked == true){
				req_status = 1;
			}else{
				req_status = 0;
			}
			passData += "&chk[]=" + req_value + "-" + req_status;
		}
	}	
	var url;
	url = "Ajax_function_return_Value.asp?chk_User_List=1";
	fnxmlHttp("POST",url,passData);
}

function fncheck_next_signup(){
	var chk,passData="&chk[]=";
	ajax_server_check();
	total_no_of_chk = document.getElementById("total_cnt").value;
	for(i=1;i<=total_no_of_chk;i++){
		if(document.getElementById("chk_Name"+i)){
			req_value = document.getElementById("chk_Name"+i).value;
			if (document.getElementById("chk_Name"+i).checked == true){
				req_status = 1;
			}else{
				req_status = 0;
			}
			passData += "&chk[]=" + req_value + "-" + req_status;
		}
	}	
	var url;
	url = "Ajax_function_return_Value.asp?chk_User_List_Signup=1";
	fnxmlHttp("POST",url,passData);
}
function fncheck_next_signup_Approve(){
	var chk,passData="&chk[]=";
	ajax_server_check();
	total_no_of_chk = document.getElementById("total_cnt").value;
	for(i=1;i<=total_no_of_chk;i++){
		if(document.getElementById("chk_Name"+i)){
			req_value = document.getElementById("chk_Name"+i).value;
			if (document.getElementById("chk_Name"+i).checked == true){
				req_status = 1;
			}else{
				req_status = 0;
			}
			passData += "&chk[]=" + req_value + "-" + req_status;
		}
	}	
	var url;
	url = "Ajax_function_return_Value.asp?chk_User_List_Signup_approve=1";
	fnxmlHttp("POST",url,passData);
}


function fnSearch_Member(){
	req_FName = document.getElementById("txtSearch_Fname").value;
	req_LName = document.getElementById("txtSearch_Lname").value;
	show_progressbar("div_search_member");
	ajax_server_check();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("div_search_member").innerHTML = xmlHttp.responseText;
		}
	}
	var url;
	url = "server.asp?member_list=1&FName="+req_FName+"&LName="+req_LName;
	fnxmlHttp("GET",url,'');
}
function fnSearch_Non_CME_Member(reqEvent_ID){
	req_FName = document.getElementById("txtSearch_Member_Fname").value;
	req_LName = document.getElementById("txtSearch_Member_Lname").value;
	show_progressbar("div_Member_Search");
	ajax_server_check();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("div_Member_Search").innerHTML = xmlHttp.responseText;
		}
	}
	var url;
	url = "server.asp?member_Search_list=1&FName="+req_FName+"&LName="+req_LName+"&Event_ID="+reqEvent_ID;
	fnxmlHttp("GET",url,'');
}

function fnSearch_Guest(){
	req_FName = document.getElementById("txtSearch_GFname").value;
	req_LName = document.getElementById("txtSearch_GLname").value;
	req_Phno  = document.getElementById("txtSearch_GPhno").value;
	
	show_progressbar("div_guest_list");
	ajax_server_check();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("div_guest_list").innerHTML = xmlHttp.responseText;
		}
	}
	var url;
	url = "server.asp?guest_list=1&FName="+req_FName+"&LName="+req_LName+"&Phno="+req_Phno;
	fnxmlHttp("GET",url,'');
}