function openJob(lnk,w,h) {
	window.open("job_popup.php?id="+lnk, "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}
function openWin(lnk) {
	window.open(lnk, "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width=500, height=300");
}

function openFakeJob(lnk,w,h) {
	window.open("job_popup.php?id="+lnk, "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}

function openSendToFriends(lnk,w,h) {
	window.open("job_send.php?id="+lnk, "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}

function openSendCV(lnk,w,h) {
	window.open("cv_send.php?id="+lnk, "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}

function openCVPic(w,h) {
	window.open("cvpic_popup.php", "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}
function openLogo(w,h) {
	window.open("logo_popup.php", "", "toolbar=no, resizable=yes, menubar=no, scrollbars=yes, location=no, width="+w+", height="+h);
}

function checkVIPs(selOption) {
        checkBoxObj = document.getElementById("jobType");
	if(catsVIP[selOption.value]>=maxVIPperCat) {
		//alert("error");
	   if(checkBoxObj.disabled==false) {
		checkBoxObj.disabled=true;
		document.getElementById("jobTypeCatLimit").style.display="";
	   }
	} else {
		checkBoxObj.disabled=false;
		document.getElementById("jobTypeCatLimit").style.display="none";
	}
}

function checkSearchForm() {
	var argv = checkSearchForm.arguments;
	var query = document.getElementById("query");
	var ind = document.getElementById("ind");
	var loc = document.getElementById("loc");
	if(argv[0] == '1') {
		var sal = document.getElementById("sal");
		if(is_empty(query) && is_empty(ind) && is_empty(loc) && is_empty(sal))
			return false;
		else
			return true;
	} else {
		if(is_empty(query) && is_empty(ind) && is_empty(loc) )
			return false;
		else
			return true;
	}
}

function is_empty(vobj) {
		if (vobj.value) {
			stripBlanks(vobj);
		}
		var marker=false;
		if (!vobj) marker=true;
		if (!vobj.value) marker=true;
		if (vobj.value==null) marker=true;
		if (vobj.value=="") marker=true;
		return marker;
}

function stripBlanks(field) {
	
		// regExp to match leading blanks
		var reStartBlanks = /^\s*/;
		// regExp to match trailing blanks
		var reEndBlanks = /\s*$/;
			
		// replace contents of specified form field with the current value
		// with leading, then trailing blanks replaced with empty string.
		field.value = field.value.replace(reStartBlanks,"");
		field.value = field.value.replace(reEndBlanks,"");
}

function goHome() {
	location.href='index.php';
}

function xeml(user,host){
 var x ="<a href='mai"+"lto:"+user+"&#64;"+host+"'>"+user+"&#64;"+host+"</a>";
 document.write(x);
}


function toggleView(divId) {
	var divObj = document.getElementById(divId);
	if(divObj.style.display=="none") {
		divObj.style.display="";
	} else {
		divObj.style.display="none";
	}
	
}

	function selectLang(xval) {
		var today = new Date();
		var expires = new Date();
		// valid for 1 year
  		expires.setTime(today.getTime() + 24*365*3600000);
		document.cookie="hrlang="+xval+"; expires=" + expires.toGMTString();
		//alert(location.href);
		location.href="/";	
		//window.location.reload();
		//location.href='change_language.php';
		//history.go(0);
	}

	function selectRussian() {
		selectLang("ru");
	}

	function selectRomanian() {
		selectLang("0");
	}
	function selectEnglish() {
		selectLang("en");
	}



