    document.write("<SCRIPT SRC='scripts/NoRightClick.js'></SCRIPT>");
    
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

//check whether a field fullfill all the requirement of a 
//required field, like no white sapce in begnning,end and no conseccutive two white spaces
//the field is not empty if user has put only whitespaces only this will trim and give
//error message 
function checkRequired(fieldName,Message)
 {
    var sVal = "" ;
    var obj = document.getElementById(fieldName);
    if( typeof(obj) !="undefined" && obj!=null )
   {
    sVal =  obj.value ;

    sVal = sVal.replace( /\s/gi, '' );
    sVal = trim(sVal);

    if(sVal == "" || sVal.length == 0 )
     {
     showErrorMessage(Message+" required");
          if(obj.type.charAt(0)!="s")
               obj.select();
          else 
               obj.focus();
           return false;
     }
     else
     {
       removeWhitspace(fieldName);
     }
    }
    return true;
 }


// Exactly the same as checkRequired method except that this
// applies for ID type fields. There may be a field which has 
// been populated with an ID of zero which indicates an empty
// value. So this is invalid for Numeric ID fields.
// P.Nguyen 10/12/2004
function checkRequiredNumericID(fieldName,Message)
{
  var sVal = "" ;
  var obj = document.getElementById(fieldName);
  if( typeof(obj) !="undefined" && obj!=null )
  {
    sVal =  obj.value ;
    sVal = sVal.replace( /\s/gi, '' );
    sVal = trim(sVal);
    
    if( sVal == "" || sVal.length == 0 || sVal <= 0 )
    {
      showErrorMessage(Message+" required");
      if(obj.type.charAt(0)!="s")
        obj.select();
      else 
        obj.focus();
      return false;
    }
    else
    {
      removeWhitspace(fieldName);
    }
  }
  return true;
}

function validateHowManyCharHasValue(obj,number,str)
{
			var bRet;
			bRet=true;
            if(trim(obj.value)!='')
             {
                if(obj.value.length > number)
                {
                    showErrorMessage(str + " field can have "+number + " character" );
                     if(obj.type.charAt(0)!="s")
                       obj.select();
                     else 
                        obj.focus();
                       
		  bRet = false;
                }
             }
          return bRet;
}
 
function ValidateNotEmptyNumeric(obj, str)
       {
		 	if( trim(obj.value)=='' )  
		 	  {
		 	    showErrorMessage(str + " field can not be empty" );
			    if(obj.type!="select")
                               obj.select();
                            else 
                              obj.focus();
                           
			    return false;
			  }
		     if( obj.value!='' )  
		      {
		        return isNumericValue(obj, str);
		      }
		     else
		      {
		       return true;
		      }
	   }
	   
//===============================================
 function isNegativeValue(obj, str)
//===============================================
{
	var bRet;
        bRet=false;
	if (trim(obj.value) != "" ) 
	   { 
	   	    if (obj.value <= 0)
			{
				showErrorMessage(str + " field value is too small" );
				 if(obj.type.charAt(0)!="s")
                                    obj.select();
                                else 
                                 obj.focus();
                                
				bRet=true;
				
			}	
	     } 
     	 
	return bRet;
}

function ValidateNotEmptyDate(obj, str)
   {
		 	if( trim(obj.value)=='' )  
		 	  {
		 	    showErrorMessage(str + " date field can not be empty" );
				obj.select();
				return false;
			  }
		     if( obj.value!='' )
		      {
		        return validateDate(obj, str);
		      }
		     else
		      {
		        return true;
		      }
	}
	

function ValidateValue(obj, str)
	{
		 	if( trim(obj.value)=='' )  
		 	  {
		 	     showErrorMessage(str + " field can not be empty" );
				 if(obj.type.charAt(0)!="s")
                                       obj.select();
                                  else 
                                       obj.focus();
				return false;
			  }
		     else
		      {
		        return true;
		      }
	}
	
