function changeUsaState(selObj){
	if(selObj.options[selObj.selectedIndex].value != ""){
		window.location = "/" + selObj.options[selObj.selectedIndex].value.toLowerCase() + "/";
	}
}

/**
 * Set cookie
 */
function setCookie(c_name, value, expiredays){
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate) + ";path=/";
	return true;
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start = document.cookie.indexOf(c_name + "=");
		if(c_start!=-1){ 
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf(";", c_start);
			if(c_end==-1){
				c_end = document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return null;
}

function showAddProfessorTbl(){
	var tblObj = document.getElementById('add_professor_tbl');
	var ua = window.navigator.userAgent.toLowerCase();
	if (ua.indexOf('msie') != -1)
	{
		tblObj.style.display = (tblObj.style.display=='none' || tblObj.style.display=='')?'inline':'none';
	} else {
		tblObj.style.display = (tblObj.style.display=='none' || tblObj.style.display=='')?'table':'none';
	}
}

function showAddSchoolTbl(){
	var tblObj = document.getElementById('add_professor_tbl');
	var ua = window.navigator.userAgent.toLowerCase();
	if (ua.indexOf('msie') != -1)
	{
		tblObj.style.display = (tblObj.style.display=='none' || tblObj.style.display=='')?'inline':'none';
	} else {
		tblObj.style.display = (tblObj.style.display=='none' || tblObj.style.display=='')?'table':'none';
	}
}

function checkCharCnt(txtObj){
	if(txtObj.value.length >= 1000){
		alert('1000 Chars limit!!!');
		txtObj.value = txtObj.value.substr(0, 999);
	}
}

function setCheckBoxesIn(frmId){
	var frmObj = document.getElementById(frmId);
	for(i = 0; i < frmObj.elements.length; i++){
		if(frmObj.elements[i].type.toLowerCase() == 'checkbox'){
			frmObj.elements[i].checked = !frmObj.elements[i].checked;
		}
	}
}
