// JavaScript Document
// JavaScript Documentvar xmlHttp
// 
/*
		01. Menu_Link(xurl,str,xpage)
		02. showMailList(xurl,maillisttype)
		03. change_user_status1(xurl,cat,str,usertype)
		04. Update_Values(xurl,cat,str,usertype)		
		05. CheckUser(xurl,str)
		06. album_page(xurl,str,xpage)
		07.	photo_page(xurl,str,xalbum,pageno)	
		08. Big_Image_Window(aid,pid)
		09. Attendace_rows(xurl,str)
*/

// 01
	function Menu_Link(xurl,str,xpage)
	{ 
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
	
		var url=xurl;
		url=url+"?menu="+str;
		url=url+"&page="+xpage;
		url=url+"&sid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=PageDisplay
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
	function PageDisplay() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("div_display_page").innerHTML=xmlHttp.responseText 
		} 
	} 


// 02

	function showMailList(xurl,maillisttype)
	{ 
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
	
		var url=xurl;
		url=url+"?mail_list_type="+maillisttype
		url=url+"&sid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=mailListChanged 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
	function mailListChanged () 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("div_maillistby").innerHTML=xmlHttp.responseText 
		} 
	}
	
// 03
function change_user_status1(xurl,cat,str,usertype)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?userid="+cat +"&status="+str+"&user_type="+usertype
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=change_user_statusChanged1

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function change_user_statusChanged1() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("changeduserStatus1").innerHTML=xmlHttp.responseText 
	} 
} 



// 04
function Update_Values(xurl,cat,str,usertype)
{ 
	var str1;
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	if(str=="APPROVED")
	{
	str1="approve";
	}
	if(str=="ACTIVE")
	{
		str1="active";
	}
	if(str=="INACTIVE")
	{
		str1="inactive";
	}
	
	if(str=="DENIED")
	{
	str1="deny";
	}
	if(str=="BOOKED")
	{
	str1="Booked";
	}
	if(str=="PENDING")
	{
	str1="pending";
	}
	if(str=="COMPLETED")
	{
	str1="Completed";
	}

	if(usertype=="ARCHIVE_STATUS")
	{
		
		if(str=="YES")
		{
			str1="move in archive news list";
		}
		if(str=="NO")
		{
			str1="move in latest news list";
		}
	}
	//alert(cat);
	if(confirm("Do you really want to "+str1.toLowerCase()+"?"))
	{
	var url=xurl;
	url=url+"?id="+cat +"&value="+str+"&page_type="+usertype
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=UpdateValuesFunction

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	if(usertype=="ARCHIVE_STATUS")
	{
		window.location.href='index.php?menu=cms&action=latest_news';
		 
	}
	
	alert("Information updated");
	
	
	}
}

function UpdateValuesFunction() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("UpdateValuesDiv").innerHTML=xmlHttp.responseText 
	} 
} 

// 05
 function CheckUser(xurl,str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?value="+str
	url=url+"&sid="+Math.random()
	if(str=="")
	{
		alert("Invalid user name.");
		return false;
	}
	else
	{
	//alert(url);
	xmlHttp.onreadystatechange=CheckUserFunction

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

function CheckUserFunction() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("CheckUserDiv").innerHTML=xmlHttp.responseText 
	} 
} 



// 06
	function album_page(xurl,str,xpage)
	{ 
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
	
		var url=xurl;
		url=url+"?menu="+str;
		url=url+"&PAGE_NO="+xpage;
		url=url+"&sid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=AlbumPageDisplay
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
	function AlbumPageDisplay() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("div_display_page").innerHTML=xmlHttp.responseText 
		} 
	} 

// 07
	function photo_page(xurl,str,xalbum,pageno)
	{ 
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url=xurl;
		url=url+"?menu="+str;
		url=url+"&album_id="+xalbum;
		url=url+"&PAGE_NO="+pageno;
		url=url+"&sid="+Math.random()
		//alert(url);
		xmlHttp.onreadystatechange=AlbumPageDisplay
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	
	function AlbumPageDisplay() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("div_display_page").innerHTML=xmlHttp.responseText 
		} 
	} 
// 08
	function Big_Image_Window(aid,pid)
	{
		var new_win; 
		winname="big_impage.php?album_id="+aid+"&id="+pid;
 		new_win=window.open(winname,'BIGIMAGE',"width=900,height=900,toolbar=0,resizable=1,scrollbars=1");
	}


