
function DoClear(e)
{
	if(e.value=="Describe Role and Position..." || e.value=="Name,Contact Info ...")
		e.value="";
} 

//======== Work Experience handler============
function DoWorkExperienceDetails(myid){
	var param="list=D|"+myid;
	getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperience.aspx');
}
function DoEngagementsDetails(myid){
	var param="list=D|"+myid;
	getResponseWithScript('EngagementDetails',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/EngagementDetails.aspx');
}

function GetEditWorkExperience(id){
	var param="list=GL|"+id;
	getResponseWithScript('EditWorkExperience',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperienceList.aspx');

}
function GetEditEngagements(id){
	var param="list=GL|"+id;
	getResponseWithScript('EditWorkExperience',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/EngagementsList.aspx');

}

function CheckWorkExperience(){
	if(checkStringAlfaNumericWithExeptions(document.getElementById("CompanyName"),"COMPANY NAME","@ -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("CityTown"),"CITY NAME"," -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("JobTitle"),"JOB TITLE","@ -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("JobResponsibilities"),"JOB RESPONSIBILITIES",": -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("JobReferences"),"JOB REFERENCES",": -.,", false)
		)
		{
			return true
		}
		return false
}


function GetWorkExperience(){
		var s=GetChecked("NoExperience")+"|";
		s+=GetValue("CoachingExperience_value")+"|";
		s+=GetValue("CompanyName")+"|";
		s+=GetValue("CountryId_value")+"|";
		s+=GetValue("StateId_value")+"|";
		s+=GetValue("CityTown")+"|";		
		s+=GetValue("JobTitle")+"|";		
		s+=GetValue("JobResponsibilities")+"|";
		s+=GetValue("JobReferences")+"|";
		s+=GetValue("IndustryId_value")+"|";
		s+=GetValue("StartDate")+"|";		
		s+=GetValue("EndDate")+"|";
		s+=GetValue("Customfield1")+"|";			
		s+=GetValue("Customfield2")+"|";
		s+=GetValue("Customfield3")+"|";
		return (s);
}
//=======Engagements=============
function CheckEngagements(){
	if(checkStringAlfaNumericWithExeptions(document.getElementById("CompanyName"),"COMPANY NAME","@ -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("EngagementObjectives"),"ENGAGEMENT OBJECTIVES","@ -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("EngagementOutcome"),"ENGAGEMENT OUTCOME","@ -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("EngagementReference"),"ENGAGEMENT REFERENCES","@ -.,", false)
		)
		{
			return true
		}
		return false
}


function GetEngagements(){
		var s=GetValue("CoachingExperience_value")+"|";
		s+=GetValue("IndustryId_value")+"|";
		s+=GetValue("CountryId_value")+"|";
		s+=GetValue("CompanyName")+"|";
		s+=GetValue("EngagementObjectives")+"|";
		s+=GetValue("EngagementOutcome")+"|";
		s+=GetValue("EngagementReference")+"|";			
		s+=GetValue("StartDate")+"|";		
		s+=GetValue("EndDate")+"|";		
		return (s);
}
function SaveWorkExperience(){
	if(CheckWorkExperience())
	{
		var param="list=S|"+GetWorkExperience();
		getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperience.aspx');
	}
}
function NewWorkExperience(){
	
		var param="list=new|";
		getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperience.aspx');
	
}
function DeleteWorkExperience(weid)
{
	
		if(confirm("Are you sure?!")){
			var param="list=delete|"+weid;
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperience.aspx');
		}
	
}

function SaveEngagements(){
	if(CheckEngagements())
	{
		var param="list=S|"+GetEngagements();
		getResponseWithScript('EngagementDetails',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/EngagementDetails.aspx');
	}
}


function SaveExperience(i){
	if(CheckExperience())
	{
		var param="list=S|"+GetValue("CoachingExperience_value");
		//alert(param);
		getResponseWithScript('Empty',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/engagements.aspx');//
		DoFlow(i);
	}
}

function CheckExperience(){
	return CheckDDBox("CoachingExperience_value","Select COACHING EXPERIENCE, please");	
}

function CheckDDBox(name,warning){
	if( GetValue(name)=="0")
	{
		alert(warning);
		return false;
	}else
		return true;
}
















//======== GeneralInfo handler============

function CheckGeneralInfo(){
	if(checkStringAlfaNumericWithExeptions(document.getElementById("FirstName"),"FIRST NAME"," -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("MiddleName"),"MIDDLE NAME"," -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("LastName"),"LAST NAME"," -.,", false)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("UserNam"),"USER NAME","@ -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("Passwor"),"PASSWORD","@ -.,", true)
		&& checkEmail(document.getElementById("Email"),true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("Phone"),"PHONE","#() -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("CellPhone"),"CELULAR PHONE","#() -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("Fax"),"FAX","#() -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("CompanyName"),"COMPANY"," -.,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("Address1"),"ADDRESS 1"," .#,", true)
		&& checkStringAlfaNumericWithExeptions(document.getElementById("Address2"),"ADDRESS 2", " .#,",true)		
		&& checkStringAlfaNumericWithExeptions(document.getElementById("CityTown"),"CITY","@ -.,", true)
		&& checkString(document.getElementById("ZIP"),"ZIP", true)		
		)
		{
			return true
		}
		return false
}


function GetGeneralInfo(){
		var s=GetValue("FirstName")+"|";
		s+=GetValue("MiddleName")+"|";
		s+=GetValue("LastName")+"|";
		s+=GetValue("UserNam")+"|";
		s+=GetValue("Passwor")+"|";
		s+=GetValue("Email")+"|";		
		s+=GetValue("Phone")+"|";		
		s+=GetValue("CellPhone")+"|";
		s+=GetValue("Fax")+"|";
		s+=GetValue("CompanyName")+"|";
		s+=GetValue("IndustryId_value")+"|";
		
		s+=GetValue("CountryId_value")+"|";
		s+=GetValue("StateId_value")+"|";			
		s+=GetValue("Address1")+"|";
		s+=GetValue("Address2")+"|";
		s+=GetValue("CityTown")+"|";		
		s+=GetValue("ZIP")+"|";
		s+=GetValue("AgeId_value")+"|";	
		s+=GetValue("GenderId_value")+"|";	
		return (s);

}
function SaveGeneralInfo(i){
	if(CheckGeneralInfo())
	{
		var param="list=S|"+GetGeneralInfo();
		getResponseWithScript('Empty',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/GeneralInfo.aspx');//Empty,JobSearchForm
		
	}

}
//================ General Info Form End ==========================

//================ Certification Form  ==========================

function GetCertification(){
		var s=GetChecked("MBTI")+"|";
		s+=GetChecked("Birkman")+"|";
		s+=GetChecked("DISC")+"|";
		
		s+=GetChecked("AIF")+"|";
		s+=GetChecked("ARP")+"|";
		s+=GetChecked("RRP")+"|";	
			
		s+=GetChecked("CB11")+"|";		
		s+=GetChecked("CB12")+"|";
		s+=GetChecked("CB13")+"|";
		
		s+=GetValue("Degree1_value")+"|";
		s+=GetValue("Degree2_value")+"|";
		s+=GetValue("Degree3_value")+"|";
		s+=GetValue("Degree4_value")+"|";		
			
		s+=GetValue("Discipline1_value")+"|";
		s+=GetValue("Discipline2_value")+"|";
		s+=GetValue("Discipline3_value")+"|";		
		s+=GetValue("Discipline4_value")+"|";
		
		
		if(document.getElementById("ACC").checked)
			s+="1|";
		if(document.getElementById("PCC").checked)
			s+="2|";	
		if(document.getElementById("MCC").checked)
			s+="3|";
		if(document.getElementById("OtherBody").checked)
			s+="4|";
		if(document.getElementById("None2").checked)
			s+="5|";
				
		s+=GetChecked("CB21")+"|";		
		s+=GetChecked("CB22")+"|";
		s+=GetChecked("CB23")+"|";
		
		
		s+=GetChecked("CB31")+"|";		
		s+=GetChecked("CB32")+"|";
		s+=GetChecked("CB33")+"|";
		
		return (s);

}

function SaveCertification(i)
{
		var param="list=S|"+GetCertification();
		getResponseWithScript('Empty',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Certification.aspx');	
		DoFlow(i);
}
//================ Certification End ==========================













function GetChecked(oName){
			if(document.getElementById(oName).checked)
				return "1";
			else
				return "0";
		}


function GetValue(id){
	if(document.getElementById(id)!=null && document.getElementById(id).toString()!="undefined")
		return document.getElementById(id).value;
	else
		return "";	
}

function DoAppLogin(){
			var un = GetValue("UserName");
			var pwd =GetValue("Password")
			if(un!="" && pwd!=""){
				var param = 'list=L|'+un+"|"+pwd+"|"+CompanyId+"|";
				//alert(param)
				getResponseWithScript('Empty',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/login.aspx');
			}else
				alert("Username and Password are required fields!");
		}
function DoAppLogOut(){
			var param = 'list=out|';
			getResponseWithScript('Empty',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/login.aspx');
		}		
function DoApplicantLogin(){
	var s="";
	s+=GetValue("UserName")+",";
	s+=GetValue("Password")+",";
	var param="list=L|"+s;
	getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/login.aspx');
};

function DoApply(){
	var param="list=A|";
	getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/FlowSwitch.aspx');
}

function DoEditProfile(){
	var param="list=EP|";
	getResponseWithScript('myContent',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/EditProfile.aspx');
}
function DoFlow(i){
	var param="list=N|"
	switch(i){
		case 0:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/GeneralInfo.aspx');
			break;
		case 1:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/GeneralInfo.aspx');
			break;
		case 2:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/WorkExperience.aspx');
			break;	
		case 3:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;	
		case 4:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;	
		case 5:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;	
		case 6:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;	
		case 7:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;	
		case 8:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Skills.aspx');
			break;				
		case 13:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Resume.aspx');
			break;		
		case 9:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Certification.aspx');
			break;
		case 10:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Certification.aspx');
			break;
		case 11:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Certification.aspx');
			break;
		case 12:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/engagements.aspx');
			break;
		case 14:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Confirmation.aspx');
			break;		
		case 15:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/Confirmation.aspx');
			break;		
		case 111:
			getResponseWithScript('JobSearchForm',param,'LoadingPanel','/AdminModulesCompany/jo/Forms/login.aspx');
			break;					
	}
	//alert(i)
}
function GetParams()
	{
		var s = "J|";
		s+=document.getElementById("ContactStateList_value").value+"|";
		s+=document.getElementById("GroupsList_value").value+"|";
		s+=document.getElementById("SecurityLevel_value").value+"|";
		s+=document.getElementById("Keyword").value+"|";
		s+=document.getElementById("CompanyList3_value").value+"|";
		return s;    
	};
//======DropDowns Changed event hendler =================
		function DoSelectedChanged(UniqueId)
		{
			
			switch(UniqueId)
			{
				//==== Users=======
				case "CompanyList3":
					var param = "list="+GetParams();
					getResponseWithScript('UserGrid',param,'LoadingPanel','/AdminModulesCompany/user/grid.aspx');
				break;
				case "ContactStateList":
				//alert('hihi');
					var param = "list="+GetParams();
					getResponseWithScript('UserGrid',param,'LoadingPanel','/AdminModulesCompany/user/grid.aspx');
				break;
				case "GroupsList":
					var param = "list="+GetParams();
					getResponseWithScript('UserGrid',param,'LoadingPanel','/AdminModulesCompany/user/grid.aspx');
				break;
				case "SecurityLevel":
					var param = "list="+GetParams();
					getResponseWithScript('UserGrid',param,'LoadingPanel','/AdminModulesCompany/user/grid.aspx');
				break;
				case "CountryId":
					var ddb = document.getElementById("CountryId_value");
					getResponseWithScript('State','cid='+ddb.value+'|','LoadingPanel2','/AdminModulesCompany/user/StateDDB.aspx')
				break;		
				//==== Default=======
				case "Company":
					var ddb = document.getElementById(UniqueId+"_value");
					getResponseWithScript('Empty','ccid='+ddb.value,'LoadingPanel','Master.aspx')		
				break;
				case "SkinId":
					var ddb = document.getElementById("SkinId_value");
					getResponseWithScript('Empty','SkinId='+ddb.value,'LoadingPanel','Master.aspx')		
				break;	
				//====== Docs=======
				case "MenuGroup":
					var ddb = document.getElementById(UniqueId+"_value");
					getResponseWithScript('menuSubGroup','list='+ddb.value,'LoadingPanel2','doc/menusubgroup.aspx')		
				break;	
				case "DocumentActive":
					DoGoDoc();		
				break;	
				case "MenuSubGroup2":
					DoGoDoc();		
				break;	
				case "DocumentType":
					DoGoDoc();		
				break;	
				
				
				
											
			}		
		};











