var google_map_api_key = 'ABQIAAAAb6cY3zD5FoJyi8T3wZVFyhRtKAv77f1-rPNvQpwFyBZxJefe-RTe5Y7-G8B3rLqyFA1VH3LVW-4ioA';
var curTdID;
function fncallList(dv,par,ml) 
{ 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search_filter.php?content=' + dv + '&ml=' + ml + '&par=' + par, dv, 'Please Wait...', 'Error'); 
} 

function fncalltemplate(dv,par,dispagent) 
{ 
	if(dispagent==false)
		dispagent=0;
	else if(dispagent==true)
		dispagent=1;
	
	if(dv=="getalertDiv"){
		obj_other = document.getElementById("savesearchDiv"); 
		if(obj_other){
			obj_other.style.display="none";
			obj_other.innerHTML="";
		}
	}else if(dv=="savesearchDiv"){
		obj_other = document.getElementById("getalertDiv"); 
		if(obj_other){
			obj_other.style.display="none";
			obj_other.innerHTML="";
		}
	}
	obj = document.getElementById(dv); 
	if(obj.innerHTML!="" && dv!="ask_password" && dv!="check_password" && dv!="get_subscribed_user" && dv!="DivRemoveall"){
		obj.innerHTML="";
		obj.style.display='none';
		document.getElementById("inProgress").style.display = "none";
	}else{
		if(dv=="get_subscribed_user")
			obj.innerHTML="";
		callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + '&par=' + par + '&dispagent=' + dispagent, dv, 'Please Wait...', 'Error'); 
	}
} 
function fnPostKeyword(par){
	kw = document.getElementById("otsisona").value;
	if(kw){
		if(kw.indexOf(".html"))
			document.location='http://www.cvonline.hu' + par + '/o-' + kw + '.html';
		else
			document.location='http://www.cvonline.hu' + par + 'o-' + kw + '.html';
	}else
		document.location='http://www.cvonline.hu' + par;
	return false;
}
function fncallSaveSearch(name,dv,par) 
{ 
	obj = document.getElementById(dv);

	// convert value to urf for IE	
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	if (browser=="Microsoft Internet Explorer" && 0)
		name = Utf8.encode(name);

	str = '&par=' + par + '&name=' + encodeURI(name);
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + str , dv, 'Please Wait...', 'Error'); 
} 

function fncallRemoveSaveSearch(name,dv,par) 
{ 
	obj = document.getElementById(dv); 
	str = '&par=' + par + '&name=' + name + '&page=' + '';
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + str , dv, 'Please Wait...', 'Error'); 

	obj_tr = document.getElementById("tr" +par); 
	if(obj_tr){
		obj_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer1" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
	objexpand_tr = document.getElementById("trexpand" +par); 
	if(objexpand_tr){
		objexpand_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer2" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer3" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
} 

function fnCallRemoveAllSavedjobs(dv) 
{ 
	obj_all = document.getElementById("DivRemoveall"); 
	obj_all.style.display="none";
	
	obj_all = document.getElementById("DivRemovedall"); 
	obj_all.style.display="block";
	
	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv , dv, 'Please Wait...', 'Error'); 
} 

function fnCallRemoveAllViewedjobs(dv) 
{ 
	obj_all = document.getElementById("DivRemoveall"); 
	obj_all.style.display="none";

	obj_all = document.getElementById("DivRemovedall"); 
	obj_all.style.display="block";

	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv , dv, 'Please Wait...', 'Error'); 
} 

function fncallRemoveViewedList(name,dv,par) 
{ 
	obj = document.getElementById(dv); 
	str = '&par=' + par + '&name=' + name + '&page=' + '';
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + str , dv, 'Please Wait...', 'Error'); 

	obj_tr = document.getElementById("tr" +par); 
	if(obj_tr){
		obj_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer1" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
	objexpand_tr = document.getElementById("trexpand" +par); 
	if(objexpand_tr){
		objexpand_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer2" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
	objspacer_tr = document.getElementById("trspacer3" +par); 
	if(objspacer_tr){
		objspacer_tr.style.display="none";
	}
} 

function fncallgetViewedjobadsNumber(dv,par) 
{ 
	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + '&par=' + par, dv, 'Please Wait...', 'Error'); 
} 