// 09
 
function Attendace_rows(xurl,str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?value="+str
	url=url+"&sid="+Math.random()
	if(str=="")
	{
		alert("Invalid value.");
		return false;
	}
	else
	{
	//alert(url);
	xmlHttp.onreadystatechange=showAttendance

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

function showAttendance() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("attendaceDiv").innerHTML=xmlHttp.responseText 
	} 
} 
//---//
function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
 

function UpdatePaymentStauts(xurl,cat,str,usertype)
{ 
	var str1;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url=xurl;
	url=url+"?id="+cat +"&value="+str+"&page_type="+usertype
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=UpdatePayStatusFunction

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	alert("Update Information");

}

function UpdatePayStatusFunction() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("UpdatePaymentStautsDiv").innerHTML=xmlHttp.responseText 
	} 
} 


// 04
function Show_Values(xurl,cat,str,usertype)
{ 
	var str1;
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	

	var url=xurl;
	url=url+"?id="+cat +"&value="+str+"&page_type="+usertype
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=ShowValuesFunction

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function ShowValuesFunction() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("ShowValuesDiv").innerHTML=xmlHttp.responseText 
	} 
} 


// 04
function SHOW_OPTIONS(xurl,str,opttype,xid)
{ 
	var str1;
	//alert("show_options");
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	var url=xurl;
	url=url+"?value="+str+"&option_type="+opttype+"&xid="+xid
	url=url+"&sid="+Math.random()
	//alert(opttype);
		if(opttype=="EXECUTIVE_DIRECTORSHIP")
		{
			//alert("hello");
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_1
		}
		else if(opttype=="EXECUTIVE_DISQUALIFY")
		{
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_2
		}
		else if(opttype=="EXECUTIVE_LITIGATION")
		{
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_3
		}
		else if(opttype=="EXECUTIVE_BANKRUPT")
		{
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_4
		}
		else if(opttype=="EXECUTIVE_RESTRICTIVE")
		{
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_5
		}
		else if(opttype=="MOST_RECENT_WITH_EMPLOYED")
		{
			//alert("6");
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_6
		}

		else if(opttype=="CANDIDATE_CITIZEN")
		{
			xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION
		}
	
	

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function SHOW_OPTIONS_1(xurl,str,opttype,xid)
{ 
	var str1;
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	var url=xurl;
	url=url+"?value="+str+"&option_type="+opttype+"&xid="+xid
	url=url+"&sid="+Math.random()
	//alert(opttype);
	xmlHttp.onreadystatechange=SHOW_OPTION_FUNCTION_1
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function SHOW_OPTION_FUNCTION() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_visa").innerHTML=xmlHttp.responseText 
	} 
} 



function SHOW_OPTION_FUNCTION_1() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_1").innerHTML=xmlHttp.responseText 
	} 
} 


function SHOW_OPTION_FUNCTION_2() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_2").innerHTML=xmlHttp.responseText 
	} 
} 


function SHOW_OPTION_FUNCTION_3() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_3").innerHTML=xmlHttp.responseText 
	} 
} 


function SHOW_OPTION_FUNCTION_4() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_4").innerHTML=xmlHttp.responseText 
	} 
} 



function SHOW_OPTION_FUNCTION_5() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option_5").innerHTML=xmlHttp.responseText 
	} 
} 

function SHOW_OPTION_FUNCTION_6() 
{ 

//alert("6");
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("show_option").innerHTML=xmlHttp.responseText 
	} 
} 


 	function submit_form2(xpath)
	{
		//document.frm_main.action=xpath;
		//document.frm_main.submit();
		window.location.href=xpath;
	}


function HideState1()
{
	if(document.frm_main.state_of_birth.value=="OTH"  )
	{
		document.getElementById("hidshow1").style.visibility="visible";
	}
	else
	{
		document.getElementById("hidshow1").style.visibility="hidden";
	}
}

function HideState2()
{
	if(document.frm_main.state_name_license.value=="OTH"  )
	{
		document.getElementById("hidshow2").style.visibility="visible";
	}
	else
	{
		document.getElementById("hidshow2").style.visibility="hidden";
	}
}
 
function HideState()
{
	if(document.frm_main.state_name.value=="OTH"  )
	{
		document.getElementById("hidshow").style.visibility="visible";
	}
	else
	{
		document.getElementById("hidshow").style.visibility="hidden";
	}
}