function CheckListName(obj,str)
{
  if( trim(obj.value)=='' )  
	 {
	   ClearAllErrors();
	    showErrorMessage(str + " field can not be empty" );
	    if(obj.type.charAt(0)!="s")
               obj.select();
             else 
               obj.focus();
	   return false;
	 }
  else
	 {
	   return true;
	 }
}



//for validation of email
function ValidateEmail(str,Message)
{
                    
     var obj = document.getElementById(str);
    if( trim(obj.value)=='' )   
      {
        showErrorMessage(Message + " required" );
         if(obj.type.charAt(0)!="s")
               obj.select();
          else 
               obj.focus();
        return false;

       }
       else  
      {
        var sStr = obj.value;
        if(!checkEmail(sStr))
        {
            showErrorMessage( "Please enter valid email for " + Message );
             if(obj.type.charAt(0)!="s")
               obj.select();
             else 
               obj.focus();
            return false;
       }
    }
    return true;
}
//for validating email is correct or not
function checkEmail(emailStr) {
   if (emailStr.length == 0) {
       return true;
   }
   var emailPat=/^(.+)@(.+)$/;
   var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
   var validChars="\[^\\s" + specialChars + "\]";
   var quotedUser="(\"[^\"]*\")";
   var ipDomainPat=/^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
   var atom=validChars + '+';
   var word="(" + atom + "|" + quotedUser + ")";
   var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
   var domainPat=new RegExp("^" + atom + "(\\." + atom + ")*$");
   var matchArray=emailStr.match(emailPat);
   if (matchArray == null) {
       return false;
   }
   var user=matchArray[1];
   var domain=matchArray[2];
   if (user.match(userPat) == null) {
       return false;
   }
   var IPArray = domain.match(ipDomainPat);
   if (IPArray != null) {
       for (var i = 1; i <= 4; i++) {
          if (IPArray[i] > 255) {
             return false;
          }
       }
       return true;
   }
   var domainArray=domain.match(domainPat);
   if (domainArray == null) {
       return false;
   }
   var atomPat=new RegExp(atom,"g");
   var domArr=domain.match(atomPat);
   var len=domArr.length;
   if ((domArr[domArr.length-1].length < 2) ||
       (domArr[domArr.length-1].length > 3)) {
       return false;
   }
   if (len < 2) {
       return false;
   }
   return true;
}
//to check for the numeric value
function IsNumeric(fieldName,strMessage)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   var obj = document.getElementById(fieldName);
  
      if(typeof(obj)!="undefined" && obj!=null)
      {
         var sText = obj.value;
       for (i = 0; i < sText.length && IsNumber == true; i++) 
          { 
          Char = sText.charAt(i);

          if (ValidChars.indexOf(Char) == -1) 
             {
               showErrorMessage("Please enter valid value for "+ strMessage);
               if(obj.type.charAt(0)!="s")
                     obj.select();
               else 
                    obj.focus();
                IsNumber = false;
             }
          }
      }
   return IsNumber;
   
   }

//=======================================================
function IsInteger(strString)
//=======================================================
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789 ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }	
/*
=======================================================
To validate the experience field
Gagan , 19393
=======================================================
*/

//=======================================================
function isExperienceValid(fromExperience,toExperience)
//=======================================================
{
    var objFromExperience=eval(document.getElementById(fromExperience));
    var objToExperience=eval(document.getElementById(toExperience));
    
    
        if(objToExperience!=null)
        {
            if(trim(objFromExperience.value)!="" || trim(objToExperience.value)!="")
            {
                if (!checkRequired(fromExperience,"Minimum Experience"))       
                            return false;

                if (!checkRequired(toExperience,"Maximum Experience"))
                            return false;
            }
        }
        else
        {
            if (!checkRequired(fromExperience,"Experience"))       
            return false;
        }
       
        
    if (trim(objFromExperience.value)!="")    
    {
        if(!IsInteger(objFromExperience.value))
        {
            showErrorMessage("Please enter valid number without decimal in experience field");
            objFromExperience.select();
            return false;
        }
    }    
 

    if (objToExperience!=null && trim(objToExperience.value)!="")
    {        
        if (!IsInteger(objToExperience.value))
        {
            showErrorMessage("Please enter valid number without decimal in experience field");
            objToExperience.select();
            return false;
        }

        if (parseInt(objFromExperience.value)>parseInt(objToExperience.value))
        {
            showErrorMessage("Minimum experience value must be less than maximum experience.");
            objFromExperience.select();
            return false;
        }                                 
     }
    
    return true;

}


