﻿// By Ramesh 
// to prevent Session end
        var obj;
        var valTimeOut2;
        function CheckClientSession(valTimeOut)
        {  
            valTimeOut2=valTimeOut
            if (valTimeOut>0)
            {
                valTimeOut = (valTimeOut * 60000) - 30000;
                setTimeout('ReconnectJS()', valTimeOut);
            }
        }
        function PopulateTitle(strTitleid)
        {
            strTitleid.options[0].text = "Select";
            strTitleid.options[0].value = "";
            strTitleid.options[1].text = "Mr";
            strTitleid.options[1].value = "Mr";
            strTitleid.options[2].text = "Mrs";
            strTitleid.options[2].value = "Mrs";
            strTitleid.options[3].text = "Miss";
            strTitleid.options[3].value = "Miss";
            strTitleid.options[4].text = "Ms";
            strTitleid.options[4].value = "Ms";
            strTitleid.options[5].text = "Dr";
            strTitleid.options[5].value = "Dr";
        }
        function ReconnectJS()
        {   
            var reply=confirm('You have been on this page for almost 30 mins and your session is about to end. \r Please Click OK to re-set your session and \r make sure you do not lose your work');        
            if (reply)
            {
                GetDataViaAJAX();
                CheckClientSession(valTimeOut2);
            }
        }
        function GetDataViaAJAX()
        {
            try
            {
                obj = new ActiveXObject("Msxml2.XMLHTTP");                
            }
            catch(e)
            {
                try
                {
                    obj = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e1)
                {
                    try
                    {
                        // Firefox, Opera, Safari                        
                        obj = new XMLHttpRequest();
                    }
                    catch(e2)
                    {
                        alert('Session Prevent - ActiveXObject:none');
                        obj = null;
                    }
                }
            }
            if(obj!=null)
            {
                obj.onreadystatechange = ProcessResponse;
                //obj.open("GET","http://localhost/AJAXDemo/helloworld.aspx",true);
                obj.open("GET","http://localhost/cvsite/SessionModalReply.aspx",true);
                obj.send(null);         
            }
            return false;
        }
        function ProcessResponse()
        {
            //alert('readystate:' + obj.readyState);
            if(obj.readyState == 4)
            {
                if(obj.status == 200)
                {
                    var retval=obj.responseText;  
                    //alert(retval);
                }
                else
                {
                    alert("Session Prevent - ProcessResponse :Error retrieving data!" );
                }
            }
        }

    
// End of Code to prevent session end


function IsInteger(varInt)
	{
			var checkOK = "0123456789";
			var checkStr = varInt;
			var allValid = true;
			var allNum = "";
			for (i = 0;  i < checkStr.length;  i++)
			{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			break;
			if (j == checkOK.length)
			{
			allValid = false;
			break;
			}
			if (ch != ",")
			allNum += ch;
			}
		return allValid;
	}
function numeralsOnly(evt) 
    {
	    // This function is used to accept only numeric values
    	   	
	    evt = (evt) ? evt : event;
	    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	    if (charCode > 31 && (charCode < 48 || charCode > 57)&& charCode != 46) 
	    {
		    alert("Enter numerals only in this field.");
		    return false;
	    }
		    return true;
    }	
	
function disallowCharacters(strText,strDisallowedCharacters)
	{ 
		//The parameter to the function is the string which is to be validated
		//The second parameter strDisallowedCharacters should contain the characters
		// which are not allowed in the string
		//var strNotAllowed = ";:/\,&\\";
		var strNotAllowed = strDisallowedCharacters;
		var checkStr = strText;
		var allValid = true;
		for (i = 0;  i < strNotAllowed.length;  i++)
			{
				if (strText.indexOf(strNotAllowed.charAt(i)) > 0)
					{
						allValid = false;
					}
			}
			return allValid;
	}
	
	////Guru's functions
