
function getOnlineStatus()
{var online;var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('POST','/coremodule/checkonline/',false);request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.send('');online=request.responseText;}
return online;}
function logged_out()
{if(getOnlineStatus()==0){document.location.reload();return 1;}
return 0;}
function loadXMLDoc(url,parser,offline_allowed){if(!offline_allowed&&logged_out()){return;}
if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{req=new XMLHttpRequest();}catch(ex){req=false;}}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){req=false;}}}
if(req){req.onreadystatechange=parser;req.open("GET",url,true);req.send(null);}}
function loadAndWaitForXML(url,parser,offline_allowed)
{var XML=getResponseXML(url,offline_allowed);parser(XML);}
function getXmlDoc(url,data,parser){if(logged_out()){return;}
if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{req=new XMLHttpRequest();}catch(ex){req=false;}}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){Tac
try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){req=false;}}}
if(req){req.onreadystatechange=parser;req.open('POST',url,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.send(data);}}
function postAndWaitForResponse(url,data,offline_allowed){if(!offline_allowed&&logged_out()){return null;}
var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('POST',url,false);request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.send(data);return request.responseText;}
return null;}
function postAndParseResult(url,_data,offline_allowed)
{var data=postAndWaitForResponse(url,_data,offline_allowed);if(data!=''){data=JSON.parse(data);}
return data;}
function postAndCallback(url,data,callback,offline_allowed){if(!offline_allowed&&logged_out()){return null;}
var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('POST',url,true);request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.send(data);request.onreadystatechange=function(){if(request.readyState==4){callback(request.responseText);}};return null;}
return null;}
function getResponseText(url,offline_allowed){if(!offline_allowed&&logged_out()){return false;}
var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('GET',url,false);request.send(null);return request.responseText;}
return false;}
function getResponseXML(url,offline_allowed){if(!offline_allowed&&logged_out()){return false;}
var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('GET',url,false);request.send(null);return request.responseXML;}
return false;}
if(!Array.prototype.forEach){Array.prototype.forEach=function(fun)
{var len=this.length;if(typeof fun!="function"){throw new TypeError();}
var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this){fun.call(thisp,this[i],i,this);}}};}
if(!Array.prototype.inArray){Array.prototype.inArray=function(p_val){for(var i=0,l=this.length;i<l;i++){if(this[i]==p_val){return i;}}
return-1;};}
function forEach(arr,fun)
{if(typeof fun!="function"){throw new TypeError();}
var thisp=arguments[1];for(var id in arr){var val=arr[id];if((typeof val)!='function'){fun.call(thisp,id,val,arr);}}}
var baseUrl='';function isIE8()
{var check='false';if(check=='true'){return true;}
return false;}
function isIE7()
{var check='false';if(check=='true'){return true;}
return false;}
function isIE6()
{var check='false';if(check=='true'){return true;}
return false;}
function isIE()
{var check='false';if(check=='true'){return true;}
return false;}
function getIEVersion()
{}
function startInput(elm)
{elm.value='';elm.style.color='rgb(0, 0, 0)';this.onClick=null;}
function prepareForJson(txt,removeNewLines)
{if(removeNewLines==true){txt=txt.replace(/\n/g,'').replace(/\r/g,'');}
txt=txt.replace(/"/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\\/g,'&#92;');return txt;}
function encodeRowForPost(txt,terminateRegExp,terminateReplace)
{if(terminateRegExp==null){terminateRegExp=/\"/g;terminateReplace='\\"';}
txt=txt.replace(/\r/g,"").replace(/\\/g,"\\\\").replace(terminateRegExp,terminateReplace).replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\+/g,"%2B").replace(/\f/g,"\\f");return txt;}
function encodeForPost(txt,encode)
{txt=unescape(txt.replace(/\\u/g,'%u'));if(encode!=false){txt=encodeURIComponent(txt);}
return txt;}
function jsonData(data)
{data=JSON.stringify(data);data=unescape(data.replace(/\\u/g,'%u'));data=encodeURIComponent(data);return data;}
function onlyNumbers(evt)
{var key;if(window.event){key=window.event.keyCode;}else{key=evt.which;}
if(key==32){return false;}
switch(key){case null:case 0:case 8:case 9:case 13:case 27:return true;}
return key.charCode().isInt();}
function findPosX(obj)
{var curleft=0;try{if(obj.offsetParent)
while(1)
{curleft+=obj.offsetLeft;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.x)
curleft+=obj.x;}
catch(e){}
return curleft;}
function findPosY(obj)
{var curtop=0;try{if(obj.offsetParent)
while(1)
{curtop+=obj.offsetTop;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.y)
curtop+=obj.y;}
catch(e){}
return curtop;}
function $(id,what,arg)
{var ob;if(id.substr(0,1)=='!'){ob=document.getElementsByName(id.substr(1));}else if(id.substr(0,1)=='&'){ob=document.getElementsByTagName(id.substr(1));}else{ob=document.getElementById(id);}
if(what==null){return ob;}else if(what=='style'){var y=null;if(ob.currentStyle){y=ob.currentStyle[arg];}else if(window.getComputedStyle){y=document.defaultView.getComputedStyle(ob,null).getPropertyValue(arg);}
return y;}else if(what=='setSelect'){var sel=-1;for(var cnt=0;cnt<ob.options.length;cnt++){if(ob.options[cnt].value==arg){sel=cnt;}}
if(sel!=-1){ob.selectedIndex=sel;}}
return false;}
function html_entity_decode(src)
{src=src.replace(/</g,"&lt;");src=src.replace(/>/g,"&gt;");var taOB=document.createElement("textarea");taOB.innerHTML=src;var dst=taOB.value;taOB=null;return dst;}
function htmlspecialchars(str)
{str=str.replace(/&/g,'%26');str=str.replace(/"/g,'%22');str=str.replace(/\'/g,'%27');str=str.replace(/</g,'%3C');str=str.replace(/>/g,'%3E');return str;}
function toArray(srcArr){var retArr=[];for(var i=0,len=srcArr.length;i<len;i++)
{retArr[retArr.length]=srcArr[i];}
return retArr;}
function pauseApplication()
{if(!confirm('Tulet nyt pysäyttämään hakemuksesi!')){return false;}
displayWait('Hakemuksesi keskeytetään......');postAndWaitForResponse('/job/pauseapplication/','');removeWait();return true;}
function submitOnEnter(formId,event)
{var formOb=$(formId);var keyCode=null;if(window.event){keyCode=window.event.keyCode;}else if(event){keyCode=event.which;}
if(keyCode==13){formOb.submit();return false;}
return true;}
function doOnEnter(func,code){if(code==13){func();}}
var TextCtlMap={set:function(addr,data){this[addr]=data;},get:function(addr){return this[addr];}}
function numOnly(event){var keynum
if(event.keyCode==9){return true;}
if(window.event){keynum=event.keyCode;}else if(event.which){keynum=event.which}
return((keynum>=48&&keynum<=57)||keynum==8);}
function trim(str){if(str&&str!=''){while(str.substring(0,1)==' '){str=str.substring(1,str.length);}
while(str.substring(str.length-1,str.length)==' '){str=str.substring(0,str.length-1);}}
return str;}
function loadCountySelect(selectID,country,clearCitySelect)
{var selectOb;if(typeof(selectID)=='string'){selectOb=document.getElementById(selectID);}else{selectOb=selectID;}
var elem=document.createElement('option');elem.text='Valitse lääni';selectOb.options.length=0;if(document.all){selectOb.add(elem);}else{selectOb.add(elem,null);}
if(clearCitySelect!=null){document.getElementById(clearCitySelect).options.length=1;document.getElementById(clearCitySelect).disabled=true;}
loadXMLDoc('/coremodule/loadcounties/country:'+country+'/',function(){if(req.readyState==4&&req.status==200){var elems=req.responseXML.getElementsByTagName('county');if(elems.length==0){selectOb.length=1;selectOb.disabled=true;if(document.getElementById('citySelect')!=null){loadCitySelect('citySelect',null,document.getElementById('countrySelect'));}
return;}
selectOb.disabled=false;for(var i=0;i<elems.length;i++){var node=elems[i].attributes;var county=unescape(node.getNamedItem('name').value);var code=unescape(node.getNamedItem('code').value);elem=document.createElement('option');elem.text=county;elem.value=code;if(document.all){selectOb.add(elem);}else{selectOb.add(elem,null);}}}},true);}
function loadCitySelect(selectID,countySelOb,countrySelOb,preSelCountry)
{var selectOb=document.getElementById(selectID);var elem=document.createElement('option');var country;if(countrySelOb!=null){country=countrySelOb.options[countrySelOb.selectedIndex].value;}else{country=preSelCountry;}
selectOb.options.length=0;var url='/coremodule/loadcities/country:'+country+'/';if(countySelOb!=null){var county=countySelOb.options[countySelOb.selectedIndex].value;url+='county:'+county+'/';}
loadXMLDoc(url,function(){if(req.readyState==4&&req.status==200){var elems=req.responseXML.getElementsByTagName('county');if(elems.length==0){elem.text='Valitse paikkakunta';selectOb.disabled=true;}else{elem.text='Valitse kunta';}
if(document.all){selectOb.add(elem);}else{selectOb.add(elem,null);}
if(elems.length==0){return;}
selectOb.disabled=false;for(var i=0;i<elems.length;i++){var node=elems[i].attributes;var county=unescape(node.getNamedItem('name').value);var code=unescape(node.getNamedItem('code').value);elem=document.createElement('option');elem.text=county;elem.value=code;if(document.all){selectOb.add(elem);}else{selectOb.add(elem,null);}}}},true);}
function flagDropDown()
{if(document.getElementById("langFlags").style.display=="none"){document.getElementById("langFlags").style.display="";}else{document.getElementById("langFlags").style.display="none";}}
function loadManualChoice(systemName)
{var manualHTML='';manualHTML+='<h1>Käsikirja</h1>';manualHTML+='<div>Täältä imuroit käsikirjan PDF muodossa rekrytointijärjestelmään.</div>';manualHTML+='<div style="width:400px; margin-top:20px;">';if(systemName=='mynetwork'){manualHTML+='<a href="javascript:downloadManual(\'en\', \''+systemName+'\')" class="buttonNotLink"><div class="manualIcon">English Manual</div></a>';manualHTML+='<a href="javascript:downloadManual(\'se\', \''+systemName+'\')" class="buttonNotLink"><div class="manualIcon">Svensk Handbok</div></a>';manualHTML+='<a href="javascript:downloadManual(\'no\', \''+systemName+'\')" class="buttonNotLink"><div class="manualIcon">Norsk Brukermanual</div></a>';manualHTML+='<a href="javascript:downloadManual(\'fi\', \''+systemName+'\')" class="buttonNotLink"><div class="manualIcon">Suomen Käsikirja</div></a>';}else if(systemName=='netrecruiter'){manualHTML+='<a href="javascript:downloadManual(\'se\', \''+systemName+'\')" class="buttonNotLink"><div class="manualIcon">Svensk Handbok</div></a>';}
manualHTML+='</div>';displayMessageBox(manualHTML);}
function downloadManual(lang,system)
{window.open('/center/downloadManual/lang:'+lang+'/system:'+system+'/','manualDownload','width=1,height=1,menubar=no,location=no,resizable=no,scrollbars=no,status=no');}
function getElement(id){return document.getElementById(id);}
function getMenuItemForX(x){return pages[x-1];}
function switchSubHelpPage(sub,nr)
{var currPage=document.getElementById('currPage');var currSub=document.getElementById('currSub');var currPageNr=currPage?currPage.innerHTML:'';var currSubNr=currSub?currSub.innerHTML:'';if(currSubNr!=sub){currPageNr='';if(currSubNr!=''){var pageDiv;for(var i=1;(pageDiv=document.getElementById(currSubNr+'-helppage-'+i))!=null;i++){pageDiv.style.display='none';}
document.getElementById('subpage-'+currSubNr).style.display='none';}
var subDiv=document.getElementById('subpage-'+sub);if(subDiv==null){var tmpDiv=document.getElementById('currPage');if(tmpDiv!=null){tmpDiv.innerHTML='0';}
tmpDiv=document.getElementById('currSub');if(tmpDiv!=null){tmpDiv.innerHTML='0';}
tmpDiv=document.getElementById('maxPage');if(tmpDiv!=null){tmpDiv.innerHTML='0';}
tmpDiv=document.getElementById('maxPage');if(tmpDiv!=null){document.getElementById('txtCurrPage').innerHTML='0 / 0';}
return false;}
if(currSub!=null){currSub.innerHTML=sub;}
if(subDiv!=null){subDiv.style.display='block';}
if(document.getElementById('subMaxPage-'+sub)!=null){document.getElementById('maxPage').innerHTML=''+document.getElementById('subMaxPage-'+sub).innerHTML;}}
var helpDiv=document.getElementById(sub+'-helppage-'+nr);if(helpDiv==null){return false;}
if(currPageNr!=''){document.getElementById(sub+'-helppage-'+currPageNr).style.display='none';}
helpDiv.style.display='block';document.getElementById('txtCurrPage').innerHTML=(nr+' / '+
document.getElementById('maxPage').innerHTML);currPage.innerHTML=nr;}
function helpRight()
{var currPage=document.getElementById('currPage').innerHTML;var currSub=document.getElementById('currSub').innerHTML;if(currSub==''||currSub=='0'){return;}
if(switchSubHelpPage(currSub,parseInt(currPage)+1)==false){switchSubHelpPage(currSub,1);}}
function helpLeft()
{var currPage=document.getElementById('currPage').innerHTML;var currSub=document.getElementById('currSub').innerHTML;if(currSub==''||currSub=='0'){return;}
if(parseInt(currPage)==1){currPage=(parseInt(document.getElementById('maxPage').innerHTML)+1);}
switchSubHelpPage(parseInt(currSub),parseInt(currPage)-1);}
function helpPage(id)
{var foundHelpDiv=false;var subpage0=document.getElementById('subpage-0');var helppage0=document.getElementById('0-helppage-0');if(switchSubHelpPage(id,1)==false){if(subpage0!=null){subpage0.style.display='block';}
if(helppage0!=null){helppage0.style.display='block';}
return;}
if(subpage0!=null){document.getElementById('subpage-0').style.display='none';}
if(helppage0!=null){document.getElementById('0-helppage-0').style.display='none';}}
function oneMenuItem(id,callbackHook){var currButt=$('topButton-'+id);var currClass='main-button-blank-sel';var otherClass='main-button-blank';for(var cnt=1;cnt<=6;cnt++){var otherButt=$('topButton-'+cnt);if(otherButt==null){continue;}
otherButt.className=otherClass;}
if(callbackHook!=null){callbackHook();}
currButt.className=currClass;menuItem(id,false,true);}
function menuItem(id,nohelp,nobuttons,callBackHook){var save=document.getElementById('saveWhenChange');if(save&&save.value=='1'){var x=document.getElementById('ws-navigator-x1');if(x!=null){savePage(getMenuItemForX(x.innerHTML));}}
if(nohelp==null){setTimeout('helpPage('+id+')',0);}
if(id<10){id='0'+id;}
for(var i=1;i<=19;i++){var num=i;if(i<10){num='0'+num;}
var menuItem=$('menuItem'+num);if((menuItem!=null)||(nobuttons==true)){if(num==id){if(menuItem!=null){menuItem.className='menuItemSelected';}
document.getElementById('menuItemWorkspace'+num).style.display='block';}else if(document.getElementById('menuItemWorkspace'+num)){if(menuItem!=null){menuItem.className='menuItem';}
document.getElementById('menuItemWorkspace'+num).style.display='none';}}}
for(i=1;i<=19;i++){var num=i;if(i<10){num='0'+num;}
if(document.getElementById('nextPrevButtons')!=null){updateNextPrev(id);}
var menuItemHorizontal=document.getElementById('menuItemHorizontal'+num);if(menuItemHorizontal!=null){if(num==id){menuItemHorizontal.className='menuItemSelectedHorizontal';document.getElementById('menuItemWorkspace'+num).style.display='block';}else if(document.getElementById('menuItemWorkspace'+num)){menuItemHorizontal.className='menuItemHorizontal';document.getElementById('menuItemWorkspace'+num).style.display='none';}}}
if(callBackHook!=null){callBackHook(id,nohelp,nobuttons);}}
function getSelectedMenuItem()
{var item;for(var i=1;i<=19;i++){var num=i;if(i<10){num='0'+num;}
item=document.getElementById('menuItemWorkspace'+num);if(item.style.display=='block'){return i;}}
return-1;}
function nextstep(){if(validUsername){loadXMLDoc('/module:coremodule/method:register/action:usernamereservation/username:'+username+'/',nextstepHandler);}else{document.getElementById('regusernamebutton').innerHTML='Ugyldig brukernavn!';}}
function nextstepHandler(){if(req.readyState==4){if(req.status==200){id=req.responseText;if(id==-1){document.getElementById('regusernamebutton').innerHTML='For kort brukernavn!';}else if(id==-2){document.getElementById('regusernamebutton').innerHTML='Brukernavnet er tatt i bruk!';}else{username=document.getElementById('USR').value;document.getElementById('USR').disabled='disabled';document.getElementById('regform').style.display='block';document.getElementById('step1completed').style.display='none';document.getElementById('container-USR').style.display='none';}}}}
function saveGeneral(){var GEN=document.getElementById('GEN');var UTD=document.getElementById('UTD');var FA1=document.getElementById('FA1');var FA2=document.getElementById('FA2');var SUR=document.getElementById('SUR');var AD1=document.getElementById('AD1');var AD2=document.getElementById('AD2');var POS=document.getElementById('POS');var PAD=document.getElementById('PAD');var YEA=document.getElementById('YEA');var MON=document.getElementById('MON');var DAY=document.getElementById('DAY');var MOB=document.getElementById('MOB');var PHO=document.getElementById('PHO');var FOR=document.getElementById('FOR');var EXP=document.getElementById('EXP');var COU=document.getElementById('COU');var CNTY=document.getElementById('CNTY');if(postAndWaitForResponse('/coremodule/checkonline/','')==0){alert('Et ole ollut aktiivina vähään aikaan tai olet sisäänkirjautunut toisen tietokoneen kautta.');return;}
var nrError=0;if(trim(FOR.value)==''){document.getElementById("cvReqFirstName").style.color="red";document.getElementById("cvReqFirstNameStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqFirstName").style.color="black";document.getElementById("cvReqFirstNameStar").style.color="black";}
if(trim(SUR.value)==''){document.getElementById("cvReqLastName").style.color="red";document.getElementById("cvReqLastNameStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqLastName").style.color="black";document.getElementById("cvReqLastNameStar").style.color="black";}
if(trim(AD1.value)==''){document.getElementById("cvReqAddress").style.color="red";document.getElementById("cvReqAddressStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqAddress").style.color="black";document.getElementById("cvReqAddressStar").style.color="black";}
if(trim(POS.value)==''){document.getElementById("cvReqZipcode").style.color="red";document.getElementById("cvReqZipcodeStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqZipcode").style.color="black";document.getElementById("cvReqZipcodeStar").style.color="black";}
if(trim(PAD.value)==''){document.getElementById("cvReqCity").style.color="red";document.getElementById("cvReqCityStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqCity").style.color="black";document.getElementById("cvReqCityStar").style.color="black";}
if(trim(COU.value)==''){document.getElementById("cvReqCountry").style.color="red";document.getElementById("cvReqCountryStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqCountry").style.color="black";document.getElementById("cvReqCountryStar").style.color="black";}
if(trim(GEN.value)==''){document.getElementById("cvReqGender").style.color="red";document.getElementById("cvReqGenderStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqGender").style.color="black";document.getElementById("cvReqGenderStar").style.color="black";}
if(UTD){if(trim(UTD.value)==''){document.getElementById("cvReqEducationGen").style.color="red";document.getElementById("cvReqEducationGenStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqEducationGen").style.color="black";document.getElementById("cvReqEducationGenStar").style.color="black";}}
if(DAY.value>30&&(MON.value==2||MON.value==4||MON.value==6||MON.value==9||MON.value==11)){alert('Päivämäärän jonka kirjoitit ei ole olemassa');return;}
if(DAY.value>28&&MON.value==2&&(DAY.value>29||YEA.value%4!=0)){alert('Päivämäärän jonka kirjoitit ei ole olemassa');return;}
if((MOB.value==''||MOB.value==0)&&PHO.value==''){document.getElementById("cvReqPhone").style.color="red";document.getElementById("cvReqPhoneStar").style.color="red";document.getElementById("cvReqGeneral").style.display="";nrError++;}else{document.getElementById("cvReqPhone").style.color="black";document.getElementById("cvReqPhoneStar").style.color="black";}
if(nrError>0){}
url='/cv/saveGeneral/';url+='FOR:'+escape(FOR.value)+'/';url+='SUR:'+escape(SUR.value)+'/';url+='AD1:'+escape(AD1.value)+'/';url+='AD2:'+escape((AD2.value?AD2.value:''))+'/';url+='POS:'+escape(POS.value)+'/';url+='PAD:'+escape(PAD.value)+'/';url+='YEA:'+escape(YEA.value)+'/';url+='MON:'+escape(MON.value)+'/';url+='DAY:'+escape(DAY.value)+'/';url+='PHO:'+escape((PHO.value?PHO.value:''))+'/';url+='MOB:'+escape(MOB.value)+'/';url+='GEN:'+escape(GEN.value)+'/';if(UTD){url+='UTD:'+escape(UTD.value)+'/';url+='FA1:'+escape(FA1.value)+'/';url+='FA2:'+escape(FA2.value)+'/';url+='EXP:'+escape(EXP.value)+'/';}
url+='COU:'+escape(COU.value)+'/';url+='CNTY:'+escape(CNTY.value)+'/';var licenses=new Array();var checkBoxes=document.getElementsByTagName('input');for(var cnt=0;cnt<checkBoxes.length;cnt++){if((checkBoxes[cnt].name=='drivers_license')&&(checkBoxes[cnt].checked==true)){licenses[licenses.length]=checkBoxes[cnt].id;}}
if(licenses.length>0){url+='DRV:'+licenses.join(',')+'/';}
displayWait('Tallentaa');loadXMLDoc(url,function(){if(req.readyState==4&&req.status==200){removeWait();if(req.responseText){alert(unescape(req.responseText));}}});try{document.getElementById('cvMenuBack11').className='cvMenuBackGreen';}
catch(e){}}
function activateWithMyNetwork()
{if($('acceptedTerms').checked==false){alert('NEED_TO_ACCEPT_TERMS');return;}
postAndWaitForResponse('/cv/activateuser/');document.location.reload(true);}
function tryLoadMessages(activeReqFid)
{if(activeRecruitmendFolderID==null){return;}
var isFolded=getMenu().getItemAt(activeRecruitmendFolderID).getFolded();if(isFolded==true){setTimeout(tryLoadMessages,100);return;}
loadMessages();}
function openProjectReport(id)
{window.open('/center/projectreport/id:'+id+'/','profile'+id,'width=700,height=705,menubar=no,location=no,resizable=no,scrollbars=no,status=no');}
function addProjectComment()
{document.getElementById('project-comment').style.display='block';document.getElementById('project-shade').style.display='block';}
function closeProjectComment()
{document.getElementById('project-comment').style.display='none';document.getElementById('project-shade').style.display='none';}
function reloadFileList(pid)
{displayWait('RELOADING_FILES');loadXMLDoc('/center/loadfilelist/pid:'+pid+'/',function(){removeWait();var div=document.getElementById('report-file-container');div.innerHTML='';var elems=req.responseXML.getElementsByTagName('file');for(var i=0;i<elems.length;i++){div.innerHTML+='<div style="width: 250px; float: left;">'+elems[i].getAttribute('name')+'</div>'+'<div style="width: 250px; float: left;">'+elems[i].getAttribute('assocname')+'</div>'+'<div style="width: 70px; float: left; text-align: center;"><a href="/center/downloadCompanyFile/fid:'+elems[i].getAttribute('id')+'/" class="recruit-links">Lataa</a></div>'+'<div style="width: 70px; float: left; text-align: center;"><a href="javascript:deleteCompanyFile('+elems[i].getAttribute('id')+');" class="recruit-links">Poista</a></div>'+'<div style="clear: both;"></div>'+'<div style="width: 475px; margin-bottom: 3px;"><i>'+elems[i].getAttribute('description')+'</i></div>';}});}
function saveProjectComment(id)
{var editor=tinyMCE.getInstanceById('project-comment-text');var comment=editor.getContent();displayWait('Tallentaa');var data=postAndWaitForResponse('/center/commentproject/pid:'+id+'/','comment='+htmlspecialchars(comment));removeWait();if(data=='1'){document.location.reload();}else{alert(data);}}
function viewProfile(id){window.open('/user/view/id:'+id+'/include:0/','profile'+id,'width=700,height=650,menubar=no,location=no,resizable=no,scrollbars=no,status=no');}
function viewSelectedProfiles()
{var req_id=new Array();var tags=document.getElementById('dataresult').getElementsByTagName('input');for(var i=0;i<tags.length;i++){if(tags[i].type!='checkbox'&&tags[i].id!='toggleall'){continue;}
if(tags[i].checked==false){continue;}
req_id[req_id.length]=tags[i].id;}
if(req_id.length==0){alert('Merkitse ne profiilit joihin haluat pääsyn');return;}
var req_str=req_id.join(';');window.open('/user/request/id:'+req_id+'/','request','width=700,height=650,menubar=no,location=no,resizable=no,scrollbars=no,status=no');}
function closeProfileInfo(){document.getElementById('infobox').style.display='none';var editor=tinyMCE.getInstanceById('editor');if(editor!=null){editor.remove();}
document.getElementById('infoboxButtonContainer').style.width='180px';document.getElementById('infoboxButtonContainer').innerHTML='<div class="button-180-gray" style="float: left;"><a class="button-180-gray" href="javascript:infobox.hide();"><span class="vertical-180-24-button">Sulje</span></a></div>';}
function profileInfo(table,id){var box=document.getElementById('infobox');displayWait('Lataa tiedon');loadXMLDoc('/user/profileInfo/table:'+escape(table)+'/id:'+id+'/',function(){if(req.readyState==4&&req.status==200){removeWait();box.style.display='block';document.getElementById('infoboxData').innerHTML=unescape(req.responseText);}});}
function loadLocaleGroups(selectID,id,occupationClear)
{var selectOb=document.getElementById(selectID);var elem=document.createElement('option');selectOb.options.length=0;if(occupationClear!=null){document.getElementById(occupationClear).options.length=1;document.getElementById(occupationClear).disabled=true;}
loadAndWaitForXML('/center/loadLocaleGroups/id:'+id+'/',function(ret){var elems=ret.getElementsByTagName('localeGroup')
if(elems.length==0){elem.text='Ammattiryhmää ei ole valittu';selectOb.disabled=true;}else{elem.text='Valitse ammattiryhmä';selectOb.disabled=false;}
if(!document.all){selectOb.add(elem,null);}else{selectOb.add(elem);}
for(var i=0;i<elems.length;i++){var node=elems[i].attributes;var id=node.getNamedItem('localecode').value;var name=unescape(node.getNamedItem('name').value);elem=document.createElement('option');elem.text=name;elem.value=id;if(!document.all){selectOb.add(elem,null);}else{selectOb.add(elem);}}});}
function loadOccupationNames(selectID,id)
{var selectOb=document.getElementById(selectID);var elem=document.createElement('option');selectOb.options.length=0;loadAndWaitForXML('/center/loadOccupationNames/id:'+id+'/',function(ret){var elems=ret.getElementsByTagName('occupationName')
if(elems.length==0){elem.text='Puuttuva ammattinimi';selectOb.disabled=true;}else{elem.text='Valitse ammatti';selectOb.disabled=false;}
if(!document.all){selectOb.add(elem,null);}else{selectOb.add(elem);}
for(var i=0;i<elems.length;i++){var node=elems[i].attributes;var id=node.getNamedItem('occupationnameid').value;var name=unescape(node.getNamedItem('name').value);elem=document.createElement('option');elem.text=name;elem.value=id;if(!document.all){selectOb.add(elem,null);}else{selectOb.add(elem);}}});}
function testJobDate(ends){var year;var month;var day;if(ends==true){year=document.getElementById('ends-YEA');mon=document.getElementById('ends-MON');day=document.getElementById('ends-DAY');}else{year=document.getElementById('pub-YEA');mon=document.getElementById('pub-MON');day=document.getElementById('pub-DAY');}
if(year.value==''){return false;}
if(mon.value==''){return false;}
if(day.value==''){return false;}
return(year.value+'-'+(mon.value<10?('0'+mon.value):mon.value)+'-'+(day.value<10?('0'+day.value):day.value));}
function updateDateDiv(div,type,val)
{var divOb=document.getElementById(div);var date=divOb.value.split('-');var typeInt;if(type=='year'){typeInt=0;}else if(type=='month'){typeInt=1;if(val<10){val='0'+val;}}else{typeInt=2;if(val<10){val='0'+val;}}
date[typeInt]=val;divOb.value=date.join('-');}
function hideDatePicker()
{$('job-ends-gui').style.display='none';$('job-published-gui').style.display='none';$('job-projends-gui').style.display='none';var pubs=document.getElementById('job-published').value.split('-');var ends=document.getElementById('job-ends').value.split('-');var projends=document.getElementById('job-projends').value.split('-');var pubSelY=document.getElementById('pub-YEA');var pubSelM=document.getElementById('pub-MON');var pubSelD=document.getElementById('pub-DAY');for(var i=0;i<pubSelY.options.length;i++){if(parseInt(pubSelY.options[i].value)==parseInt(pubs[0])){pubSelY.options[i].selected=true;}}
for(var i=0;i<pubSelM.options.length;i++){if(parseInt(pubSelM.options[i].value)==parseInt(pubs[1])){pubSelM.options[i].selected=true;}}
for(var i=0;i<pubSelD.options.length;i++){if(parseInt(pubSelD.options[i].value)==parseInt(pubs[2])){pubSelD.options[i].selected=true;}}
var endSelY=document.getElementById('ends-YEA');var endSelM=document.getElementById('ends-MON');var endSelD=document.getElementById('ends-DAY');for(var i=0;i<endSelY.options.length;i++){if(parseInt(endSelY.options[i].value)==parseInt(ends[0])){endSelY.options[i].selected=true;}}
for(var i=0;i<endSelM.options.length;i++){if(parseInt(endSelM.options[i].value)==parseInt(ends[1])){endSelM.options[i].selected=true;}}
for(var i=0;i<endSelD.options.length;i++){if(parseInt(endSelD.options[i].value)==parseInt(ends[2])){endSelD.options[i].selected=true;}}
var projeSelY=document.getElementById('proje-YEA');var projeSelM=document.getElementById('proje-MON');var projeSelD=document.getElementById('proje-DAY');for(var i=0;i<projeSelY.options.length;i++){if(parseInt(projeSelY.options[i].value)==parseInt(projends[0])){projeSelY.options[i].selected=true;}}
for(var i=0;i<projeSelM.options.length;i++){if(parseInt(projeSelM.options[i].value)==parseInt(projends[1])){projeSelM.options[i].selected=true;}}
for(var i=0;i<projeSelD.options.length;i++){if(parseInt(projeSelD.options[i].value)==parseInt(projends[2])){projeSelD.options[i].selected=true;}}}
var datePickerTimeoutID;var pickerParentOB;function datePickerTimeout(type,parent)
{if(parent!=null){pickerParentOB=parent;type=pickerParentOB.id;}
datePickerTimeoutID=setTimeout("showDatePicker('"+type+"')",500);}
function clearDatePickerTimeout()
{pickerParentOB=null;clearTimeout(datePickerTimeoutID);}
function showDatePicker(type)
{if(type=='published'){$('job-ends-gui').style.display='none';$('job-published-gui').style.display='block';$('job-projends-gui').style.display='none';}else if(type=='ends'){$('job-ends-gui').style.display='block';$('job-published-gui').style.display='none';$('job-projends-gui').style.display='none';}else{$('job-ends-gui').style.display='none';$('job-published-gui').style.display='none';$('job-projends-gui').style.display='block';}
displayDatePicker(('job-'+type),('job-'+type+'-gui'),pickerParentOB);}
function resetPassword(){var email=document.getElementById('email').value;displayWait('Lähettäjä');loadXMLDoc('/coremodule/resetpassword/email:'+escape(email)+'/request:1/',function(){if(req.readyState==4&&req.status==200){var resp;removeWait();resp=unescape(req.responseText);if(resp!='1'){alert(resp);}else{alert('Uusi salasana on lähetetty sähköpostiisi');window.location='/';}}},true);}
function changePassword(){var PA1=document.getElementById('PA1').password?document.getElementById('PA1').password:document.getElementById('PA1').value;var PA2=document.getElementById('PA2').password?document.getElementById('PA2').password:document.getElementById('PA2').value;var PA3=document.getElementById('PA3').password?document.getElementById('PA3').password:document.getElementById('PA3').value;if(PA2==PA3){displayWait('Lähettäjä',true);loadXMLDoc('/coremodule/resetpassword/pa1:'+hex_md5(PA1)+'/pa2:'+hex_md5(PA2)+'/',function(){if(req.readyState==4&&req.status==200){removeWait();if(req.responseText!=''){alert(unescape(req.responseText));}else{alert('Salasana on nyt muutettu');try{hideMessageBox();}
catch(e){}}}});}else{alert('Salasana ei täsmää');}}
function shareOnLinkedIn(url)
{window.open(url,'LIShare','width=700,height=700,toolbar=0,resizable=1,status=0,menubar=0,scrolling=1');}
function readTerms(){window.open('/info/memberterms/popup:1/nobuttons:1/','memberTerms','width=700,height=705,toolbar=0,resizable=1,status=0,menubar=0,scrolling=1');}
function readNAVInfo(){window.open('/info/nav/popup:1/nobuttons:1/','navTerms','width=700,height=705,toolbar=0,resizable=1,status=0,menubar=0,scrolling=1');}
function readCTerms(){var box=document.getElementById('infobox');loadXMLDoc('/article/id:9/encode:1/',function(){if(req.readyState==4&&req.status==200){box.style.display='block';document.getElementById('infoboxData').innerHTML=unescape(req.responseText);}},true);}
function seeSpontaneousAppAnswers(id)
{window.open('/center/spontaneousform/id:'+id+'/','spontAppAnswers'+id,'width=600,height=600,toolbar=0,resizable=0,status=0,menubar=0,scrolling=0');}
function getSAPPURL(sappid)
{var sappURL='/job/applyforspontaneous/sappid:'+sappid+'/';return sappURL;}
function getSAPPPostData(sappid)
{var sappURL='';var currName=null;var currSapp=null;var inputs=document.getElementsByTagName('*');var dataArray=new Array();var ok=true;var oneChecked=false;var currBox;var sapps=new Array();for(var cnt=0;cnt<inputs.length;cnt++){if(!inputs[cnt].name||(inputs[cnt].name.length<8)||(inputs[cnt].name.substr(0,8)!='question')){continue;}
if(inputs[cnt].id=='selection'){continue;}
currBox=inputs[cnt];if(currName==null||currName!=inputs[cnt].name){if(dataArray.length>0){sappURL+=(('answer_'+currSapp)+'='+dataArray.join(',')+'&');dataArray.length=0;}
if(currName&&(currType==2)){if(oneChecked==false){ok=false;}
oneChecked=false;}
currName=inputs[cnt].name;currSapp=parseInt(inputs[cnt].name.substr(9));currType=(inputs[cnt].type=='textarea'?1:2);sapps[sapps.length]=currSapp+';'+currType;}
if(inputs[cnt].type=='radio'||inputs[cnt].type=='checkbox'){if(inputs[cnt].checked==false){dataArray[dataArray.length]=inputs[cnt].id+';0';}else{dataArray[dataArray.length]=inputs[cnt].id+';1';oneChecked=true;}}else{if(inputs[cnt].value.length==0){ok=false;}else{if(inputs[cnt].id!='selection'){var answerText=inputs[cnt].value;answerText=htmlspecialchars(answerText);answerText=answerText.replace(/,/g,'%COMMA%');answerText=answerText.replace(/;/g,'%SEMICOLON%');answerText=answerText.replace(/:/g,'%COLON%');sappURL+=(('answer_'+currSapp)+'='+inputs[cnt].id+';'+answerText+'&');}}}}
if(dataArray.length>0){if(currBox.type=='radio'||currBox.type=='checkbox'){if(oneChecked==false){ok=false;}}
sappURL+=(('answer_'+currSapp)+'='+dataArray.join(',')+'&');}
sappURL+=('questions='+sapps.join(','));if(ok==false){alert('Sinun tulee vastata kaikkiin kysymyksiin');return false;}
return sappURL;}
function seeSpontaneousAppAnswers(id)
{window.open('/center/spontaneousform/id:'+id+'/','spontAppAnswers'+id,'width=600,height=600,toolbar=0,resizable=0,status=0,menubar=0,scrolling=0');}
function savePositionAnswers(pid)
{var ret=[];var sort=1;var qm=$('qm-1');for(;qm;qm=$('qm-'+(++sort))){var qmId=parseInt(qm.value);ret[sort]={'type':qmId};switch(qmId){case 1:if(!$(sort+'-yes').checked&&!$(sort+'-no').checked){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}
ret[sort].value=($(sort+'-yes').checked==true)?'yes':'no';break;case 4:var oneChecked=false;var qmOpts=$('!'+sort+'-opt');var qmOpt=null;var scid=null;var regex=/[0-9]-opt-([0-9]{1,})/;var matches=null;var arr=[];ret[sort].value='';for(var cnt=0;cnt<qmOpts.length;cnt++){qmOpt=qmOpts[cnt];matches=qmOpt.id.match(regex);if(matches.length>0){scid=matches[1];if(qmOpt.checked==true){arr.push(scid);oneChecked=true;}}}
if(oneChecked==false){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}
ret[sort].value=arr.join(';');break;case 2:case 7:var oneChecked=false;var osort=1;var qmOpt=$(sort+'-opt-'+osort);ret[sort].value=[];for(;qmOpt;qmOpt=$(sort+'-opt-'+(++osort))){if(qmOpt.checked==true){ret[sort].value[osort]=true;oneChecked=true;}else{ret[sort].value[osort]=false;}}
if(oneChecked==false){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}
break;case 6:var val=$(sort+'-textInput').value;if(!$(sort+'QMtextInputOptional')){if(!val.length){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}}
var maxLen;if((maxLen=$(sort+'QMtextInputMaxLen'))!=null){maxLen=parseInt(maxLen.value);if((maxLen>0)&&(maxLen<val.length)){alert('QUESTION_TEXT_TOO_LONG');return false;}}
ret[sort].value=encodeRowForPost(val);break;}}
displayWait('Tallentaa vastaukset kysymyksiin');var json=JSON.stringify(ret);json=encodeForPost(json);var resp=postAndWaitForResponse('/job/savespontanswers/','questions='+json);removeWait();if(resp!='1'){alert(resp);return false;}
return true;}
function updateCharsLeft(box,max)
{if(box.value.length>max){$(box.id+'_counter').style.color='red';}else{$(box.id+'_counter').style.color='black';}
$(box.id+'_counter').innerHTML=box.value.length+'/'+max;}
function getManualPositionAnswers()
{var ret=[];var sort=1;var qm=$('qm-1');for(;qm;qm=$('qm-'+(++sort))){var qmId=parseInt(qm.value);ret[sort]={'type':qmId};switch(qmId){case 1:if(!$(sort+'-yes').checked&&!$(sort+'-no').checked){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}
ret[sort].value=($(sort+'-yes').checked==true)?'yes':'no';break;case 2:var oneChecked=false;var osort=1;var qmOpt=$(sort+'-opt-'+osort);ret[sort].value=[];for(;qmOpt;qmOpt=$(sort+'-opt-'+(++osort))){if(qmOpt.checked==true){ret[sort].value[osort]=true;oneChecked=true;}else{ret[sort].value[osort]=false;}}
if(oneChecked==false){alert('Kaikkiin kysymyksiin täytyy vastata ennenkuin voitte lähettää anomuksen.');return false;}
break;case 6:ret[sort].value=encodeRowForPost($(sort+'-textInput').value);break;}}
if(ret.length==0){return-1;}
var json=JSON.stringify(ret);json=encodeForPost(json);return json;}
function updateProfileTag(id){var profileTags=document.getElementById('profileTags');if(profileTags.value!=''){displayWait('Tallentaa');loadXMLDoc('/mess/tagprofile/id:'+id+'/folder:'+escape(profileTags.value)+'/',function(){if(req.readyState==4&&req.status==200){removeWait();var idx=profileTags.selectedIndex;if(profileTags.options[idx].innerHTML.substring(0,2)=='* '){profileTags.options[idx].innerHTML=profileTags.options[idx].innerHTML.substring(2);}else{profileTags.options[idx].innerHTML='* '+profileTags.options[idx].innerHTML;}}});}}
function searchUser(){var inn=document.getElementById('user-input');var request;if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{request=new XMLHttpRequest();}catch(ex){request=false;}}else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{request=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){request=false;}}}
if(request){request.open('POST','/mnadmin/user/action:search/',false);request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.send('search='+escape(inn.value));}
document.getElementById('user-result').innerHTML=unescape(request.responseText);return true;}
function adminManageUser(id){window.open('/mnadmin/user/action:manage/id:'+id+'/','adminManageUser'+id,'width=450,height=600,toolbar=0,resizable=0,status=0,menubar=0,scrolling=0');}
function adminAddCompanyUser(){window.open('/mnadmin/user/action:compuserform/','compuserform','width=450,height=600,toolbar=0,resizable=0,status=0,menubar=0,scrolling=0');}
function validateAndSubmit()
{var email=document.getElementById('email').value;var company=document.getElementById('company').value;var phone=document.getElementById('phone').value;var messg=document.getElementById('message').value;var name=document.getElementById('name').value;var subjectSelect=document.getElementById('subject');var subject=subjectSelect.options[subjectSelect.selectedIndex].value;if(name.length<1){alert('Täytä nimi');return;}
if(subject.length<1){alert('Et ole valinnut aihetta.');return;}
if((phone.length<1)&&(email.length<1)){alert('Sinun täytyy joko täyttää sähköpostiosoite tai antaa puhelinnumero jotta voimme ottaa sinuun yhteyttä');return;}
if(messg.length<1){alert('Kirjoita viesti.');return;}
data='email='+htmlspecialchars(email);data+='&phone='+htmlspecialchars(phone);data+='&message='+encodeURIComponent(messg);data+='&subject='+encodeURIComponent(subject);data+='&company='+encodeURIComponent(company);data+='&name='+encodeURIComponent(name);var res=postAndWaitForResponse('/coremodule/contactmail/',data,true);if(res=='1'){document.getElementById('contact_form').reset();alert('Viestisi on lähetetty.');}else{alert(unescape(res));}}
function validateAndSubmitPopup()
{var email=document.getElementById('email').value;var phone=document.getElementById('phone').value;var messg=document.getElementById('message').value;var name=document.getElementById('name').value;var subject=document.getElementById('subject').value;if(name.length<1){alert('Täytä nimi');return;}
if(subject.length<1){alert('Et ole valinnut aihetta.');return;}
if((phone.length<1)&&(email.length<1)){alert('Sinun täytyy joko täyttää sähköpostiosoite tai antaa puhelinnumero jotta voimme ottaa sinuun yhteyttä');return;}
if(messg.length<1){alert('Kirjoita viesti.');return;}
data='email='+htmlspecialchars(email);data+='&phone='+htmlspecialchars(phone);data+='&message='+htmlspecialchars(messg);data+='&subject='+htmlspecialchars(subject);data+='&company='+'';data+='&name='+htmlspecialchars(name);var res=postAndWaitForResponse('/coremodule/contactmail/',data,true);if(res=='1'){alert('Viestisi on lähetetty.');hideMessageBox();}else{alert(unescape(res));}}
function validateAndSubmitInterestForm()
{var name=document.getElementById('interestName').value;var company=document.getElementById('interestCompany').value;var email=document.getElementById('interestEmail').value;var phone=document.getElementById('interestPhone').value;var nrLicense=document.getElementById('interestNrLicense').value;var errorArray=new Array();var y=0;if(name.length<2){errorArray[y]='Nimi';y++;}
if(company.length<2){errorArray[y]='Yritys';y++;}
var regExp=/^[\.a-z0-9_-]+@[a-z0-9_-]+\.[a-z]+$/;if(email.length<5||!regExp.test(email)){errorArray[y]='Sähköposti';y++;}
if(phone.length<6){errorArray[y]='Puhelin';y++;}
if(nrLicense.length<1){errorArray[y]='Lisenssien luku';y++;}
if(errorArray.length>0){var errorString="";for(i=0;i<y;i++){errorString+=errorArray[i];errorString+='\n'}
alert('Seuraavat tiedot puuttuvat tai ovat viallisia: \n'+errorString);return;}
data='name='+htmlspecialchars(name);data+='&company='+htmlspecialchars(company);data+='&email='+htmlspecialchars(email);data+='&phone='+htmlspecialchars(phone);data+='&nrLicense='+htmlspecialchars(nrLicense);var res=postAndWaitForResponse('/coremodule/interestContact/',data,true);if(res=='1'){document.getElementById('interestForm').reset();alert('Kiitos kyselystä! MyNetwork ottaa pian yhteyden teidän kanssa ja esittää kysetyt hintatiedot.');}else{alert(unescape(res));}}
function setAccessLevel(company,state){displayWait('Tallentaa');var response=postAndWaitForResponse('/mypage/acl/','company='+escape(company)+'&state='+escape(state),true);removeWait();if(parseInt(response)==1){document.getElementById('access-'+company).innerHTML='Pääsy';}else{document.getElementById('access-'+company).innerHTML='Pääsy evätty';}}
function displayPDFDownload(id)
{window.open("/pdf/apdf/?uid="+id,"PDF","menubar=0,resizable=1,width=640,height=480");}
function displayProjectPDFDownload(id)
{window.open("/pdf/pdfp/?pid="+id,"PDF","menubar=0,resizable=1,width=640,height=480");}
function removeChoose(box){if(box.options[0].text.substr(0,2)=='[-'){box.remove(0);}}
function checkAccess(pk,action,where)
{var data=getResponseText('/center/checkAccess/pk:'+pk+'/action:'+escape(action)+'/where:'+escape(where)+'/');if(isNaN(data)==true){alert(data);}else if(parseInt(data)==1){return true;}
return false;}
function loadDocsForRecruitment()
{var data=postAndWaitForResponse('/center/loaddocuments/','');if(data==0){alert('Puuttuu');return;}
data=JSON.parse(data);displayMessageBox(data);}
function downloadDocumentForRecruitment(doc,mime,cid)
{window.open('/center/downloadDocForRecruitment/doc:'+doc+'/mime:'+mime+'/cid:'+cid+'/','documentDownload','width=1,height=1,menubar=no,location=no,resizable=no,scrollbars=no,status=no');}
function printJob(id,forceSave,cv,lang)
{var module;if(forceSave==true){updateChanges();if(!checkForChangesAndSave()){return;}}
if(id==null||id==0){if($('job-id')){id=$('job-id').value;}else{var checked=getChecked('posToggles');if(checked.length==0){alert('Sinun täytyy merkata vähintään yksi vaihtoehto.');return;}
for(var cnt=0;cnt<checked.length;cnt++){id=checked[cnt];}}}
if(cv==true){module="cv";}else{module="center"}
var url='/'+module+'/generatead/id:'+id+'/';if(lang!=null){url+=('lang:'+lang+'/');}
window.open(url,'printpdf','left=50,top=50,width=1024,height=768,toolbar=0,resizable=1,status=0,menubar=0,scrollbars=1');}
function downloadPermanentUserCV(id,uid,type)
{window.open('/user/downloadpermanentusercv/id:'+id+'/uid:'+uid+'/type:'+type+'/','cvdownload_'+uid,'width=1,height=1,toolbar=0,resizable=0,status=0,menubar=0,scrolling=0');}
String.prototype.isInt=function()
{return!isNaN(this);};String.prototype.charCode=function()
{return String.fromCharCode(this);};String.prototype.stripWhiteSpace=function()
{return this.replace(/\s+/g,'');};String.prototype.htmlspecialchars=function(){var ret=this;ret=ret.replace(/&/g,'%26');ret=ret.replace(/"/g,'%22');ret=ret.replace(/\'/g,'%27');ret=ret.replace(/</g,'%3C');ret=ret.replace(/>/g,'%3E');return ret;};
var ttId=null;function __displayToolTip(parent,text,doNotDisplayIfHidden)
{var div=$('toolTipDiv');if((doNotDisplayIfHidden==true)&&div.style.display=='none'){return;}
if(!isIE()){div.style.display='table-cell';}else{if(isIE6()){div.style.position='absolute';}
div.style.display='block';}
var yPos=findPosY(parent);div.innerHTML=text;if(!isIE6()){yPos-=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;}
yPos-=div.offsetHeight;var leftPos=(findPosX(parent)+50);var topPos=yPos;if(isIE6()){leftPos=findPosX(parent);}else if(isIE7()){leftPos-=25;}
div.style.left=(leftPos+'px');div.style.top=(topPos+'px');}
function displayToolTip(parent,text)
{if(ttId!=null){return;}
ttId=setTimeout(function(){if(text.substr(0,1)=='!'){postAndCallback(text.substr(1),'',function(data){__displayToolTip(parent,data,true);});text='<img src="/Graphics/Img/Icons/loading.gif" />';}
__displayToolTip(parent,text);},100);}
function hideToolTip()
{var div=document.getElementById('toolTipDiv');div.style.display='none';if(ttId!=null){clearTimeout(ttId);}
ttId=null;}
function hideMessageBox()
{if($('youtubePlayer')){$('youtubePlayer').style.display='block';}
$('message-box-bg').style.display='none';$('message-box').style.display='none';}
function displayMessageBox(message)
{if((typeof message)=='object'){message=message.innerHTML;}
var scroll=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;$('message-box').style.top=((scroll+20)+'px');$('message-box').style.display='block';$('message-box-bg').style.display='block';$('message-box-text').innerHTML=message;}
function loadMessageBox(message,args)
{if(args==null){args='';}
if(message=="login"){if($('youtubePlayer')){$('youtubePlayer').style.display="none";}}
var txt=postAndWaitForResponse('/info/message/id:'+message+'/',args,true);displayMessageBox(txt);}
function loadSupportBox()
{var html=postAndWaitForResponse('/center/loadcompanysupport/');displayMessageBox(html);showCompanyAdmin();}
function showCompanyAdmin()
{var html=postAndWaitForResponse('/center/loadcompanysupportusers/');document.getElementById('contactCompanyAdminUsers').innerHTML=html;}
function loadHelpPage(hlp)
{var txt=getResponseText('/info/help/id:'+hlp+'/',true);displayMessageBox(txt);}
function displayWait(message,noShadow,loading){if(isIE6()==true){var wait=getElement('wait');wait.style.display='block';getElement('waitMessage').innerHTML=message;}else{var waitBg=getElement('wait-bg');var waitBox=getElement('wait-box');if(waitBg&&!noShadow){waitBg.style.display='block';}
var scroll=document.documentElement.scrollTop;waitBox.style.top=((scroll+20)+'px');waitBox.style.display='block';if(loading!=null){message='<div style="height: 50px;">'+'<div style="float: left; height: 50px;">'+'<img style="margin-left: 15px; margin-top: -7px" src="/Graphics/Img/Icons/loading.gif" />'+'</div>'+'<div style="margin-left: 15px; float: left; height: 10px;">'+
message+'</div></div>';}
getElement('waitMessage').innerHTML=message;}}
function removeWait(){setTimeout('disableWait()',250);}
function disableWait(){if(isIE6()==true){var wait=getElement('wait');wait.style.display='none';getElement('waitMessage').innerHTML='';}else{var waitBg=getElement('wait-bg');var waitBox=getElement('wait-box');if(waitBg){waitBg.style.display='none';}
waitBox.style.display='none';getElement('waitMessage').innerHTML='';}}
function displayHelppage(type)
{document.getElementById(type+'Container-Shadow').style.display='block';var data=document.getElementById(type+'Container-Data');if(document.all){document.getElementById(type+'Container-Shadow').style.width=document.documentElement.clientWidth;document.getElementById(type+'Container-Shadow').style.height=document.body.clientHeight;var scroll=document.body.scrollTop;data.style.left=(((parseInt(document.getElementById(type+'Container-Shadow').style.width)/2)-500)+'px');data.style.top=((scroll+100)+'px');}
data.style.display='block';if(document.all){var inputs=document.getElementsByTagName('select');for(var cnt=0;cnt<inputs.length;cnt++){inputs[cnt].style.display='none';}}}
function closeHelppage(type)
{document.getElementById(type+'Container-Shadow').style.display='none';document.getElementById(type+'Container-Data').style.display='none';if(document.all){var inputs=document.getElementsByTagName('select');for(var cnt=0;cnt<inputs.length;cnt++){inputs[cnt].style.display='block';}}
if(isIE()){if($('reloadUI')){displayWait('Lataa');reloadUI();removeWait();}}}
function getSAPPURL(sappid)
{var sappURL='/job/applyforspontaneous/sappid:'+sappid+'/';return sappURL;}
function getSAPPPostData(sappid)
{var sappURL='';var currName=null;var currSapp=null;var inputs=document.getElementsByTagName('*');var dataArray=new Array();var ok=true;var oneChecked=false;var currBox;var sapps=new Array();for(var cnt=0;cnt<inputs.length;cnt++){if(!inputs[cnt].name||(inputs[cnt].name.length<8)||(inputs[cnt].name.substr(0,8)!='question')){continue;}
if(inputs[cnt].id=='selection'){continue;}
currBox=inputs[cnt];if(currName==null||currName!=inputs[cnt].name){if(dataArray.length>0){sappURL+=(('answer_'+currSapp)+'='+dataArray.join(',')+'&');dataArray.length=0;}
if(currName&&(currType==2)){if(oneChecked==false){ok=false;}
oneChecked=false;}
currName=inputs[cnt].name;currSapp=parseInt(inputs[cnt].name.substr(9));currType=(inputs[cnt].type=='textarea'?1:2);sapps[sapps.length]=currSapp+';'+currType;}
if(inputs[cnt].type=='radio'||inputs[cnt].type=='checkbox'){if(inputs[cnt].checked==false){dataArray[dataArray.length]=inputs[cnt].id+';0';}else{dataArray[dataArray.length]=inputs[cnt].id+';1';oneChecked=true;}}else{if(inputs[cnt].value.length==0){ok=false;}else{if(inputs[cnt].id!='selection'){var answerText=inputs[cnt].value;answerText=htmlspecialchars(answerText);answerText=answerText.replace(/,/g,'%COMMA%');answerText=answerText.replace(/;/g,'%SEMICOLON%');answerText=answerText.replace(/:/g,'%COLON%');sappURL+=(('answer_'+currSapp)+'='+inputs[cnt].id+';'+answerText+'&');}}}}
if(dataArray.length>0){if(currBox.type=='radio'||currBox.type=='checkbox'){if(oneChecked==false){ok=false;}}
sappURL+=(('answer_'+currSapp)+'='+dataArray.join(',')+'&');}
sappURL+=('questions='+sapps.join(','));if(ok==false){alert('Sinun tulee vastata kaikkiin kysymyksiin');return false;}
return sappURL;}
function relogin()
{var username=document.getElementById('email').value;var password=document.getElementById('pass').value;var dest=document.getElementById('DEST').value;var url='/coremodule/login/username:'+escape(username);url+='/password:'+hex_md5(password)+'/?nocandidate=1';displayWait('Kirjautuu sisään...');var response=postAndWaitForResponse(url,'',true);removeWait();if(response>=1&&response<=3){if(dest==''){if(response=='1'){document.location=baseUrl+'/cv/edit/'}else if(response=='2'){document.location=baseUrl+'/center/'}else if(response=='3'){document.location=baseUrl+'/mnadmin/'}}else{document.location=baseUrl+dest;}
document.getElementById('ERROR_BOX').style.display='none';}else{if(response=='-1'){var html=getResponseText('/info/message/id:companyCandidate/',true);displayMessageBox(html);$('tmp_pass').value=password;$('tmp_user').value=username;return;}else{document.getElementById('ERROR_MSG').innerHTML=unescape(response);document.getElementById('ERROR_BOX').style.display='block';}}
return;}
function login(applyToPosID,where,candidate,confirmcandidate)
{var password=document.getElementById('password').value;var username=document.getElementById('username').value;var keep=(document.getElementById('password-keep-yes').checked==true?'1':'0');if(password!=''){password=hex_md5(password);}
var args='username='+escape(username)+'&password='+password+'&keep='+escape(keep);if(applyToPosID!=null&&applyToPosID!=0){args+=('&apply='+applyToPosID);}
if(candidate){args+='&candidate=1';}
if(confirmcandidate){args+='&confirmcandidate=1';}
displayWait('Kirjautuu sisään...');var response=postAndWaitForResponse('/coremodule/login/',args,true);removeWait();if(applyToPosID!=null&&applyToPosID!=0){if(response!='1'){alert(response);}else{if(where!=null&&where!=0){document.location=baseUrl+'/job/apply/'+applyToPosID+'/'+where+'/';}else{document.location=baseUrl+'/job/apply/'+applyToPosID+'/';}}
return;}
var systemUpdate;if(response=='1'){systemUpdate=postAndWaitForResponse('/coremodule/systemUpdate/','');document.location=baseUrl+'/mypage/user/'+(systemUpdate=='0'?'':'update:1/');}else if(response=='2'){systemUpdate=postAndWaitForResponse('/coremodule/systemUpdate/','');document.location=baseUrl+'/center/'+(systemUpdate=='0'?'':'update:1/');}else if(response=='3'){document.location=baseUrl+'/mnadmin/';}else if(response=='4'){document.location=baseUrl+'/mnadmin/language/';}else{if(response=='-1'){var html=getResponseText('/info/message/id:companyCandidate/',true);displayMessageBox(html);$('tmp_pass').value=password;$('tmp_user').value=username;return;}else if(response.split(';').length==2){var data=response.split(';');if(data[0]=='apply'){document.location='/job/apply/'+data[1]+'/';}
return;}
alert(unescape(response));}}
function activateCompanyCandidate()
{hideMessageBox();login(null,null,true,true);}
function createNewUser(cid,pos,where,internal)
{var EMA=document.getElementById('EMA');var EMA2=document.getElementById('EMA2');var PA1=document.getElementById('PA1');var PA2=document.getElementById('PA2');var FOR=document.getElementById('FOR');var SUR=document.getElementById('SUR');var TUR=document.getElementById('TUR');var ACC=document.getElementById('ACC');if(EMA.value!=EMA2.value){alert('Sähköpostiosoitteet eivät täsmää');return;}
if(PA1.value!=PA2.value){alert('Salasana ei täsmää');return;}
if(PA1.value.length<6){alert('Salasana on liian lyhyt. Vähintään 6 merkkinen on hyväksytty!');return;}
var regExp=/^[\.a-z0-9_-]+@[\.a-z0-9_-]+\.[a-z]{1,4}$/;if(trim(EMA.value)==''||EMA.value.indexOf('@')==-1||EMA.value.indexOf('.')==-1||!regExp.test(EMA.value)){alert('Virheellinen sähköpostiosoite!');return;}
if(trim(FOR.value)==''){alert('Etunimi on pakollinen!');return;}
if(trim(SUR.value)==''){alert('Sukunimi on pakollinen!');return;}
if(TUR&&trim(TUR.value)==''){alert('Kirjoita vahvistuskoodi');}
if(!ACC.checked){alert('Sinun tulee hyväksyä kaikki ehdot virkaan!');return;}
url='/coremodule/register/action:createnewuser/';url+='PAS:'+hex_md5(PA1.value)+'/';url+='EMA:'+escape(EMA.value)+'/';url+='FOR:'+escape(FOR.value)+'/';url+='SUR:'+escape(SUR.value)+'/';if(TUR!=null){url+='TUR:'+escape(TUR.value)+'/';}
if(cid!=null){url+='cid:'+cid+'/';}
if(pos!=null){url+='pos:'+pos+'/';}
if(internal!=null){url+='internal:'+internal+'/';}
displayWait('Luo tilin');loadXMLDoc(url,function(){if(req.readyState==4&&req.status==200){removeWait();if(req.responseText!='1'&&req.responseText!='2'){if(req.responseText.split(';').length==2){var data=req.responseText.split(';');if(data[0]=='apply'){if(where!=0||where!=null){document.location=baseUrl+'/job/apply/'+data[1]+'/'+where+'/';return;}else{window.location='/job/apply:'+data[1]+'/';return;}}}
alert(unescape(req.responseText));}else{window.location='/cv/edit/page:11/';}}},true);}
function loginAndSA(sappid){var password=document.getElementById('password').value;var username=document.getElementById('username').value;var keep=(document.getElementById('password-keep-yes').checked==true?'1':'0');var args='username='+escape(username)+'&password='+hex_md5(password)+'&keep='+escape(keep);var sappURL=getSAPPURL(sappid);var sappDATA=getSAPPPostData(sappid);if(sappDATA==false){return;}
displayWait('Kirjautuu sisään...');var response=postAndWaitForResponse('/coremodule/login/',args,true);removeWait();if(response=='1'){document.location.href='/job/apply/'+sappid+'/spont:1/';return;}else if(response=='2'||response=='3'||response=='4'){alert('YOU_CANNOT_SEND_A_SPONTANEOUS_APPLICATION');}else{alert(unescape(response));}}
function createNewUserAndSA(cid,sappid)
{var EMA=document.getElementById('EMA');var EMA2=document.getElementById('EMA2');var PA1=document.getElementById('PA1');var PA2=document.getElementById('PA2');var FOR=document.getElementById('FOR');var SUR=document.getElementById('SUR');var TUR=document.getElementById('TUR');var ACC=document.getElementById('ACC');if(EMA.value!=EMA2.value){alert('<lang>EMAILS_DOES_NOT_MATCH");?>');return;}
if(PA1.value!=PA2.value){alert('Salasana ei täsmää');return;}
if(PA1.value.length<6){alert('Salasana on liian lyhyt. Vähintään 6 merkkinen on hyväksytty!');return;}
if(trim(EMA.value)==''||EMA.value.indexOf('@')==-1||EMA.value.indexOf('.')==-1){alert('Virheellinen sähköpostiosoite!');return;}
if(trim(FOR.value)==''){alert('Etunimi on pakollinen!');return;}
if(trim(SUR.value)==''){alert('Sukunimi on pakollinen!');return;}
if(TUR&&trim(TUR.value)==''){alert('Kirjoita vahvistuskoodi');}
if(!ACC.checked){alert('Sinun tulee hyväksyä kaikki ehdot virkaan!');return;}
url='/coremodule/register/action:createnewuser/';url+='PAS:'+hex_md5(PA1.value)+'/';url+='EMA:'+escape(EMA.value)+'/';url+='FOR:'+escape(FOR.value)+'/';url+='SUR:'+escape(SUR.value)+'/';if(TUR!=null){url+='TUR:'+escape(TUR.value)+'/';}
if(cid!=null){url+='cid:'+cid+'/';}
var sappURL=getSAPPURL(sappid);var sappDATA=getSAPPPostData(sappid);if(sappDATA==false){return;}
displayWait('Luo tilin');loadXMLDoc(url,function(){if(req.readyState==4&&req.status==200){removeWait();if(req.responseText=='1'){document.location.href='/job/apply/'+sappid+'/spont:1/';}else{alert(req.responseText);}}},true);return;}
function approveMemberTerms(){if(document.getElementById('ACC')){document.getElementById('ACC').checked=true;}
hideMessageBox();}