//==============================
function CheckAlpha(fieldName,str)
//==============================
{
        var obj = document.getElementById(fieldName);
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒšœŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ- \f.'";
	
	return checkInput(obj,checkOK,str);

}
 	

	


 function trim(inputString) {
        // Removes leading and trailing spaces from the passed string. Also removes
        // consecutive spaces and replaces it with one space. If something besides
        // a string is passed in (null, custom object, etc.) then return the input.
        if (typeof inputString != "string") { return inputString; }
        var retValue = inputString;
        var ch = retValue.substring(0, 1);
        while (ch == " ") { // Check for spaces at the beginning of the string
                retValue = retValue.substring(1, retValue.length);
                ch = retValue.substring(0, 1);
                }
                ch = retValue.substring(retValue.length-1, retValue.length);
                while (ch == " ") { // Check for spaces at the end of the string
                retValue = retValue.substring(0, retValue.length-1);
                ch = retValue.substring(retValue.length-1, retValue.length);
        }
        while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
                retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
        }
        return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function	

function checkNumberwithSpace(checkStr)
{
        var checkOK = "0123456789 ";
        var allValid = true;
        var decPoints = 0;
        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 CheckSpecialChars(objname,str)
//==============================
{
        var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_$";
        var allValid = true;
        var obj = document.getElementById(objname);
        checkStr = obj.value;
        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)
                {

                         showErrorMessage(str + " contains some illegal characters" );
                         allValid = false;
                          if(obj.type.charAt(0)!="s")
                               obj.select();
                          else 
                               obj.focus();
                        break;
                }
        }
        return allValid;
}
//to check special characters in skills as there may be . # like that in skill
//add + and space to be included in skills
//==============================
function CheckSpecialskillChars(objname,str)
//==============================
{    
        //var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_$# +&";
        var allValid = true;
        var obj = document.getElementById(objname);
        var opt = obj.options;
        var checkStr;
        /*for(var i=0; i<opt.length; i++){
             checkStr = opt[i].value;
              
         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)
                {

                         showErrorMessage(str + " can not contain special characters" );
                         allValid = false;
                         obj.focus();
                        break;
                }
             }
        }*/
        for(var i=0;i<opt.length;i++)
        {
        checkStr = opt[i].value;
        var rex=new RegExp();
        //rex.compile("[^ A-Za-z0-9._$#+&{}()/-]");
          rex.compile("[^ A-Za-z0-9._$+&\\/)(#}\\\\[{\\]*:-]");
        temp=checkStr;
      
       if(temp.indexOf("]")!=-1)
       {
       temp=temp.replace( /\]/g, '#' );
       }
          
       var result=rex.exec(temp);   
       if(result!=null)
            {      
                    showErrorMessage(str + " can not contain special characters" );
                    allValid = false;
                    obj.focus();     
                    break;  
            }

        }
        return allValid;
}

//to check special characters in skills as there may be . # like that in skill
//add + and space to be included in skills, there can be comma seprated list so we can use this
//==============================
function CheckSpecialskillCharsWithComma(objname,str)
//==============================
{   
        var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_$# +&,;";
        var allValid = true;
        var obj = document.getElementById(objname);
        checkStr = obj.value;
               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)
                {

                         showErrorMessage(str + " contains some illegal characters" );
                         allValid = false;
                          if(obj.type.charAt(0)!="s")
                               obj.select();
                          else 
                               obj.focus();
                        break;
                }
        }
        return allValid;
}
//==============================
function CheckName(objname,str)
//==============================
{
        var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        var allValid = true;
        var obj = document.getElementById(objname);
        checkStr = obj.value;
        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)
                {

                         showErrorMessage("Please enter valid "+ str);
                         allValid = false;
                          if(obj.type.charAt(0)!="s")
                            obj.select();
                          else 
                            obj.focus();
                        break;
                }
        }
        return allValid;
}