function fnMinimumLength(str,strlen)
    {
        //This function checks for the minimum length.
        //Parameter : Str = The actual string
        //Parameter : strlen = length, of the string accepted
        
        if(str.length>=strlen)
            {
                return false;
            } 	
        return true;
    }
    
function trim(str)
    {
        // This function is used for chcking if user has typed white spaces in the control
       return str.replace(/^\s*|\s*$/g,"");
    }
    
function isCharsInBag (s, bag)
    {
     //Allows only the characters in the bag
     // This function checks for the characters in a string
     // Parameter: a string and list of accepted characters
     
      var i;
      for (i = 0; i < s.length; i++)
          {
                  var c = s.charAt(i);
                  if (bag.indexOf(c) == -1) return false;
          }
      return true;
    }

function isValidEmail(strEmail)
    {
        // This functions checks for the valid email address
        bemail1=new RegExp(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
		bemail2 = bemail1.exec(strEmail);
			
		if(!bemail2)
		    {
			    /*alert("Please enter a valid Email Address");
			    document.Form1.txtemail.focus();*/
			    return false;
		    }
		        return true;
    }

function daysInFebruary (year){
    
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}


function Left(str, n)
{
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function Right(str, n)
{
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else 
	{
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}

///
function roundOff(value, precision) 
{ 
    var result = "0.00"; 
    precision = parseInt(precision);          // make sure roundoff is an int 
    // alerts are only for debugging and expanation -- they may be deleted/commented 
    //alert("Value before rounding is "+value) 
    value = ""+Math.round(value * Math.pow(10, precision));  // take the integer part of value*10**precision

   //alert("Value is "+value+"\nLength of value is "+value.length+"\nPrecision is "+precision) 
    // determine where to put decimal point 
    if (value.length > precision)        // more digits in value than in precision (e.g., 999.99) 
            { 
                result = value.substring(0, value.length-precision); 
                if (precision > 0 ) result += "."; 
                    result  += value.substring(value.length-precision, value.length); 
             } 
    else                        // number of digits <= precision and value less than 1.0) 
             { 
                    result = "0."; 
                    if (value.length < precision) 
                        { 
                            for (var i = 0; i < precision - value.length; i++) 
                                { 
                                   result += "0";                // pad fraction with leading zeros 
                                } 
                         } 
    result += value; 
   }                // end else 
   return result; 
} 

//JIJU
function GetSalaryList(objDropDown, strFreq, strSelectedSal)
{
    var ddlSalary = document.getElementById(objDropDown);
    var newOpt;
    var i;
    var j = 2;
    var k;
    var minsalary = null;
    var maxsalary = null;
    var salary_increment = null;
    
    if (strFreq == 'annual')
    {
        minsalary = 12000;
        maxsalary = 150000;
        salary_increment = 2000;
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option("Less than " + i, parseInt(prev_salary  + 1) + '-' + minsalary);
                        ddlSalary.options[j]=newOpt;
                        k++;
                    }
                else 
                    {
                    
                    //alert(i)
                    if (i >= 30000 && i <= 80000)    
                        {
                          salary_increment = 5000  
                        }
                    if (i >= 80000)    
                        {
                          salary_increment = 10000  
                        }    
                    
                     newOpt = new Option(i, parseInt(prev_salary  + 1) + '-' + i);
                    //alert( parseInt(prev_salary))
                    ddlSalary.options[j]=newOpt;
                   
                    }
              prev_salary = i;
              i = i + salary_increment;      
            }  
       newOpt.text = "More than " + newOpt.text  
    }
    else if (strFreq == 'hourly')
     {
        minsalary = 6;
        maxsalary = 70;
        salary_increment = 2;
        
        
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option("Less than " + i, parseInt(prev_salary  + 1) + '-' + minsalary);
                        ddlSalary.options[j]=newOpt;
                        k++;
                    }
                else 
                    {
                    
                   // alert(i)
                    if (i >= 20 && i <= 70)    
                        {
                          salary_increment = 5  
                        }
                    /*if (i >= 80000)    
                        {
                          salary_increment = 10000  
                        }*/    
                    
                     newOpt = new Option(i, parseInt(prev_salary  + 1) + '-' + i);
                    //alert( parseInt(prev_salary))
                    ddlSalary.options[j]=newOpt;
                   
                    }
              prev_salary = i;
              i = i + salary_increment;      
            }  
       newOpt.text = "More than " + newOpt.text

    }
     else if (strFreq == 'daily')
    {
        minsalary = 50;
        maxsalary = 500;
        salary_increment = 10;
        
        
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option("Less than " + i, parseInt(prev_salary  + 1) + '-' + minsalary);
                        ddlSalary.options[j]=newOpt;
                        k++;
                    }
                else 
                    {
                    
                   // alert(i)
                    if (i >= 200 && i <= 500)    
                        {
                          salary_increment = 50  
                        }
                    /*if (i >= 80000)    
                        {
                          salary_increment = 10000  
                        }*/    
                    
                     newOpt = new Option(i, parseInt(prev_salary  + 1) + '-' + i);
                    //alert( parseInt(prev_salary))
                    ddlSalary.options[j]=newOpt;
                   
                    }
              prev_salary = i;
              i = i + salary_increment;      
            }  
       newOpt.text = "More than " + newOpt.text
        
        
    }

    else if (strFreq == 'monthly')
    {
        minsalary = 1000;
        maxsalary = 12000;
        salary_increment = 500;
        
        
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option("Less than " + i, parseInt(prev_salary  + 1) + '-' + minsalary);
                        ddlSalary.options[j]=newOpt;
                        k++;
                    }
                else 
                    {
                    
                   // alert(i)
                    if (i >= 5000 && i <= 12000)    
                        {
                          salary_increment = 1000  
                        }
                    /*if (i >= 80000)    
                        {
                          salary_increment = 10000  
                        }*/    
                    
                     newOpt = new Option(i, parseInt(prev_salary  + 1) + '-' + i);
                    //alert( parseInt(prev_salary))
                    ddlSalary.options[j]=newOpt;
                   
                    }
              prev_salary = i;
              i = i + salary_increment;      
            }  
       newOpt.text = "More than " + newOpt.text
        
 }

  
     if(strSelectedSal != '')
    {
        
        for(var i=0;i<ddlSalary.length;i++)
        {
            if(ddlSalary.options[i].value==strSelectedSal) 
            {
               ddlSalary.selectedIndex = i;
               break;
            }
             
        }    

    }
    
    return true;
   
}