//Function HideState
var ControlToSet;
var theForm = document.theForm;
var CalWidth=180;
var StartYear = "";
var EndYear = "";
var FormatAs;
var NN4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var NN6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var TOP;
var LEFT;

if(NN4)document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = LogPosition;

function LogPosition(evt){

    if (NN4||NN6){
    LEFT=evt.screenX-50;
    TOP=evt.screenY-10;
    }
    else{
    LEFT=event.screenX-160;
    TOP=event.screenY-10;
    }

}

function ShowCalendar(CONTROL,START_YEAR,END_YEAR,FORMAT){

ControlToSet = eval(CONTROL);
StartYear = START_YEAR;
EndYear = END_YEAR;
FormatAs = FORMAT;

var strFeatures = "width=" + CalWidth + ",height=140" + ",left=" + LEFT + ",top=" + TOP;
var CalWindow = window.open("HTMLCalendar.htm","Calendar", strFeatures)
CalWindow.focus();
} //End Function

function SetDate(DATE){
if(ControlToSet){
ControlToSet.value = DATE; 
}
ControlToSet = null;
StartYear = null;
EndYear = null;
FormatAs = null;
}

///-----------------------------------------------------------------------------------
	function Subject_Claim(xurl,str,opttype,xid)
	{ 
	
	  //alert("claim"+xid);
		var str1;
		  
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url=xurl;
		url=url+"?value="+str+"&option_type="+opttype+"&xid="+xid
		url=url+"&sid="+Math.random()
		if(opttype=="CLAIM0")
		{
			xmlHttp.onreadystatechange=Subject_Claim_Support
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}else if(opttype=="CLAIM1")
		{
			xmlHttp.onreadystatechange=Subject_Claim_Support1
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="CLAIM2")
		{
			//alert(opttype);
			xmlHttp.onreadystatechange=Subject_Claim_Support2
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="CLAIM3")
		{
			xmlHttp.onreadystatechange=Subject_Claim_Support3
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="CLAIM4")
		{
			xmlHttp.onreadystatechange=Subject_Claim_Support4
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="CLAIM5")
		{
			xmlHttp.onreadystatechange=Subject_Claim_Support5
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		
	}
	
	function Subject_Claim_Support() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam0").innerHTML=xmlHttp.responseText 
		} 
	} 
	
	function Subject_Claim_Support1() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam1").innerHTML=xmlHttp.responseText 
		} 
	} 	
	
	function Subject_Claim_Support2() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam2").innerHTML=xmlHttp.responseText 
		} 
	} 		
	
	function Subject_Claim_Support3() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam3").innerHTML=xmlHttp.responseText 
		} 
	} 	
	
	function Subject_Claim_Support4() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam4").innerHTML=xmlHttp.responseText 
		} 
	} 	
	function Subject_Claim_Support5() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subjectcliam5").innerHTML=xmlHttp.responseText 
		} 
	} 		
	
	///-----------------------------------------------------------------------------------
	function Subject_Disciplinary(xurl,str,opttype,xid)
	{ 
		var str1;
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		//alert(xurl);
		var url=xurl;
		url=url+"?value="+str+"&option_type="+opttype+"&xid="+xid
		url=url+"&sid="+Math.random()
		if(opttype=="DISCIPLINARY0")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}else if(opttype=="DISCIPLINARY1")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support1
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="DISCIPLINARY2")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support2
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="DISCIPLINARY3")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support3
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="DISCIPLINARY4")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support4
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		else if(opttype=="DISCIPLINARY5")
		{
			xmlHttp.onreadystatechange=Subject_Disciplinary_Support5
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
		}
		
	}
	
	function Subject_Disciplinary_Support() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary0").innerHTML=xmlHttp.responseText 
		} 
	} 
	
	function Subject_Disciplinary_Support1() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary1").innerHTML=xmlHttp.responseText 
		} 
	} 	
	
	function Subject_Disciplinary_Support2() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary2").innerHTML=xmlHttp.responseText 
		} 
	} 		
	
	function Subject_Disciplinary_Support3() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary3").innerHTML=xmlHttp.responseText 
		} 
	} 	
	
	function Subject_Disciplinary_Support4() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary4").innerHTML=xmlHttp.responseText 
		} 
	} 	
	function Subject_Disciplinary_Support5() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			
			document.getElementById("subject_disciplinary5").innerHTML=xmlHttp.responseText 
		} 
	} 		
