	


		
	
	function BackToMyJobList(){
	
	//alert("111");
	document.forms[0].action="myCompanyAllJob.do?mode=all";
document.forms[0].submit();

	
	}

	
	function  selfClose(){

window.returnValue = "anonymousGetProfileInfo.do?mode=profile";
self.close();



}


function saveCarriageReturn(str) {
//get rid of carriage returns so we only have to work with line feeds
str = str.replace(/\r/g, "<br>");
//remove all trailing spaces from each line
while (/\s\n/.test(str)) {
str = str.replace(/\s\n/g, "\n");
}
//remove all consecutive newline characters
while (/\n\n/.test(str)) {
str = str.replace(/\n\n/g, "\n");
}
//alert(str);
return str;
}

		
		
		function addAppraise (referenceUserID) {
		
		var finalAppraiseScreen = window.showModalDialog('appraise.do?referenceUserID='+referenceUserID,'Appraise','dialogWidth:500px;dialogHeight:200px;center=yes'); 
	
		//alert (finalAppraiseScreen);
		document.forms[0].action=finalAppraiseScreen;
		document.forms[0].submit();
	//	self.document.location.reload(true); 


		
		
		}
	
	
	
	
	function backToMyProfile(){
	document.forms[0].action="anonymousGetProfileInfo.do?mode=profile";
document.forms[0].submit();

	
	}


function checkAllNew() {
	
	 var countCheckBoxes = document.forms[0].chbx.length;

	// alert("countCheckBoxes="+countCheckBoxes);
	 //	 if(countCheckBoxes=="undefined"){
	 //alert("1111111");
	 
	// }
   for (i=1;i<countCheckBoxes;i++) {
		
     document.forms[0].chbx[i].checked=document.forms[0].chbx1.checked; 
     }
   }


function checkAll(check) {
	
	 var countCheckBoxes = document.forms[0].chbx.length;

	// alert("countCheckBoxes="+countCheckBoxes);
	 //	 if(countCheckBoxes=="undefined"){
	 //alert("1111111");
	 
	// }
   for (i=1;i<countCheckBoxes;i++) {
		
     if (check) { 
        document.forms[0].chbx[i].checked=true;
        }
     else {
        document.forms[0].chbx[i].checked=false; 
        }
     }
   }


function copyToList(from,to)
	{

	//alert(from);
	//alert(to);
	fromList = eval("document.forms[0]." + from);
	toList = eval("document.forms[0]." + to);
//	alert(fromList);
	//alert(toList);
	if (toList.options.length > 0 && toList.options[0].value == 'temp')
	{
	toList.options.length = 0;
	}
	var sel = false;
	for (i=0;i<fromList.options.length;i++)
	{
	var current = fromList.options[i];
	if (current.selected)
	{
	sel = true;
	if (current.value == 'temp')
	{
	alert ('You cannot move this text!');
	return;
	}
	txt = current.text;
	val = current.value;
	
	//var ret = window.showModalDialog('enterExpCourse.do','enterExpCourse','dialogWidth:400px;dialogHeight:100px;center=yes'); 
	//txt = txt+ "("+ ret +")";

//	val = val+ "-"+ret;
	
	toList.options[toList.length] = new Option(txt,val);
	fromList.options[i] = null;
	i--;
	}
	}
	if (!sel) alert ('You haven\'t selected any options!');
	}

function copyToExpList_1(from,to)
	{

	//alert(from);
	//alert(to);
	fromList = eval("document.forms[0]." + from);
	toList = eval("document.forms[0]." + to);
//	alert(fromList);
	//alert(toList);
	if (toList.options.length > 0 && toList.options[0].value == 'temp')
	{
	toList.options.length = 0;
	}
	var sel = false;
	for (i=0;i<fromList.options.length;i++)
	{
	var current = fromList.options[i];
	if (current.selected)
	{
	sel = true;
	if (current.value == 'temp')
	{
	alert ('You cannot move this text!');
	return;
	}
	txt = current.text;
	val = current.value;
	
	//var ret = window.showModalDialog('enterExpCourse.do','enterExpCourse','dialogWidth:400px;dialogHeight:100px;center=yes'); 
	txt = txt.substring(0,txt.lastIndexOf('('));

	val = val.substring(0,val.lastIndexOf('('));
	
	toList.options[toList.length] = new Option(txt,val);
	fromList.options[i] = null;
	i--;
	}
	}
	if (!sel) alert ('You haven\'t selected any options!');
	}


