// JScript File
//-----------------------------------------------------------------------------------
function checkall(cid,checkval)
{
	for(i = 0; i<document.aspnetForm.elements.length; i++)
	{
		elm = document.aspnetForm.elements[i];
		if (elm.type == 'checkbox') 
		{
		   var name=elm.name;
		   if(name.indexOf(cid)>=0)
		   {
  		      elm.checked = checkval;
		   }
		}
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDelete(code,sid)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="ViewMaster.aspx?delCode=" + code + "&catId=" + sid + "";  
   }
}

//////////////////////////////
function checkDeleteMaster(code,sid)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="MasterList.aspx?delCode=" + code + "&catId=" + sid + "";  
   }
}
//////////////////////////////
function confirmDeleteTA() {
    if (confirm("Are you sure to delete the selected travel request")) {
        return true;
    }
    else {
        return false;
    }
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteJob(code)
{	
   if(confirm("Are you sure to delete the selected Staff Requisition?"))
   {	    
       window.location.href="JobList.aspx?delCode=" + code + "";  
   }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteJobApplication(code)
{	
   if(confirm("Are you sure to delete the selected Job Application?"))
   {	    
       window.location.href="AppliedJobs.aspx?delCode=" + code + "";  
   }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteInterviewPanel(code)
{	
   if(confirm("Are you sure to delete the selected user?"))
   {	    
       window.location.href="InterviewPanel.aspx?delCode=" + code + "";  
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteJobAppLang(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="LanguageInfo.aspx?delCode=" + code + "";  
   }
}

function checkDeleteJobAppEdu(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="EducationInfo.aspx?delCode=" + code + "";  
   }
}

function checkDeleteEmergency(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="EmergencyList.aspx?delCode=" + code + "";  
   }
}

function checkDeleteJobAppExp(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="ExperienceDetails.aspx?delCode=" + code + "";  
   }
}

function checkDeleteJobAppProf(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="ProfessionalInfo.aspx?delCode=" + code + "";  
   }
}