//==============================
function CheckNameWithSpace(objname,str)
//==============================
{
        var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
        var allValid = true;
        var obj = document.getElementById(objname);
        checkStr = obj.value;
        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)
                {

                         showErrorMessage("Please enter valid "+ str);
                         allValid = false;
                          if(obj.type.charAt(0)!="s")
                            obj.select();
                          else 
                            obj.focus();
                        break;
                }
        }
        return allValid;
}

function checkSpace(objName,strMessage)
{
    
    var obj = document.getElementById(objName);
   var str  = obj.value
    if(str=="")
      return true;

    if(str!=null &&(str.indexOf(" ")==0 || str.indexOf(" ")== str.length-1 || str.indexOf("  ")!=-1 ))
    {
      showErrorMessage(strMessage + " no space in start,end and double space");
       if(obj.type.charAt(0)!="s")
            obj.select();
          else 
            obj.focus();
        
      return false;
    }
    else 
        return true;
}
//will remove leading and trailing whitespaces as well as duplicate
function removeWhitspace(objName)
{
   
    var obj = document.getElementById(objName);
    var str  = obj.value
       var temp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (temp.test(str)) { str = str.replace(temp, '$2'); }
   temp = /  /g;
   while (str.match(temp)) { str = str.replace(temp, " "); }
    obj.value = str;
 
}


function isInteger(fieldName,strMessage)
{   
    var obj = document.getElementById(fieldName);
    var s = obj.value;
     
    for (var i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) 
        {
           showErrorMessage("Please enter valid value for "+ strMessage);
           if(obj.type.charAt(0)!="s")
                     obj.select();
               else 
                    obj.focus();
               return false;
        }
    }
    // All characters are numbers.
    return true;
}

function isNumber(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isNumber(s) && s.length >= minDigitsInIPhoneNumber);
}

function validatePhone(fieldName,str)
{
    var obj = document.getElementById(fieldName);
    if(obj.value=="")
         return true
    if(!checkInternationalPhone(obj.value))
    {
        showErrorMessage("Please enter your valid "+ str);
        if(obj.type.charAt(0)!="s")
            obj.select();
         else 
            obj.focus();
                
        return false;
    }
    else
    {
        removeWhitspace(fieldName);
        return true;
    }

}

function validateMaxLength(fieldName,str,length)
{
    var obj = document.getElementById(fieldName);
     if(typeof(obj)!="undefined" && obj!=null)
      {
        if(obj.value.length>length)
        {
             showErrorMessage("Maximum characters allowed for "+ str + " is "+length);
              if(obj.type.charAt(0)!="s")
                obj.select();
             else 
               obj.focus();

            return false;
        }
     }
    return true;
}

// Validate maximum length for items in a list. The delimiter is the
// string that separates list items.
function validateMaxLengthOfListItems(fieldName,str,delimiter,length)
{
    var obj = document.getElementById(fieldName);
    var aAllItems = obj.value.split( delimiter );
    for ( nCount = 0; nCount < aAllItems.length; nCount++ )
    {
      if ( aAllItems[ nCount ].length > length )
      {
        // Set appropriate suffix e.g 1st, 2nd, 3rd, 4th ...
        sNumTemp = nCount + 1;
        if ( sNumTemp%10 == 1 ) sNumTemp += "st";
        else if ( sNumTemp%10 == 2 ) sNumTemp += "nd";
        else if ( sNumTemp%10 == 3 ) sNumTemp += "rd";
        else sNumTemp += "th";

        showErrorMessage( "The " + sNumTemp + " " + str + " is invalid. Maximum characters allowed for a skill is " + length );
        if(obj.type.charAt(0)!="s")
          obj.select();
        else 
          obj.focus();
        return false;
      }
    }
    return true;

}