function fncallgetEmailAlertsNumber(dv,par) 
{ 
	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + '&par=' + par, dv, 'Please Wait...', 'Error'); 
} 

function fncallgetSavedjobadsNumber(dv,dv1) 
{ 
	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv, dv, 'Please Wait...', 'Error'); 

	if(dv1){
		obj = document.getElementById(dv1); 
		obj.innerHTML="</br><strong>Job saved!</strong>";
	}
} 
function fncallgetSavedsearchesNumber(dv,dv1) 
{ 
	obj = document.getElementById(dv); 
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv, dv, 'Please Wait...', 'Error'); 

	if(dv1){
		obj = document.getElementById(dv1); 
		obj.innerHTML="<b>Search Saved!</b>";
		
		fncalltemplate('searchesDiv');
	}
} 

function setLoadingImage(dv){
	if (typeof window.pageYOffset == "number") 
		scrollY = window.pageYOffset;
	else if (document.documentElement && document.documentElement.scrollTop)
		scrollY = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop)
		scrollY = document.body.scrollTop;
	else if (window.scrollY) 
		scrollY = window.scrollY;
	else scrollY=0;

	y = scrollY;
	
	if(document.getElementById(dv))
		document.getElementById(dv).style.display = "block";
//	document.getElementById(dv).style.top = 295 + "px";
//	document.getElementById(dv).style.left = 250 + "px";
}

