﻿// JScript File
//It checks the length of address
   function Address_ClientValidate(source, clientside_arguments)
   {            
        if (clientside_arguments.Value.length <=100 )
        {      
            clientside_arguments.IsValid=true;
        }              
        else 
        {
              clientside_arguments.IsValid=false;
        }
   }
   //check the job postion summary size
    function summary_ClientValidate(source, clientside_arguments)
   {            
        if (clientside_arguments.Value.length <=2000 )
        {      
            clientside_arguments.IsValid=true;
        }              
        else 
        {
              clientside_arguments.IsValid=false;
        }
   }
   
 //This function is used to validate the comments in admin side
 function Comments_AdminValidate(source, Adminside_arguments)
   {
        
        if (Adminside_arguments.Value.length <=250 )
            Adminside_arguments.IsValid=true;
        else 
            Adminside_arguments.IsValid=false;
   }
 
 //This function is used to validate the subject in admin side
 function Subject_AdminValidate(source, Adminside_arguments)
   {
        
        if (Adminside_arguments.Value.length <=250 )
            Adminside_arguments.IsValid=true;
        else 
            Adminside_arguments.IsValid=false;
   }
   
 //This function is used to validate the comments(suggestions) in client side
 function Comments_ClientValidate(source, Clientside_arguments)
   {
        
        if (Clientside_arguments.Value.length <=500 )
            Clientside_arguments.IsValid=true;
        else 
            Clientside_arguments.IsValid=false;
   }
   
    //This function is used to validate the Job desc
 function JobDesc_AdminValidate(source, Adminside_arguments)
   {
        
        if (Adminside_arguments.Value.length <=200 )
            Adminside_arguments.IsValid=true;
        else 
            Adminside_arguments.IsValid=false;
   }
   
function getCheckedRadio() 
{
      var radioButtons = document.getElementsByName("rblstLand");
      for (var x = 0; x < radioButtons.length; x ++) 
      {
        if (radioButtons[x].checked) 
       {
          //alert("You checked " + radioButtons[x].id);
       } 
          
      }
 }


function showError(){
        if(document.getElementById("ctl00_ContentPlaceHolder1_hypError").innerText == "<< HideError"){
            document.getElementById("ctl00_ContentPlaceHolder1_err").style.height = '0px';
            document.getElementById("Main").style.height = '525px';
            document.getElementById("ctl00_ContentPlaceHolder1_hypError").innerText = "ShowError >>";
        }
        else{
            document.getElementById("ctl00_ContentPlaceHolder1_err").style.height = '40px';
            document.getElementById("Main").style.height = '485px';
           document.getElementById("ctl00_ContentPlaceHolder1_hypError").innerText = "<< HideError";
        }
}

function ValidateKeypress(txtName,Maxlength){
        var fntxtName = document.getElementById(txtName);
        if(fntxtName.innerHTML.length >= Maxlength )
         { 
              return false;
         }
         else
         {
         return true;
         }
}


function htmlinject(obj,e) 
{
    var KeyString;var KeyValue;var isShiftKey;var isCtrl;
    if(window.event)//IE
    {KeyValue = window.event.keyCode;if(window.event.ctrlKey){isCtrl = true;}else{isCtrl = false;}if(window.event.shiftKey){isShiftKey = true;}else{isShiftKey = false;}}
    else//FireFox
    {KeyValue = e.which;if(e.ctrlKey){isCtrl = true;}else{isCtrl = false;}if(e.shiftKey){isShiftKey = true;}else{isShiftKey = false;}}
	var KeyString = String.fromCharCode(KeyValue);
	//var regEx = /^({`|,|~|\?|\/|!|;|@|&|%|_|\(|\)|\+|\$|\*|\^|\||:|"|'|<|>|\\}+)$/;
	var regEx = /^({`|\/|\|\+|\|'|<|>|\\}+)$/;
	if(regEx.test(KeyString)){return false;}
    if(isCtrl==true && KeyValue==67){return false;}//Ctrl + c
    if(isCtrl==true && KeyValue==99){return false;}//Ctrl + C
    if(isCtrl==true && KeyValue==118){return false;}//Ctrl + V
    if(isCtrl==true && KeyValue==86){return false;}//Ctrl + v
    if(isShiftKey==true && KeyValue==46){return false;}//Shift+Del (Cut)
    if(isShiftKey==true && KeyValue==45){return false;}//Shift+Ins (Paste)
//  if(isShiftKey==true && KeyValue==188){return false;}// < (Cut)
//  if(isShiftKey==true && KeyValue==190){return false;}// > (Cut)
}

function htmlinject(e) 
{
    var KeyString;
    var KeyValue;
    var isShiftKey;
    var isCtrl;
    if(window.event)//IE
    {
        KeyValue = window.event.keyCode;
        if(window.event.ctrlKey)
        {
            isCtrl = true;
        }
        else
        {
            isCtrl = false;
        }
        if(window.event.shiftKey)
        {
            isShiftKey = true;
        }
        else
        {
            isShiftKey = false;
        }
    }
    else//FireFox
    {
        KeyValue = e.which;
        if(e.ctrlKey)
        {
            isCtrl = true;
        }
        else
        {
            isCtrl = false;
        }
        if(e.shiftKey)
        {
            isShiftKey = true;
        }
        else
        {
            isShiftKey = false;
        }
    }
	var KeyString = String.fromCharCode(KeyValue);
		
	//var regEx = /^({`|,|~|\?|\/|!|;|@|&|%|_|\(|\)|\+|\$|\*|\^|\||:|"|'|<|>|\\}+)$/;
	var regEx = /^({`|\/|\|\+|\|'|<|>|\\}+)$/;
	if(regEx.test(KeyString)){return false;}
    if(isCtrl==true && KeyValue==67){return false;}//Ctrl + c
    if(isCtrl==true && KeyValue==99){return false;}//Ctrl + C
    if(isCtrl==true && KeyValue==118){return false;}//Ctrl + V
    if(isCtrl==true && KeyValue==86){return false;}//Ctrl + v
    if(isShiftKey==true && KeyValue==46){return false;}//Shift+Del (Cut)
    if(isShiftKey==true && KeyValue==45){return false;}//Shift+Ins (Paste)
//  if(isShiftKey==true && KeyValue==188){return false;}// < (Cut)
//  if(isShiftKey==true && KeyValue==190){return false;}// > (Cut)
}

//This function is used to validate the date with todays date
function CompareDate_TodaysDate(source,arguments)
{
	var strFromDate = arguments.Value;
	var strToDate = serverdate;
	var intFromDt = parseInt(strFromDate.substring(6) + strFromDate.substring(3,5) + strFromDate.substring(0,2))
	var intToDt = parseInt(strToDate.substring(6) + strToDate.substring(3,5) + strToDate.substring(0,2))
	if(intFromDt < intToDt)
		arguments.IsValid=false;	
}