//New function by Rajesh on 27MARCH
 function GetSalaryOptions(objDropDown, objSecondDropDown, strFreq, strSelectedSal, strSelectedMaxSal)
{
    var ddlSalary = document.getElementById(objDropDown);
    var ddlToSalary = document.getElementById(objSecondDropDown);
    var newOpt;
    var i;
    var j = 2;
    var k;
    var minsalary = null;
    var maxsalary = null;
    var salary_increment = null;
    
    if (strFreq == 'annual')
    {
        minsalary = 12000;
        maxsalary = 150000;
        salary_increment = 2000;
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
        for (var i = (ddlToSalary.options.length-1); i >= 0; i--)
            {
                ddlToSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       newOpt2 = new Option('Select', '');
       ddlToSalary.options[0]=newOpt2;
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option(minsalary, minsalary);
                        newOpt2 = new Option(minsalary, minsalary);
                        ddlSalary.options[j]=newOpt;
                        ddlToSalary.options[j]=newOpt2;
                        k++;
                    }
                else 
                    {
                    if (i >= 30000 && i <= 80000)    
                        {
                          salary_increment = 5000  
                        }
                    if (i >= 80000)    
                        {
                          salary_increment = 10000  
                        }    
                    
                     newOpt = new Option(i, i);
                     newOpt2 = new Option(i, i);
                    ddlSalary.options[j]=newOpt;
                    ddlToSalary.options[j]=newOpt2;
                    }
              i = i + salary_increment;      
            }  
        newOpt = new Option('More than 150000', '1000000');
        ddlToSalary.options[ddlToSalary.options.length] = newOpt;
    }
    else if (strFreq == 'hourly')
     {
        minsalary = 6;
        maxsalary = 70;
        salary_increment = 2;
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
         for (var i = (ddlToSalary.options.length-1); i >= 0; i--)
            {
                ddlToSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       newOpt2 = new Option('Select', '');
       ddlToSalary.options[0]=newOpt2;
       
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option(minsalary, minsalary);
                        newOpt2 = new Option(minsalary, minsalary);
                        ddlSalary.options[j]=newOpt;
                        ddlToSalary.options[j]=newOpt2;
                        k++;
                    }
                else 
                    {
                    if (i >= 20 && i <= 70)    
                        {
                          salary_increment = 5  
                        }
                    newOpt = new Option(i, i);
                    newOpt2 = new Option(i, i);
                    ddlSalary.options[j]=newOpt;
                    ddlToSalary.options[j]=newOpt2;
                    }
              i = i + salary_increment;      
            } 
         newOpt = new Option('More than 70', '1000');
         ddlToSalary.options[ddlToSalary.options.length] = newOpt; 
    }
   
     else if (strFreq == 'daily')
    {
        minsalary = 50;
        maxsalary = 500;
        salary_increment = 10;
        
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
        for (var i = (ddlToSalary.options.length-1); i >= 0; i--)
            {
                ddlToSalary.options[i]=null;
            }
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       newOpt2 = new Option('Select', '');
       ddlToSalary.options[0]=newOpt2;
       
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option(minsalary, minsalary);
                        newOpt2 = new Option(minsalary, minsalary);
                        ddlSalary.options[j]=newOpt;
                        ddlToSalary.options[j]=newOpt2;
                        k++;
                    }
                else 
                    {
                    if (i >= 200 && i <= 500)    
                        {
                          salary_increment = 50  
                        }
                    
                    newOpt = new Option(i, i);
                    newOpt2 = new Option(i, i);
                    ddlSalary.options[j]=newOpt;
                    ddlToSalary.options[j]=newOpt2;
                   
                    }
              i = i + salary_increment;      
            }  
         newOpt = new Option('More than 500', '10000');
         ddlToSalary.options[ddlToSalary.options.length] = newOpt;
    }
    else if (strFreq == 'monthly')
    {
        minsalary = 1000;
        maxsalary = 12000;
        salary_increment = 500;
        for (var i = (ddlSalary.options.length-1); i >= 0; i--)
            {
                ddlSalary.options[i]=null;
            }
        for (var i = (ddlToSalary.options.length-1); i >= 0; i--)
            {
                ddlToSalary.options[i]=null;
            }
                
       newOpt = new Option('Select', '');
       ddlSalary.options[0]=newOpt;
       newOpt2 = new Option('Select', '');
       ddlToSalary.options[0]=newOpt2;
       
       var prev_salary = 0;
       for(j=1,i=minsalary,k=0; i<=maxsalary; j++)
            {
                if (k==0)
                    {
                        newOpt = new Option(minsalary, minsalary);
                        newOpt2 = new Option(minsalary, minsalary);
                        ddlSalary.options[j]=newOpt;
                        ddlToSalary.options[j]=newOpt2;
                        k++;
                    }
                else 
                    {
                    
                   // alert(i)
                    if (i >= 5000 && i <= 12000)    
                        {
                          salary_increment = 1000  
                        }
                    newOpt = new Option(i, i);
                    newOpt2 = new Option(i, i);
                    ddlSalary.options[j]=newOpt;
                    ddlToSalary.options[j]=newOpt2;
                    
                    }
              i = i + salary_increment;      
            }  
      newOpt = new Option('More than 12000', '100000');
      ddlToSalary.options[ddlToSalary.options.length] = newOpt;
    }
     if(strSelectedSal != '')
    {
        
        for(var i=0;i<ddlSalary.length;i++)
        {
            if(ddlSalary.options[i].value==strSelectedSal) 
            {
               ddlSalary.selectedIndex = i;
               break;
            }
        }    
    }
    if(strSelectedMaxSal != '')
    {
        for(var i=0;i<ddlToSalary.length;i++)
        {
            if(ddlToSalary.options[i].value==strSelectedMaxSal) 
            {
               ddlToSalary.selectedIndex = i;
               break;
            }
        }    
    }
    return true;
    
}