function fnputdiv(event,dv,location,setDiv)
{
	if( typeof( window.pageYOffset ) == 'number' ) 
	{
		scrollY = window.pageYOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
	{
		scrollY = document.body.scrollTop;
	}
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
	{
		scrollY = document.documentElement.scrollTop;
	}
	else
		scrollY = 0;

	if(window.event){
		x = window.event.clientX;
		y = window.event.clientY + scrollY;
	}
	else if(event){
		//Firefox
		x = event.pageX;
		y = event.pageY;
	}

	if(setDiv){
		document.getElementById(setDiv).style.display = "block";
		document.getElementById(setDiv).style.top = y + "px";
		document.getElementById(setDiv).style.left = x+50 + "px";
	}else{

		document.getElementById("GoogleMapDiv").style.visibility = "visible";
		document.getElementById("AddressDiv").style.visibility = "visible";
		document.getElementById("mapDiv").style.visibility = "visible";
		document.getElementById("map").style.visibility = "visible";

		yWithScroll = getBodyHeight();
		xWithScroll = getBodyWidth();

		$('mapDiv').style.left = "0px";
		$('mapDiv').style.top = "0px";
		$('mapDiv').style.width = xWithScroll + "px";
		$('mapDiv').style.height = yWithScroll + "px";

		screentH = getScreenHeight();
		screentW = getScreenWidth();

		h = 1500 + scrollY;
		t = 20 + scrollY;

		if(t>30)
			decreaseby = 0;
		else
			decreaseby = 25;

		document.getElementById("GoogleMapDiv").style.height = ((screentH*70)/100) - (50+decreaseby) + 'px';
		document.getElementById("AddressDiv").style.height = ((screentH*70)/100) - (50+decreaseby) + 'px';
		document.getElementById("map").style.height = ((screentH*70)/100)-(60+decreaseby) + 'px';

		if (window.innerHeight && window.scrollMaxY) {
			document.getElementById("map").style.left = 260 + 'px';
		}

		xformWidth = $('GoogleMapDiv').style.width;
		$('GoogleMapDiv').style.left = (screentW/2 - parseInt(xformWidth)/2) + 'px';

		if(t>30){
			document.getElementById("GoogleMapDiv").style.top = t + 'px';
		}else
			document.getElementById("GoogleMapDiv").style.top = '75px';


		addresses_1 = location.split("//");
		addresses = addresses_1[0].split("|");
		addresses = addresses.getUniqueValues();
		addressHtml = '<table width="100%" cellspacing="2" cellpadding="2"><tr><td colspan="2" align="left" style="background-image:url(http://files.cvonline.hu/ln_images/icons/bg_interfaceMenu.gif)" class="interfaceMenuB">Map Results:</td></tr><tr><td><table width="100%" cellpadding="0" cellspacing="0"><tr><td colspan="2"><div id="div_map_address">';
		for(i=0;i < addresses.length;i++){
			if(addresses[i]!=''){
				addressHtml = addressHtml + '<tr><td width="10"  style="background-image:url(http://files.cvonline.hu/ln_images/icons/td_bgr_A.gif)"><a class="interface" href="javascript:void(0);" onclick="javascript:changeBG(\'td_marker'+ i +'\');GEvent.trigger(marker' + i + ', \'click\');"><img src="http://files.cvonline.hu/ln_images/icons/mapPointer.png"></a></td><td id="td_marker'+ i +'" align="left"  style="background-image:url(http://files.cvonline.hu/ln_images/icons/td_bgr_A.gif)"><div id="div_map_address' + i + '"><a class="interface" href="javascript:void(0);" onclick="javascript:changeBG(\'td_marker'+ i +'\');GEvent.trigger(marker' + i + ', \'click\');">' + addresses[i].replace(/\+/gi,' ') + '</a></div></td></tr>';
			}
		}
		addressHtml = addressHtml + '</div></td></tr></table></td></tr></table>';
		document.getElementById("AddressDiv").innerHTML = addressHtml;

		callAHAH('http://www.cvonline.hu/search/map_new.php?location=' + location, dv, 'Please Wait...', 'Error'); 
	}
}

function changeBG(tdID){
	if(curTdID){
		document.getElementById(curTdID).style.backgroundImage="url(http://files.cvonline.hu/ln_images/icons/td_bgr_A.gif)";
	}
	curTdID = tdID;
	document.getElementById(curTdID).style.backgroundImage="url(http://files.cvonline.hu/ln_images/icons/td_bgr_B.gif)";
}


function fnputdiv_message(event,dv,location){
	if(window.event){
		//IE
		if (typeof window.pageYOffset == "number") scrollY = window.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
		scrollY = document.documentElement.scrollTop;
		else if (document.body && document.body.scrollTop)
		scrollY = document.body.scrollTop;
		else if (window.scrollY) scrollY = window.scrollY;
		else scrollY=0;

		x = window.event.clientX;
		y = window.event.clientY + scrollY;
	}
	else if(event){
		//Firefox
		x = event.pageX;
		y = event.pageY;
	}	

	if(x>650){
		x = x - 220;
	}

	document.getElementById(dv).style.visibility = "visible";
	document.getElementById(dv).style.top = y + "px";
	document.getElementById(dv).style.left = x + "px";
}
function closeMessage(dv){
	document.getElementById(dv).style.visibility="hidden";
}

function fnHideShowDiv(dv,imgdv){
	obj = document.getElementById(dv);
	objImg = document.getElementById(imgdv);

	if(obj.style.display=="block"){
		obj.style.display="none";
		objImg.src='http://files.cvonline.hu/ln_images/icons/plus.gif';
	}else{
		obj.style.display="block";
		objImg.src='http://files.cvonline.hu/ln_images/icons/minus.gif';
	}
}

function closeMe(){
	document.getElementById("mapDiv").style.visibility="hidden";
}

function fnCallSearchDelete(id,dv){
	obj = document.getElementById("inProgress"); 
	if(obj)
		obj.style.display="block";

	obj = document.getElementById(dv); 
	if(!obj){
		obj = document.getElementById("searchesDiv");
		dv1 = "searchesDiv";
	}else{
		dv1 = dv;
	}
	callAHAH('http://www.cvonline.hu/new_tp/tp_search.php?content=' + dv + '&id=' + id + '&par=' + dv1, dv1, 'Please Wait...', 'Error'); 
}

function fnHideDisplay(dv,disp){
	obj = document.getElementById(dv);
	obj_more = document.getElementById(dv + '_more');
	obj_less = document.getElementById(dv + '_less');
	obj.style.display=disp;

	if(disp=="block"){
		obj_more.style.display="none";
		obj_less.style.display="block";
	}else{
		obj_more.style.display="block";
		obj_less.style.display="none";
	}
}

function fnLoginUser(username,pass,search,title,path){
	document.location= 'http://' + 'www.cvonline.hu/seeker/login_user.php?use_name=' + username + '&user_pass=' + pass + '&search=' + search + '&title=' + title + '&path=' + path ;
}

function fnValidate(frm){
	if(!Validate_Email_Address(frm.alert_epost.value)){
		return false;
	}
	return true;
}

function Validate_Email_Address(str)
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }
	var arr1=str.split(at);
	 str1=arr1[0];
	 str2=arr1[1];
	 
	 var arr2;
	 arr2=str2.split(dot);
	 str3=arr2[0];
	 str4=arr2[1];
	 
	 var result=str4.length	
	 
	 if(result <2)
	 return false;
		 
	 return true					
 }