//validate editor character max length, editor adds some characters 
//to format, but we want actual no of characters added by user.
function validateMaxEditorLength(fieldName,str,length)
{
   var obj = document.getElementById("_" + fieldName + "_editor");

    var contents; 
     if(typeof(obj)!="undefined" && obj!=null)
      {
         if ( obj.tagName.toLowerCase() == 'iframe' )
        {
           var editdoc = obj.contentWindow.document;
           contents = editdoc.body.createTextRange().text;
        }
        else 
        {
         contents = obj.value;
        }
       
         //Filter extraneous text
         
           contents = replaceEditorCharacter(contents);
          if(contents.length>length)
          {
              var oTemp = document.getElementById( "_" + fieldName + "_charcounter_" );
             oTemp.value = contents.length;
             showErrorMessage("Maximum characters allowed for "+ str + " is "+length);
             selectHtmlEditor(fieldName);
            return false;
         }
      }
    return true;
}
//validation for multiple select box specially  for skill and role
//if any of option contains value more then length characters then return false

function validateMultipleSelectLength(fieldName,str,length)
{
    var obj = document.getElementById(fieldName);

    var sVal;
     if(typeof(obj)!="undefined" && obj!=null)
      {
        var opt = obj.options;
           for(var i=0; i<opt.length; i++){
              sVal = opt[i].value;
             
            if(sVal.length>length)
            {
             showErrorMessage("Maximum characters allowed for "+ str + " is "+length);
             obj.focus();
               return false;
            }
            
        }
     }
    return true;
}

function validateMinLength(fieldName,str,length)
{
    var obj = document.getElementById(fieldName);
    if(typeof(obj)!="undefined" && obj!=null)
      {
        if(trim(obj.value)=="")
            return true;
        if(obj.value.length<length)
        {
            showErrorMessage("Minimum characters required for "+ str + " is "+length);
             if(obj.type.charAt(0)!="s")
                 obj.select();
             else 
                 obj.focus();

            return false;
        }
     }
    return true;
}
//instead of alert use this function to show error messages.
//ensure you have div with name of scripterrordiv
//at the place where you want to show error message

function showErrorMessage(sMessage)
{
    var elem = document.getElementById("scripterrordiv");
   
    if(typeof(elem)!="undefined" && elem!=null)
    {
        elem.innerHTML = sMessage;
        //selectDiv(elem);
          
    }

   return;
}

function selectDiv(elem)
{
     var d=document;
     if(d.getElementById ) {
                //select the div
                 if(elem) {
                   if(d.createRange) {
                     var rng = d.createRange();
                     if(rng.selectNodeContents) {
                       rng.selectNodeContents(elem);
                       if(window.getSelection) {
                         var sel=window.getSelection();
                         if(sel.removeAllRanges) sel.removeAllRanges();
                         if(sel.addRange) sel.addRange(rng);
                       }
                     }
                } else if(d.body && d.body.createTextRange) {
                    var rng = d.body.createTextRange();
                    rng.moveToElementText(elem);
                    rng.select();
                  }
                }
              }
              return;
}
//no space allowed for password
function validatespace(fieldName,str)
{
    var obj = document.getElementById(fieldName);
    if(typeof(obj)!="undefined" && obj!=null)
      {
         if(trim(obj.value)=="" )
            return  true;

        if(obj.value.indexOf(" ")>-1)
        {
            showErrorMessage("Spaces are not allowed in "+ fieldName );
            obj.select();
            return false;
        }
     }
    return true;
}

//select html editor text area,
function selectHtmlEditor(fieldName)
{
     var editor_obj = document.all["_" + fieldName + "_editor"];
     var obj = document.getElementById(fieldName);
    
     if(typeof(obj)!="undefined" && obj!=null)
      {
          if ( editor_obj.tagName.toLowerCase() == 'iframe' )
          {
            var editdoc = editor_obj.contentWindow.document;
            editdoc.body.createTextRange().text="";
            editdoc.body.createTextRange().select();
          }
          else
            obj.select();
      }
    return;
}