//Rajesh on 05APRIL 2007

function backButtonOverride()
{
  // Work around a Safari bug
  // that sometimes produces a blank page
  //setTimeout("backButtonOverrideBody()", 1);

}

function backButtonOverrideBody()
{
  // Works if we backed up to get here
  try {
    history.forward();
  } catch (e) {
    // OK to ignore
  }
  // Every quarter-second, try again. The only
  // guaranteed method for Opera, Firefox,
  // and Safari, which don't always call
  // onLoad but *do* resume any timers when
  // returning to a page
  setTimeout("backButtonOverrideBody()", 500);
}

function CallPopUp(valTimeOut)
//function CallPopUp(valTimeOut, frmname)
{
//           int_MilliSecondsTimeOut = (int_MilliSecondsTimeOut * 60000) - 30000;
//           setTimeout('Reconnect()', int_MilliSecondsTimeOut);
//alert("CallPopUp");
           var int_MilliSecondsTimeOut = valTimeOut; 
           valTimeOut = (valTimeOut * 60000) - 30000;
           setTimeout('Reconnect(int_MilliSecondsTimeOut)', valTimeOut);
           //setTimeout('Reconnect(int_MilliSecondsTimeOut)', valTimeOut, frmname);
}

//function Reconnect(intTimeOut, strfrmname)
function Reconnect(intTimeOut)
{      
    /*var ofrm= document;
    if(typeof ofrm.style.opacity == "string") 
    {
	    ofrm.style.opacity = 0.7;
    } 
    else 
    {
        ofrm.filters.alpha.opacity 
	    //here use  document.getElementById(id).filters.alpha.opacity
     }*/
     //alert("Reconnect");
    //var i;
    //Layer2.style.display = 'block';
    //Layer2.style.zIndex = 0;
    /*for(i = 0; i < from1.length; i++)
    {
        var formelement = from1.elements[i];
        formelement.disabled = true;
        //formelement.style.opacity = 0.7;
        //formelement.style.filter = 'alpha(opacity = 0.7)';
    } 
    from1.btnLayer2OK.disabled = false;
    from1.btnLayer2OK.style.zIndex = 1;*/
    //window.open('../SessionExpiredWarning.aspx','Reset','height=285,width=235,top=100,left=100,titlebar=no');
    //int_MilliSecondsTimeOut = 2 * 60000;
    //int_MilliSecondsTimeOut = <%=intTimeout%>;
    //CallPopUp(intTimeOut);
    //CallPopUp(intTimeOut, strfrmname);
}