function fnValidateSaveSearch(frm){
	if(frm.otsisona.value==""){
		alert("Kérjük, írja be a keresés nevét.");
		return false;
	}else if(frm.otsisona.value.length<4){
		alert("A keresés neve legalább 4 karakter!");
		return false;
	}
	return true;
}

function fnHideOtherDivs(){
	obj = document.getElementById("check_password");
	if(obj)
		obj.style.display="none";
	obj = document.getElementById("ask_password");
	if(obj)
		obj.style.display="none";
	obj = document.getElementById("save_alert");
	if(obj)
		obj.style.display="none";
}

function fnCallSavedJobadsList(pg){
	var page=parseInt('');

	if(pg){
		page=page-1;
		if(page<0)
			return false;
	}
	if(page || page==0){
		var requestJobList = new ajaxObject('http://www.cvonline.hu/new_tp/tp_search.php?content=DivRemoveall&par=savedjobs' + '&page=' + page,'','DivRemoveall','savedjobs');
		requestJobList.update('content=DivRemoveall&par=savedjobs' + '&page=' + page,'$_GET');
	}
}
function fnCallViewedJobadsList(pg){
	var page=parseInt('');
	if(pg){
		page = page-1;
		if(page<0)
			return false;
	}
	if(page || page==0){
		var requestJobList = new ajaxObject('http://www.cvonline.hu/new_tp/tp_search.php?content=DivRemoveall&par=viewedjobs' + '&page=' + page,'','DivRemoveall','viewedjobs');
		requestJobList.update('content=DivRemoveall&par=viewedjobs' + '&page=' + page,'$_GET');
	}
}

var isSearchTimerSet;
var userClickedTimes;
var GotToLocation;
isSearchTimerSet=0;
userClickedTimes=0;
function selectFilterCheckbox(index,paramString,categorySelected,onclk){
	var the_inputs=document.getElementsByTagName("input");
	var the_textfields=new Array();
	var val;

	if(paramString && paramString!=undefined)
		GotToLocation = paramString;
	
	for(var n=0;n<the_inputs.length;n++){
		if((the_inputs[n].type=="checkbox" || the_inputs[n].type=="radio") && the_inputs[n].name!="agent"){
			if(onclk==undefined){ 
				if(the_inputs[n+index].checked==false){
					the_inputs[n+index].checked=true;
					userClickedTimes++;
				}else{
					the_inputs[n+index].checked=false;
					userClickedTimes--;
				}
			}else{
				if(the_inputs[n+index].checked==false){
					userClickedTimes++;
				}else{
					userClickedTimes--;
				}
			}
			if(categorySelected!="" && categorySelected!=undefined){
				document.location = GotToLocation;
				return true;
			}
			if(!isSearchTimerSet)
				setTimeout("fnSubmitSearch()", 2000);
			return true;
		}
	}
}