function copyToExpList(from,to)
	{

	//alert(from);
	//alert(to);
	fromList = eval("document.forms[0]." + from);
	toList = eval("document.forms[0]." + to);
//	alert(fromList);
	//alert(toList);
	if (toList.options.length > 0 && toList.options[0].value == 'temp')
	{
	toList.options.length = 0;
	}
	var sel = false;
	for (i=0;i<fromList.options.length;i++)
	{
	var current = fromList.options[i];
	if (current.selected)
	{
	sel = true;
	if (current.value == 'temp')
	{
	alert ('You cannot move this text!');
	return;
	}
	txt = current.text;
	val = current.value;
	
	var ret = window.showModalDialog('enterExpCourse.do','enterExpCourse','dialogWidth:400px;dialogHeight:100px;center=yes'); 
	txt = txt+ "("+ ret +")";

	val = val+ "("+ ret +")";
	
	toList.options[toList.length] = new Option(txt,val);
	fromList.options[i] = null;
	i--;
	}
	}
	if (!sel) alert ('You haven\'t selected any options!');
	}

	function bodyload(){
		var stateIndex;
		stateIndex=document.forms[0].state.selectedIndex;
		stateID=document.forms[0].state.options[stateIndex].value;
	
	//alert("onbodyload"+stateID);
//	showCity(stateID);

	
	}

function uniquEMailMethods(){

uniqueLoginStatus(document.forms[0].emailAddress.value);

}


function uniqueLoginMethods(){

uniqueLoginStatus(document.forms[0].loginName.value);

}

function uniqueEmailIDMethods(){

//alert("1111");
uniqueLoginStatus(document.forms[0].emailId.value);

}


function progressBar(){
//alert("progressBar");

var innerHTML = "<img src='images/progressBar.gif' alt='Campus Oxide Logo' width='30' height='30' />";

	var divObj = document.getElementById("uniqueLogin");

	divObj.innerHTML  = innerHTML;	

//uniqueLoginStatus(document.forms[0].emailAddress.value);


}



function saveCarriageReturn(str) {
//get rid of carriage returns so we only have to work with line feeds
str = str.replace("<br>", "");
str = str.replace(/\r/g, "<br>");
str = str.replace("<br><br>", "<br>");
//remove all trailing spaces from each line
while (/\s\n/.test(str)) {
str = str.replace(/\s\n/g, "\n");
}
//remove all consecutive newline characters
while (/\n\n/.test(str)) {
str = str.replace(/\n\n/g, "\n");
}
//alert(str);
return str;
}


function logout(){

		
		document.forms[0].action="logout.do";
		document.forms[0].submit();

}


function BackToLogin(){

		
		document.forms[0].action="login.do";
		document.forms[0].submit();

}



function getProfileInfo(){

		//alert("getProfileInfo");
		document.forms[0].action="anonymousGetProfileInfo.do?mode=profile";
		document.forms[0].submit();

}


function pause(numberMillis) 
{
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) 
{
now = new Date();
if (now.getTime() > exitTime)
return;
}
} 




function submitMeetUs(){
		document.forms[0].action="meetUs.do";
		document.forms[0].submit();
}


function submitNewsAlert(){
		document.forms[0].action="newsAlertMore.do";
		document.forms[0].submit();
}


function searchCampusOxide(){

		document.forms[0].action="SearchEngine.do?oe=english&q="+document.forms[0].q.value;
		document.forms[0].submit();

}


function submitCollegeNews(){
		document.forms[0].action="collegeNews.do";
		document.forms[0].submit();
}





function isName(fieldValue, fieldName)
{
if (fieldValue.match(/^[a-zA-Z]([a-zA-Z\s]*)$/))
{
return true;
}
else
{
alert("Please enter alphabetic character  and space only for "+fieldName);
return false;
} 
}



// check to see if input is alphabetic



function isAlphabetic(fieldValue, fieldName)
{
if (fieldValue.match(/^[a-zA-Z]+$/))
{
return true;
}
else
{
alert("Please enter alphabetic character only for "+fieldName);
return false;
} 
}

// check to see if input is alphanumeric
function isAlphaNumeric(fieldValue, fieldName)
{
if (fieldValue.match(/^[a-zA-Z0-9]+$/))
{
return true;
}
else
{
	alert("Please enter alphanumeric character only for "+fieldName);
return false;
} 
}


// check to see if input is alphanumeric
function isAlphaNumeric(val)
{
if (val.match(/^[a-zA-Z0-9]+$/))
{
return true;
}
else
{
return false;
} 
}


// check to see if input is a valid email address
function isEmailAddress(val)
{
if (val.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
{
return true;
}
else
{
return false;
} 
}











function trimAll(sString) 
{ 
//alert("You are in trimAll="+sString);
while (sString.substring(0,1) == ' ') 
{ 
sString = sString.substring(1, sString.length); 
} 
while (sString.substring(sString.length-1, sString.length) == ' ') 
{ 
sString = sString.substring(0,sString.length-1); 
} 
return sString; 
} 


/*
function emailValidation(fieldValue)
{

 if (fieldValue.length >0) {
	 i=fieldValue.indexOf("@");
	
	 j=fieldValue.indexOf(".",i);
	 
	 k=fieldValue.indexOf(",");
	 
	 kk=fieldValue.indexOf(" ");
	 
	 jj=fieldValue.lastIndexOf(".")+1;
	
	  
	 len=fieldValue.length;

	  


	 	if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2)) {
 	}
 	else {
 		alert("Please enter an exact email address.\n" +
		fieldValue + " is invalid.");
		return false;
 	}

 }

 return true;


}
*/

function emailValidation(fieldValue) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(fieldValue)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}