function openSuggestions(varControlID, varSection, varSector, varHistoryID, varMultiLine)
    {   
        //Note: varMultiLine will have 1 or 0
        // 1=true and 0= false
        var strSuggestionURL;
        if ( varSector==null || varSector=='undefined' || varSector=='')
        {
            strSuggestionURL = "../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" + varSection;
            //window.open("../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" +varSection,'','width=500,height=350,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=250, left=320');
            //return false;
        }
        else
        {     
            strSuggestionURL = "../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" + varSection+"&SectorID="+varSector;
            //window.open("../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" +varSection+"&SectorID="+varSector,'','width=500,height=350,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=250, left=320');
            //return false;
        }
        if ( varHistoryID==null || varHistoryID=='undefined' || varHistoryID=='')
        {
            //strSuggestionURL = "../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" + varSection;
            //window.open("../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" +varSection,'','width=500,height=350,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=250, left=320');
            //return false;
        }
        else
        {     
            //strSuggestionURL = "../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" + varSection+"&SectorID="+varSector;
            strSuggestionURL = strSuggestionURL + "&WkHistoryID=" + varHistoryID;
            //window.open("../cv-registration/Suggestions.aspx?ControlID=" + varControlID + "&Section=" +varSection+"&SectorID="+varSector,'','width=500,height=350,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=250, left=320');
            //return false;
        }
        strSuggestionURL = strSuggestionURL + "&MultiLine=" + varMultiLine;
        //alert(strSuggestionURL);
        window.open(strSuggestionURL,'','width=500,height=350,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=250, left=320');
        return false;
    }