function fnSubmitSearch(){
	if(!userClickedTimes){
		return false;
		isSearchTimerSet=0;
	}
	if(userClickedTimes==1 || userClickedTimes==-1){
		if(!GotToLocation.match(/\d+/))
			document.location = GotToLocation;
		else
			document.FilterSearchForm.submit();
		return true;
	}else{
		document.FilterSearchForm.submit();
	}
}

function fnInvertVisibility(curElement,val,oppElement){
	if(val==true){
		document.getElementById(curElement).disabled=false;
		document.getElementById(oppElement).disabled=true;
	}
}

function fnCallForgotPasswordForm(keel) 
{ 
	yWithScroll = getBodyHeight();
	xWithScroll = getBodyWidth();

	document.all["passwordLoad"].style.left = "0px";
	document.all["passwordLoad"].style.top = "0px";
	document.all["passwordLoad"].style.width = xWithScroll + "px";
	document.all["passwordLoad"].style.height = yWithScroll + "px";

	xformWidth = document.all["fpasswordForm"].style.width;
	xScreen = getScreenWidth();
	document.all["fpasswordForm"].style.left = (xScreen/2 - parseInt(xformWidth)/2) + 'px';

	document.all["passwordLoad"].style.visibility='visible';
	document.all["inProgress"].style.display='block';
	document.all["fpasswordForm"].style.visibility='visible';

	document.all["fpasswordForm"].innerHTML='';

	var myLoginRequest = new ajaxObject('http://www.cvonline.hu/seeker/parool_unustatud.php?plain=plain','','fpasswordForm');
	myLoginRequest.update('plain=plain&keel=' + keel,'POST');
} 

function fnDisablepasswordLoad() 
{ 
	document.all["passwordLoad"].style.visibility='hidden';
	document.all["inProgress"].style.display='none';
	document.all["fpasswordForm"].style.visibility='hidden';
} 

function fnFocusLogin(){
	document.all['username'].select();
	document.all['username'].focus();
}

function fnCallAdvanceSearchForm() 
{ 
	yWithScroll = getBodyHeight();
	xWithScroll = getBodyWidth();

	xScreen = getScreenWidth();

	document.all["advanceSearchFormLoad"].style.left = "0px";
	document.all["advanceSearchFormLoad"].style.top = "0px";
	document.all["advanceSearchFormLoad"].style.width = xWithScroll + "px";
	document.all["advanceSearchFormLoad"].style.height = yWithScroll + "px";

	xformWidth = document.all["advanceSearchForm"].style.width;
	document.all["advanceSearchForm"].style.left = (xScreen/2 - parseInt(xformWidth)/2) + 'px';

	document.all["advanceSearchFormLoad"].style.visibility='visible';
	document.all["inProgress"].style.display='block';
	document.all["advanceSearchForm"].style.visibility='visible';
} 

function fnDisableAdvanceSearchLoad() 
{ 
	document.all["advanceSearchFormLoad"].style.visibility='hidden';
	document.all["inProgress"].style.display='none';
	document.all["advanceSearchForm"].style.visibility='hidden';
} 

function fnDisableMapLoad() 
{ 
	$("inProgress").style.display="none";

	$('mapDiv').style.visibility='hidden';
	$('map').style.visibility='hidden';
	$('GoogleMapDiv').style.visibility='hidden';
	$('AddressDiv').style.visibility='hidden';
} 

function getBodyHeight(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	return yWithScroll;
}

function getBodyWidth()
{
	var width = self.innerWidth,  // Safari
		mode = document['compatMode'];
	if (mode || isIE) { // IE, Gecko, Opera
		width = (mode == 'CSS1Compat') ?
			document.documentElement.clientWidth : // Standards
			document.body.clientWidth; // Quirks
	}

	return width;
}