function checkDeleteJobAppRef(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="References.aspx?delCode=" + code + "";  
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteFAQ(code)
{	
   if(confirm("Are you sure to delete the selected FAQ"))
   {	    
       window.location.href="FAQList.aspx?delCode=" + code + "";  
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteAttachment(code)
{	
   if(confirm("Are you sure to delete the Attachment"))
   {	    
       window.location.href="ApplicantAttachments.aspx?delCode=" + code + "";  
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteJobAppFriends(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="AppFriends.aspx?delCode=" + code + "";  
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteJobAppFamily(code)
{	
   if(confirm("Are you sure to delete the selected item"))
   {	    
       window.location.href="AppFamily.aspx?delCode=" + code + "";  
   }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------
 function trimStr(str)
  {
     str=(str).replace( /^\s*/, "" );
     str=(str).replace( /\s*$/, "" );
     return str;
  }
//*************************************************************************************
var numb = '0123456789. ';
var lwr = 'abcdefghijklmnopqrstuvwxyz ';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ';
var dirr = ':abcdefghijklmnopqrstuvwxyz/. ';
var sx='0123456789 *abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var bar='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
//*************************************************************************************

function isValid(parm,val) 
{
	  if (parm == "")
		 return 0;
	  for (i=0; i<parm.length; i++) 
	  {
		 if(val.indexOf(parm.charAt(i),0) == -1) 
		  {
			 return 0;
		  }	 
	  }
	  return 1;
}
 
function isNum(parm) 
  {
     return isValid(parm,numb);
  }

function isSize(parm) 
  {
     return isValid(parm,sx);
  }
  
function isBarcode(parm) 
  {
     return isValid(parm,bar);
  }

  
function isDir(parm) 
  {
     return isValid(parm,dirr);
  }
  
function isLower(parm) 
 {
    return isValid(parm,lwr);
 }
function isUpper(parm) 
 {
    return isValid(parm,upr);
 }
function isAlpha(parm) 
 {
    return isValid(parm,lwr+upr);
 }


function isAlphanum(parm) 
 {
    return isValid(parm,lwr+upr+numb);
 } 

function openPrintWindow(id,refno,title)
{
    testwindow= window.open ("PrintResumeBulk.aspx?vId=" + id + "&RefNo=" + refno + "&Title=" +title, "mywindow",
    "location=no,scrollbars=yes,menubar=0,status=no,width=700,height=600");
    testwindow.moveTo(200,200);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////
function openTravleRequestPrintWindow(id)
{
    testwindow= window.open ("PrintTravelRequest.aspx?vId=" + id, "mywindow",
    "location=no,scrollbars=yes,menubar=0,status=no,width=700,height=600");
    testwindow.moveTo(200,200);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////

function openBulkPrintWindow(id,refno,title)
{
    testwindow= window.open ("PrintResumeBulk.aspx?vId=" + id + "&RefNo=" + refno + "&Title=" +title, "mywindow",
    "location=no,scrollbars=yes,menubar=0,status=no,width=700,height=600");
    testwindow.moveTo(200,200);
}

function ccolor(d)
{
   d.style.background="url(./images/bg.gif)";
}


function ccolorback(d)
{
   d.style.background="url(./images/bg_navlist.gif)";
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function fncInputNumericValuesOnly()	
{		
    if(!(event.keyCode==45||event.keyCode==46||event.keyCode==48||event.keyCode==49||event.keyCode==50||event.keyCode==51||
    event.keyCode==52||event.keyCode==53||event.keyCode==54||event.keyCode==55||event.keyCode==56||event.keyCode==57))		
    {			
        event.returnValue=false;		
    }	
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
function checkDeleteFile(code)
{	 
   if(confirm("Are you sure to delete the selected item"))
   {	   
       window.location.href="FileUploadView.aspx?delCode=" + code + "";  
   }
}


function checkDeleteFileAttest(checkDeleteFileAttest)
{	 
   if(confirm("Are you sure to delete the selected item"))
   {	   
       window.location.href="FileUploadViewAttestation.aspx?delCode=" + code + "";  
   }
}

//////////////////////////////////////////////////////////////////////
function chkChanged(chkId,txtId)
{
    var checker=document.getElementById(chkId);
    var txt=document.getElementById(txtId);
    if (checker.checked) 
    {
        txt.disabled = false;
    }
    else
    {
        txt.disabled = true;
    }
}

//////////////////////////////////////////////////////////////////////
function chkChangedPackage(chkId, txtId, txtyId) 
{
    var checker = document.getElementById(chkId);
    var txt = document.getElementById(txtId);
    var txty = document.getElementById(txtyId);
    if (checker.checked) 
    {
        txt.disabled = false;
    }
    else 
    {
        txt.disabled = true;
        txty.disabled = true;
        txt.value = "";
        txty.value = "";
    }
}
//////////////////////////////////////////////////////////////////////

function CollapseMessage(obj) 
{ 
	var el = document.getElementById(obj); 
	el.style.display = 'none'; 
}

function switchMenu(obj, img) 
{ 
    var el = document.getElementById(obj); 
    if ( el.style.display!= 'none' ) 
    { 
	    el.style.display = 'none'; 
	    document[img].src="images/dn_arrow.gif";
    } 
    else 
    { 
	    el.style.display = ''; 
	    document.getElementById(img).src="images/up_arrow.gif";
    } 
} 


function validateOfferRet()
{
     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$ddlGrade.value)=="")
	  {
	      alert("Please select the grade before you continue");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$ddlGrade.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.value)=="")
	  {
	      alert("Please enter the Location of work before you continue");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtMonthlySalary.value)=="")
	  {
	      alert("Please enter the Monthly Remuneration before you continue");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtMonthlySalary.focus();
		  return false;
	  }
}



////// CONTRACT
function validateContract()
{
     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.value)=="")
	  {
	      alert("Please enter the Employee ID");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtFirstName.value)=="")
	  {
	      alert("Please enter the first name");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtFirstName.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLastName.value)=="")
	  {
	      alert("Please enter the last name");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLastName.focus();
		  return false;
	  }
	  
	 if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$ddlNationality.value)=="0")
	  {
	      alert("Please enter the nationality");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$ddlNationality.focus();
		  return false;
	  }
	  
	 if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtPassportNo.value)=="")
	  {
	      alert("Please enter the Passport number");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtPassportNo.focus();
		  return false;
	  }
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtPermanentAddress.value)=="")
	  {
	      alert("Please enter the Permanent Address");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtPermanentAddress.focus();
		  return false;
	  }
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtCaddress.value)=="")
	  {
	      alert("Please enter the Correspondence address");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtCaddress.focus();
		  return false;
	  }
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmail.value)=="")
	  {
	      alert("Please enter the email address");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmail.focus();
		  return false;
	  }
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtMobileNo.value)=="")
	  {
	      alert("Please enter the mobile phone number");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtMobileNo.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtResidentPhone.value)=="")
	  {
	      alert("Please enter the resident phone number");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtResidentPhone.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$ddlMaritalStatus.value)=="")
	  {
	      alert("Please enter the marital status");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$ddlMaritalStatus.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpDate.value)=="")
	  {
	      alert("Please enter the date of employment");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpDate.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtContractDate.value)=="")
	  {
	      alert("Please enter the date of contract");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtContractDate.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtTermOfContract.value)=="")
	  {
	      alert("Please enter the term of employment");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtTermOfContract.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtWorkingHrs.value)=="")
	  {
	      alert("Please enter the working hours");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtWorkingHrs.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtExpDate.value)=="")
	  {
	      alert("Please enter the expiry date");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtExpDate.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.value)=="")
	  {
	      alert("Please enter the location");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLeave.value)=="")
	  {
	      alert("Please enter the number of days");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLeave.focus();
		  return false;
	  } 
	  
	  
}
///////