function InsertSuggestion(varText,varControlID, varMultiLine)
    {          
        if (Trim(document.getElementById(varControlID).value)=='')
        {
            document.getElementById(varControlID).value= Trim(varText);
        }
        else
        {
            if (varMultiLine==1)
            {
                document.getElementById(varControlID).value= Trim(document.getElementById(varControlID).value) + ' \r ' + varText;
            }
            else
            {
                document.getElementById(varControlID).value= Trim(varText);
            }
        }
        document.getElementById(varControlID).focus();
        return false;
    }	
 // ------------ Find & Select Jobseeker  --------------------
 function Search_JS(varControlID)
    {  
       
        var strURL;
        if ( varControlID!=null || varControlID!='undefined' || varControlID!='')
        {
            strURL = '../support/Find-Jobseeker.aspx?ControlID=' + varControlID
            window.open(strURL,'','width=900,height=550,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=50, left=50');
            //return false;
        }
        return false;
    }
function Select_JS(varText,varControlID)
    {   
        document.getElementById(varControlID).value= Trim(varText);
        document.getElementById(varControlID).focus();
        return false;
    }	
 //End: ------------ Find & Select Jobseeker  --------------------
 // ------------ Find & Select Recruiter  --------------------
 function Search_REC(varControlID)
    {  
       
        var strURL;
        if ( varControlID!=null || varControlID!='undefined' || varControlID!='')
        {
            strURL = '../support/Find-Recruiter.aspx?ControlID=' + varControlID
            window.open(strURL,'','width=900,height=550,dependent=yes,resizable=yes,scrollbars=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,status=yes,titlebar=no,toolbar=no,screenX=1000, screenY=5000, top=50, left=50');
            //return false;
        }
        return false;
    }
function Select_REC(varText,varControlID)
    {   
        document.getElementById(varControlID).value= Trim(varText);
        document.getElementById(varControlID).focus();
        return false;
    }	
 //End: ------------ Find & Select Recruiter  --------------------
    
// --------------------------------------------
//                  msg
// Display warn/error message in HTML element.
// commonCheck routine must have previously been called
// --------------------------------------------
   //fld id of element to display message in
              //msgtype class to give element ("warn" or "error")
              //message string to display
function ShowMessage(fld,msgtype,message)          
{
  // setting an empty string can give problems if later set to a 
  // non-empty string, so ensure a space present. (For Mozilla and Opera one could 
  // simply use a space, but IE demands something more, like a non-breaking space.)
  var dispmessage="";
 if (emptyString.test(message)) 
    dispmessage = String.fromCharCode(nbsp);    
  else  
    dispmessage = message;
    
  var elem11 = document.getElementById(fld);
  if (elem11.firstChild!=null && elem11.firstChild!=undefined)
  {
    elem11.firstChild.nodeValue = dispmessage;  
  }
  else
  {
     elem11.value= dispmessage; 
  }
    
  elem11.className = msgtype;   // set the CSS class to adjust appearance of message
  
  //var elem = document.getElementById(fld);
  //elem.firstChild.nodeValue = dispmessage;  
  //elem.className = msgtype;   // set the CSS class to adjust appearance of message
}
function LTrim( value ) 
    {	// By Ramesh, Removes leading whitespaces
        
	    var re = /\s*((\S+\s*)*)/;
	    return value.replace(re, "$1");	    	    
	}	