//this is differnet from first method in sense it will be used to check only htm editor area
//as focus or select on such text area does not work
//check whether a field fullfill all the requirement of a 
//required field, like no white sapce in begnning,end and no conseccutive two white spaces
//the field is not empty if user has put only whitespaces only this will trim and give
//error message 
function checkRequiredEditor(fieldName,Message)
 {
    var sVal = "" ;
    var sTemp;  
    var obj = document.getElementById("_" + fieldName + "_editor");

    if(typeof(obj)!="undefined" && obj!=null)
      {
         if ( obj.tagName.toLowerCase() == 'iframe' )
        {
           var editdoc = obj.contentWindow.document;
           sVal = editdoc.body.createTextRange().text;
        }
        else 
        {
          sVal = obj.value;
        }
     }
   // RT 18094
   // Vijay
   
   sTemp=sVal.replace(/(^ *)|( *$)/gm,"");

   sTemp=escape(sTemp);

   while((sTemp.indexOf("%0D%0A")==0)||(sTemp.lastIndexOf("%0D%0A")!=-1 && sTemp.lastIndexOf("%0D%0A")==(sTemp.length-6)))
       {
        sTemp=sTemp.replace(/(^%0D%0A*)|(%0D%0A*$)/gm,"");
        sTemp=sTemp.replace(/(^%20*)/gm,""); 
       }

   sTemp=unescape(sTemp);

  if(sTemp == "" || sTemp.length == 0 )
    { 
        showErrorMessage(Message+" required");
        editdoc.body.createTextRange().text=sTemp; 
        selectHtmlEditor(fieldName);
        return false;
     }
   else
     { 
    return true;
     }
    
 }

function replaceEditorCharacter(contents)
{
        var temp = /^(\s*)([\W\w]*)(\b\s*$)/;
        if (temp.test(contents)) { contents = contents.replace(temp, '$2'); }
         contents = escape( contents );
          contents = contents.replace( /%0D%0A/gi, "" ); //Win
          contents = contents.replace( /%0D/gi, "" );    //UNIX
          contents = contents.replace( /%0A/gi, "" );    //Mac
          contents = unescape( contents );
          contents = contents.replace( /<.*?>/gi, "" );
          contents = contents.replace( /&.*?;/gi, " " ); //rep one char
          return contents;
}

// RT 16027
// vijay Kumar Verma
// 20/07/2005
// Purpose :To validate skill fields for special characters , only allowed  special characters are
//          .+#&,/ and spaces

 //RT 18386
 // Author : Vijay 
 // Date   : 23/11/2005
 // Purpose :Addition special characters -(hypen),*(asterix) and :(colon) are introduced.
 //          Regular expression is modified form "rex.compile("[^ A-Za-z0-9.+'#&,/]");" to 
 //          rex.compile("[^ A-Za-z0-9.',+&\\/)(#}\\\\[{\\]*:-]");

function validateSpecialChars(objName,str)
{       var bSpValid = false;
        var ckeckSpCharStr;
    
  if(checkRequired(objName,str))
  {
       /*
        ckeckSpCharStr = document.getElementById(objName).value;
        var rex=new RegExp();
        rex.compile("[^ A-Za-z0-9.+'#&,/]");
        var result=rex.exec(ckeckSpCharStr);
        if(result!=null)
            {
                    showErrorMessage(str + " can not contain special characters." );
                    bSpValid = false;
                        
              }
        */
              
       var checkStr;
       var temp;
       var rex=new RegExp();
       rex.compile("[^ A-Za-z0-9.',+&\\/)(#}\\\\[{\\]*:-]");
       checkStr = document.getElementById(objName).value;
       temp=checkStr;         
       if(temp.indexOf("]")!=-1)
       {
       temp=temp.replace( /\]/g, '#' );
       }
       var result=rex.exec(temp);       
       if(result!=null)
         {
          showErrorMessage(str + " can not contain special characters" );
          bSpValid = false;
         }
       
       else
         {
          bSpValid=true;
         }	          
         }     
    return bSpValid;
}