function getScreenWidth(){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
	 screenW = screen.width;
	 screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
	   ) 
	{
	 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	 var jScreenSize = jToolkit.getScreenSize();
	 screenW = jScreenSize.width;
	 screenH = jScreenSize.height;
	}
	return screenW; 
}
function getScreenHeight(){
	var screenW = 640, screenH = 480;
	if (parseInt(navigator.appVersion)>3) {
	 screenW = screen.width;
	 screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
		&& parseInt(navigator.appVersion)==3
		&& navigator.javaEnabled()
	   ) 
	{
	 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	 var jScreenSize = jToolkit.getScreenSize();
	 screenW = jScreenSize.width;
	 screenH = jScreenSize.height;
	}
	return screenH; 
}

function fnPostForgotPassword(rFrom){
	var pars;

	if(!rFrom){
		if(document.getElementById('andmed[username]').value=="" && document.getElementById('andmed[epost]').value==""){
			alert("Először írja be a felhasználónevét vagy e-mail címét.");
			return false;
		}else if(document.getElementById('andmed[epost]').value!="" && !document.getElementById('andmed[epost]').disabled){
			if(!Validate_Email_Address(document.getElementById('andmed[epost]').value)){
				alert("Kérjük, valós e-mail címet adjon meg.");
				return false;
			}
		}
		
		pars='&andmed[username]='+document.getElementById('andmed[username]').value+'&andmed[epost]='+document.getElementById('andmed[epost]').value+'&andmed[code]='+document.getElementById('andmed[code]').value+'&Saada='+document.getElementById('Saada').value+'&tegevus=saada_parool';
	}else{
		username = getSelectedRadioValues("user");
		pars='&andmed[username]=&andmed[username]='+username+'&andmed[codev]=dont&Saada=Saada&tegevus=saada_parool';
	}

	var myForgotPasswordRequest = new ajaxObject('http://www.cvonline.hu/seeker/parool_unustatud.php?plain=plain'+pars,'','passwordActionResultMessages');
	myForgotPasswordRequest.update('plain=plain'+pars,'POST');
}

function getSelectedRadioValues(par){
	if(par=="user" && document.rdoForm){
		for (var i=0; i < document.rdoForm.user.length; i++)
		 {
			 if (document.rdoForm.user[i].checked)
			  {
				 return document.rdoForm.user[i].value;
			 }
		 }
	}else if(par=="user" && document.tp_vorm){
		for (var i=0; i < document.tp_vorm.user.length; i++)
		 {
			 if (document.tp_vorm.user[i].checked)
			  {
				 return document.tp_vorm.user[i].value;
			 }
		 }
	}
}

function fnCallKeywordSearch(dirStr,keyword){
	document.location='http://www.cvonline.hu/' + dirStr + '/o-' + keyword + '.html';
	return false;
}