function RTrim( value ) 
    {	// By Ramesh, Removes ending whitespaces
	    var re = /((\s*\S+)*)\s*/;
	    return value.replace(re, "$1");	
    }

function Trim( value ) 
    {	
        // By Ramesh Removes leading and ending whitespaces
	    return LTrim(RTrim(value));	
    }
    
    function ShowMsg()
    {
        if (navigator.userAgent.indexOf('Safari') != -1)
        {
            alert('Back button access is not allowed on this page. You are being redirected to the error notification page.');
        }
    }
var diffAmounts;
function Get_All_Amounts(dblAmount)
{
    // By Ramesh on 19-09-2007
    // To show amounts in different currencies
    // Similar function exists for serverside on app_code/commonfunctions.vb
    //alert('Common:'+ '<%=ConfigurationManager.AppSettings("Currency") %>');
            try
            {
                obj = new ActiveXObject("Msxml2.XMLHTTP");                
            }
            catch(e)
            {
                try
                {
                    obj = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch(e1)
                {
                    try
                    {
                        // Firefox, Opera, Safari                        
                        obj = new XMLHttpRequest();
                    }
                    catch(e2)
                    {
                        alert('Session Prevent - ActiveXObject:none');
                        obj = null;
                    }
                }
            }
            if(obj!=null)
            {
                obj.onreadystatechange = ProcessAmountResponse;
                //obj.open("GET","http://localhost/AJAXDemo/helloworld.aspx",true);
                obj.open("GET","../Get-Diff-Amounts.aspx?Amount=" +dblAmount,true);
                obj.send(null);         
            }
            return diffAmounts;
}
function ProcessAmountResponse()
{
    //alert('readystate:' + obj.readyState);
    if(obj.readyState == 4)
    {
        if(obj.status == 200)
        {
            var retval=obj.responseText;  
            //alert(retval);
            diffAmounts=retval;
        }
        else
        {
            //alert("Session Prevent - ProcessResponse :Error retrieving data!" );
        }
    }
}

function CheckMaxLength(Cntrl,size,maxsize,infofield,CounterField)
{    
    // By Ramesh on 19-09-2007
    // Check length and cut the text to the size allowed
    // also show remaining charcaters
    ShowMessage (infofield, "errortext","");
    if(Cntrl.value.length >= size) 
     {        
        ShowMessage(infofield, "errortext","You cannot add anymore text. You have reached the maximum limit.");
        Cntrl.value=Cntrl.value.substring(0,size);
     }
    // Show remaining characters
    CounterField = document.getElementById(CounterField);
    if (CounterField!=null && CounterField!='undefined' && CounterField!='')
    {
        CounterField.innerHTML = maxlimit - (Cntrl.value.length);        
	    if (CounterField.innerHTML < 0 )
	    {
		    CounterField.innerHTML = 0;    
		}
    }
}

function CheckMaxLengthOnPaste(Cntrl,size,infofield)
{    
    //var Cntrl=document.getElementById('control');
    //alert(Cntrl);    
//    if(Cntrl.value.length + window.clipboardData.getData('Text').length) >= 10) 
//     {
//        Cntrl.value=Cntrl.value.substring(0,10);        
//     }
}

//Rajesh on 10OCT
function DisableControl(controlId)
{
    if (controlId!=null && controlId!='undefined')
    {
        //alert('disabled' + ' ' + controlId);        
        //document.getElementById(controlId).disabled = true;
        var btn=document.getElementById(controlId);
        if (btn!=null && btn!='undefined')
        {
            btn.disabled='true';
        }
    }
}
 
function DisableControl_SetTimeout(controlId,interval)
{
  setTimeout("DisableControl('" + controlId + "')",interval);
}
function DisableButton(control)
{
  DisableControl_SetTimeout(control.id,100);
}

//Rajesh on 10OCT