// RT 16027
// vijay Kumar Verma
// 20/07/2005
// Purpose :To validate Surname and Given name fields for special characters , only allowed  special characters
//          are .&' and spaces

       function validateNames(objName,str)
  {
        var bNameValid = false;
        var ckeckNameStr;        
        if(checkRequired(objName,str))
        {
		ckeckNameStr = document.getElementById(objName).value;
        	var rex=new RegExp();
        	rex.compile("[^ A-Za-z0-9.&']");
		
                var result=rex.exec(ckeckNameStr);
                 if(result!=null)
                  {
                    showErrorMessage(str + " can not contain special characters." );
                    bNameValid = false;		   
                    } 
		else
                {
                bNameValid=true;
                }		        
              }
            return bNameValid;
 }


// RT 14814
// vijay Kumar Verma
// 22/09/2005
// Purpose :To validate Skills and Role fields for only JobSearch 

 //RT 18386
 // Author : Vijay 
 // Date   : 23/11/2005
 // Purpose :Addition special characters -(hypen),*(asterix) and :(colon) are introduced.
 //          Regular expression is modified form "rex.compile("[^ A-Za-z0-9_.+$&\/)(#}[{\\\\]]*")" to 
 //          "rex.compile("[^ A-Za-z0-9.+&\\/)(#}\\\\[{\\]*:-]")"

          

function checkJobSearch(objName,str)
{       var bSpValid = true;
        var ckeckSpCharStr;
	var obj = document.getElementById(objName);
        var opt = obj.options;

     for(var i=0;i<opt.length;i++)
        {
        ckeckSpCharStr = opt[i].value;

        var rex=new RegExp();
        //rex.compile("[^ A-Za-z0-9_.+$&\/)(#}[{\\\\]]*");
        rex.compile("[^ A-Za-z0-9.+&\\/)(#}\\\\[{\\]*:-]");
        temp=ckeckSpCharStr;
        if(temp.indexOf("]")!=-1)
       {
       temp=temp.replace( /\]/g, '#' );
       }
       var result=rex.exec(temp);
       if(result!=null)
          {
                showErrorMessage(str + " can not contain special characters" );
                bSpValid = false;
          }
        
	}
        return bSpValid;
}
/*
=======================================================
// RT 29063
// Manish Kumar
// Date :29/01/2007
//To validate the date field
=======================================================
*/

//=======================================================
function isDateValid(fromDate,toDate)
//=======================================================
{
    var FromDate=(document.getElementById(fromDate).value);
    var ToDate=(document.getElementById(toDate).value);
var strSeperator = "/"; 

var mDay = FromDate.substring(0,FromDate.indexOf("/"));
var temp = FromDate.substring(FromDate.indexOf("/")+1,FromDate.length);
var mMonth = temp.substring(0,temp.indexOf("/"));
var mYear = temp.substring(temp.indexOf("/")+1,FromDate.length);
var vFromDate = mMonth+strSeperator+mDay+strSeperator+mYear;

    if(vFromDate == "//")
    { 
    var objFromDate ="";
    }
    else{
        var objFromDate=new Date(vFromDate);
        }

var tDay = ToDate.substring(0,ToDate.indexOf("/"));
var temp = ToDate.substring(ToDate.indexOf("/")+1,ToDate.length);
var tMonth = temp.substring(0,temp.indexOf("/"));
var tYear = temp.substring(temp.indexOf("/")+1,ToDate.length);
var vToDate = tMonth+strSeperator+tDay+strSeperator+tYear;

    if(vToDate == "//")
    { 
    var objToDate ="";
    }
    else{
        var objToDate=new Date(vToDate);
        }

if(objFromDate == "" && objToDate == "")
        {                
            return true;
        }

if(objFromDate != null && objToDate == "")
        {                
            showErrorMessage("Enter a valid Date Range.");
            return false;
        }
if(objToDate != null && objFromDate == "")
        {
            showErrorMessage("Enter a valid Date Range.");
            return false;
        }
   
    if (objFromDate!=null && objToDate!=null)
    {  
       if (objFromDate>objToDate)
        {
            showErrorMessage("DateClosingFrom value must be less than DateClosingTo.");
            return false;
        }                       
     }
        
    return true;

}