function advanceSearchSelect(){
	obj = document.getElementById('tegvk_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('klient_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);
	
	obj = document.getElementById('client_fld_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('asukoht_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('tooaeg_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);
	
	obj = document.getElementById('tp_keel[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('days[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('experience[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);

	obj = document.getElementById('edulevel_id[]');
	optLength = obj.options.length;
	selectAllOptions(optLength,obj);
}

function selectAllOptions(optLength,obj){
	for(i=0;i<optLength;i++){
		obj.options[i].selected = "selected";
	}
}

function fnValidateAlertTitle(){
	if(!document.getElementById("alert_title").value){
		alert("Az Állásértesítő neve nem maradhat üres!");
		document.getElementById("inProgress").style.display = "none";
		document.getElementById("alert_title").select();
		document.getElementById("alert_title").focus();
		return false;
	}
	return true;
}

function hideElement(elementName){
	document.getElementById(elementName).style.display="none";
}

function showElement(elementName){
	document.getElementById(elementName).style.display="block";
}

Array.prototype.getUniqueValues = function ()
{
	var hash = new Object();
	for (j = 0; j < this.length; j++) {hash[this[j]] = true}

	var array = new Array();
	for (value in hash) {array.push(value)};

	return array;
}

/**
 *
 *  UTF-8 data encode / decode
 *  http://www.webtoolkit.info/
 *
 */
var Utf8 = {
 
	// public method for url encoding
	encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// public method for url decoding
	decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
 
		return string;
	}
}

// source - /js/search_googlejs.php
function fnUnSelect(action){
	var the_inputs=document.getElementsByTagName("input");
	var the_textfields=new Array();
	var cnf;
	var tp_ids;
	tp_ids="";

	if(fnCheckIfSelectedRemove())
		cnf = confirm("Valóban törölni akarja a kiválasztott állásajánlatokat?");
	else{
		alert("Kérjük, a törléshez jelöljön ki egy vagy több állásajánlatot.");
		return false;
	}
	if(cnf){
		for(var n=0;n<the_inputs.length;n++){
			if(the_inputs[n].type=="checkbox"){
				if(the_inputs[n].checked==true && the_inputs[n].name!="agent" && the_inputs[n].name!="checkall"){
					the_inputs[n].checked=false;
					if(action=="saved"){
						dv = 'removesave_jobDiv' + the_inputs[n].value;
					}else if(action=="viewed"){
						dv = 'removeviewedjobDiv' + the_inputs[n].value;
					}
					else if (action == 'selectedIDs')
					{
						dv = 'removeAppliedjobDiv' + the_inputs[n].value;
					}

					tp_ids = tp_ids + the_inputs[n].value + ",";
					document.getElementById(dv).innerHTML="";
				}
			}
		}

		tp_ids=tp_ids.substring(0,tp_ids.length-1)
		if(action=="saved"){
			dv = 'removesave_jobDiv';
			fncallRemoveSaveSearch('',dv,tp_ids); 
		}else if(action=="viewed"){
			dv = 'removeviewedjobDiv';
			fncallRemoveViewedList('',dv,tp_ids); 
		}
		else if (action == 'selectedIDs')
		{
			var requestAction = new ajaxObject('http://www.cvonline.hu/seeker/kandideerinud.php','','DivListContainer','');
			requestAction.update('selectedIDs=' + tp_ids + '&page=','$_GET');
		}
	}
}

function fnSelectAllJobs(val){
	var the_inputs=document.getElementsByTagName("input");
	var the_textfields=new Array();
	var val;

	for(var n=0;n<the_inputs.length;n++){
		if(the_inputs[n].type=="checkbox" && the_inputs[n].name!="agent"){
			if(the_inputs[n].name!="checkall")
				the_inputs[n].checked=val;
		}
	}
}

function fnCheckIfSelected(){
	var the_inputs=document.getElementsByTagName("input");
	var the_textfields=new Array();

	for(var n=0;n<the_inputs.length;n++){
		if(the_inputs[n].type=="checkbox" && the_inputs[n].checked==true && the_inputs[n].name!="agent" && the_inputs[n].name!="checkall" && !the_inputs[n].disabled){
			return true;
		}
	}
	return false;
}

function fnCheckIfSelectedRemove(){
	var the_inputs=document.getElementsByTagName("input");
	var the_textfields=new Array();

	for(var n=0;n<the_inputs.length;n++){
		if(the_inputs[n].type=="checkbox" && the_inputs[n].checked==true && the_inputs[n].name!="agent" && the_inputs[n].name!="checkall"){
			return true;
		}
	}
	return false;
}

function fnApplySelected(){
	var tp_id;
	tp_id='';
	if(fnCheckIfSelected()){
		var the_inputs=document.getElementsByTagName("input");
		var the_textfields=new Array();

		for(var n=0;n<the_inputs.length;n++){
			if(the_inputs[n].type=="checkbox" && the_inputs[n].checked==true && the_inputs[n].name!="agent" && the_inputs[n].name!="checkall" && !the_inputs[n].disabled){
				tp_id = tp_id + the_inputs[n].value + ',';
			}
		}
		document.frmsavedjobs.tp_id.value=tp_id;
		document.frmsavedjobs.target="_blank";
		document.frmsavedjobs.action="http://www.cvonline.hu/new_tp/kandideeri.php";
		document.frmsavedjobs.submit();
	}else{
		alert("Kérjük, válassza ki az állásajánlato(ka)t, amely(ek)re jelentkezni szeretne.");
	}
}