////// CONTRACT UAE Retired MIL
function validateContractUAERetired()
{
     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.value)=="")
	  {
	      alert("Please enter the Employee ID");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtFirstName.value)=="")
	  {
	      alert("Please enter the first name");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtFirstName.focus();
		  return false;
	  }

     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLastName.value)=="")
	  {
	      alert("Please enter the last name");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLastName.focus();
		  return false;
	  }
	  
	if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtPassportNo.value)=="")
	  {
	      alert("Please enter the Passport number");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtPassportNo.focus();
		  return false;
	  }
	  
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpDate.value)=="")
	  {
	      alert("Please enter the date of employment");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpDate.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtContractDate.value)=="")
	  {
	      alert("Please enter the date of contract");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtContractDate.focus();
		  return false;
	  } 
	  
	 
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtWorkingHrs.value)=="")
	  {
	      alert("Please enter the working hours");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtWorkingHrs.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtExpDate.value)=="")
	  {
	      alert("Please enter the expiry date");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtExpDate.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.value)=="")
	  {
	      alert("Please enter the location");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtLocation.focus();
		  return false;
	  } 
	  
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtDepartment.value)=="")
	  {
	      alert("Please enter the department");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtDepartment.focus();
		  return false;
	  } 
	  if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtDuties.value)=="")
	  {
	      alert("Please enter the duties");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtDuties.focus();
		  return false;
	  } 
	  
	   if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtMonthlySalary.value)=="")
	  {
	      alert("Please enter the monthly remuneration");
	      document.aspnetForm.ctl00$ContentPlaceHolder1$txtMonthlySalary.focus();
		  return false;
	  } 
}
///////




function checkDeleteConfirm()
{	 
   if(confirm("Are you sure to delete this"))
   {	   
       return true;  
   }
   else
   {
      return false; 
   }
}


function checkSendOffer()
{	 
   if(confirm("Are you sure to send this"))
   {	   
       return true;  
   }
   else
   {
      return false; 
   }
}


function checkDeleteJobApp()
{	 
   if(confirm("Are you sure to delete the job application?"))
   {	   
       return true;  
   }
   else
   {
      return false; 
   }
}


function validateJoined()
{
     if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$ddlStatus.value)=="36")
	  {
	    if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtJoinedDate.value)=="")
	      {
	          alert("Please enter the Join Date");
	          document.aspnetForm.ctl00$ContentPlaceHolder1$txtJoinedDate.focus();
		      return false;
	      }

        if(trimStr(document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.value)=="")
	      {
	          alert("Please enter the Employee ID");
	          document.aspnetForm.ctl00$ContentPlaceHolder1$txtEmpId.focus();
		      return false;
	      }
	  }
}