function specialCharValidation(fieldName){


//var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
var iChars = "!@#$%^&*()+[]';/{}|\"<>?";

  for (var i = 0; i < fieldValue.length; i++) {
  	if (iChars.indexOf(fieldValue.charAt(i)) != -1) {
  	alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again.");
  	return false;
  	}
  }



}






function alertAllChar(fieldname){
//alert on finding all letters
    var noalpha = /^[a-zA-Z]*$/;
if (noalpha.test(fieldValue)) {
     alert("Please enter at least one number in the \"username\" field.");
     return false;
}
}


function alertAllNumber(fieldname){
//alert on finding all numbers
var nonums = /^[0-9]*$/;
if (nonums.test(fieldValue)) {
     alert("Please enter at least one letter in the \"username\" field.");
     return false;
}
 
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }





//Remove special characters from a string.
function clearText(fieldname) {
     fieldValue=filterNum(fieldValue)

     function filterNum(str) {
          re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
          // remove special characters like "$" and "," etc...
          return str.replace(re, "");
     }
}

//Detect special characters in text box. Or any character you subsitute for the special characters.
function specialChar(fieldValue){

//alert("fieldValue in specialChar="+fieldValue);
//var iChars = "!@#$%^&*()+[]';/{}|\"<>?";
 var iChars = "!@#$%^&*{}";
        for (var i = 0; i <fieldValue.length; i++) {
                if (iChars.indexOf(fieldValue.charAt(i)) != -1) {
               
                return false;
        }
                }
	return true;
   

}


function mandatoryValidation(fieldValue, fieldName){
if (trimAll(fieldValue).length == 0) {
          alert("Please enter " + fieldName);
	  return false;
     }
	return true;
}
function isValidURL(url){ 
  // alert("in valid URL");
//	var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; 
    
	//var RegExp = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");

	var RegExp =/http:\/\/[A-Za-z0-9\.-]{1,}\.[A-Za-z]/;

	if(RegExp.test(url)){ 
      //  alert("111111111111");
		return true; 
    }else{ 
		alert("Invalid URL, Please enter valid URL (like http://www.campusoxide.com)");
        return false; 
    } 
} 
function specialChar1(fieldValue, fieldName){

//alert("fieldValue in specialChar="+fieldValue);
 //var iChars = "!@#$%^&*()+=-[]\\\';./{}|\":<>?";
 var iChars = "!@#$%^&*+[];{}|\"<>?";
        for (var i = 0; i <fieldValue.length; i++) {
                if (iChars.indexOf(fieldValue.charAt(i)) != -1) {
               alert("Special character is not allowed in "+ fieldName);
                return false;
        }
                }
	return true;
   

}

function specialChar_job(fieldValue, fieldName){

//alert("fieldValue in specialChar="+fieldValue);
 //var iChars = "!@#$%^&*()+=-[]\\\';./{}|\":<>?";
 var iChars = "<>";
        for (var i = 0; i <fieldValue.length; i++) {
                if (iChars.indexOf(fieldValue.charAt(i)) != -1) {
               alert("Special character is not allowed in "+ fieldName);
                return false;
        }
                }
	return true;
   

}



function lengthValidation(fieldValue, fieldName, length)
{
//alert("lengthValidation");
if (trimAll(fieldValue).length>parseInt(length)){
alert( fieldName + " should not exceed "+ length + " character");
return false;
}

return true;


}

function lengthValidation(fieldValue, fieldName, length)
{
//alert("lengthValidation");
if (trimAll(fieldValue).length>parseInt(length)){
alert( fieldName + " should not exceed "+ length + " character");
return false;
}

return true;


}



function isStrongPassword(fieldValue, fieldName) 
{

  // var control = document.form1.password;
   var myString= fieldValue; 


   var Stringlen = myString.length;
   var ValidateDigits = /[^0-9]/g;
   var ValidateSpChar = /[a-zA-Z0-9]/g;
   var ValidateChar = /[^a-zA-Z]/g;

   var digitString = myString.replace(ValidateDigits , "");
   var specialString = myString.replace(ValidateSpChar, "");
   var charString = myString.replace(ValidateChar, "");

   if(Stringlen < 8)
   {
   alert("Password must be at least 8 characters");
 //  control.value="";
 //  control.focus();
   return false;
   }

      if(Stringlen > 15)
   {
   alert("Password should not exceed then 15 characters");
 //  control.value="";
 //  control.focus();
   return false;
   }

   if(specialString < 1)
   {
   alert("Password must include at least 1 special (#,@,&,$ etc) characters");
 //  control.value="";
  // control.focus();
   return false;
   }
   if(digitString == "")
   {
   alert("Password must include at least 1 numeric characters");
//   control.value="";
   //control.focus();
   return false;
   }
   return true;
} 


