var nav01_on = new Image();
var nav02_on = new Image();
var nav03_on = new Image();
var nav04_on = new Image();
var nav05_on = new Image();
var nav06_on = new Image();
var nav07_on = new Image();

var nav01_off = new Image();
var nav02_off = new Image();
var nav03_off = new Image();
var nav04_off = new Image();
var nav05_off = new Image();
var nav06_off = new Image();
var nav07_off = new Image();

function redirectURL() {
   window.location=window.document.selector.redirection.value;
}


function prepareNavi(lang) {
   nav01_on.src = "/files/mark/" + lang + "/nav01_act.gif";
   nav02_on.src = "/files/mark/" + lang + "/nav02_act.gif";
   nav03_on.src = "/files/mark/" + lang + "/nav03_act.gif";
   nav04_on.src = "/files/mark/" + lang + "/nav04_act.gif";
   nav05_on.src = "/files/mark/" + lang + "/nav05_act.gif";
   nav06_on.src = "/files/mark/" + lang + "/nav06_act.gif";
   nav07_on.src = "/files/mark/" + lang + "/nav07_act.gif";

   nav01_off.src = "/files/mark/" + lang + "/nav01_inact.gif";
   nav02_off.src = "/files/mark/" + lang + "/nav02_inact.gif";
   nav03_off.src = "/files/mark/" + lang + "/nav03_inact.gif";
   nav04_off.src = "/files/mark/" + lang + "/nav04_inact.gif";
   nav05_off.src = "/files/mark/" + lang + "/nav05_inact.gif";
   nav06_off.src = "/files/mark/" + lang + "/nav06_inact.gif";
   nav07_off.src = "/files/mark/" + lang + "/nav07_inact.gif";



}

function img_act(imgName) {
   imgOn = eval(imgName + "_on.src");
   document [imgName].src = imgOn;
}

function img_inact(imgName) {
   imgOff = eval(imgName + "_off.src");
   document [imgName].src = imgOff;
}

function openWindow(url,width,height) {
window.open(url,'popup','scrollbars=no,resizable=no,location=no,toolbar=no,width='+width+',height='+height);
}


function init_extranet_fields(lang){
	if (lang=="fi"){
	setTimeout("document.getElementById('extra_passwd').value = '';document.getElementById('extra_user').value = '';document.getElementById('extra_passwd').blur();document.getElementById('extra_user').value='käyttäjätunnus';",200);
	}
	if (lang=="se"){
	setTimeout("document.getElementById('extra_passwd').value = '';document.getElementById('extra_user').value = '';document.getElementById('extra_passwd').blur();document.getElementById('extra_user').value='användar-ID';",200);
	}
	if (lang=="en"){
	setTimeout("document.getElementById('extra_passwd').value = '';document.getElementById('extra_user').value = '';document.getElementById('extra_passwd').blur();document.getElementById('extra_user').value='user name';",200);
	}
}

function switch_passwd(hide_show){
	if (hide_show=='hide'){
	document.getElementById('password_text').style.visibility = "hidden";
	}
	if (hide_show=='show'){
	document.getElementById('password_text').style.visibility = "visible";
	}
	if (hide_show=='hide'){
	document.getElementById('extra_passwd').focus();
	}
}

function adminNavigator(action){
document.getElementById('admin_pages_dropdown').style.display = 'none';
document.getElementById('admin_johtokunta_lista_edit').style.display = 'none';
document.getElementById('admin_johtokunta_lista_add').style.display = 'none';
var valid=true;
if (action==''){
alert('valitse toiminto');
valid = false;
}
if (action=='muokkaa_sivua'){
document.getElementById('admin_pages_dropdown').style.display = 'block';
}
if (action=='lisaa_sivu'){
document.location.href='/admin_lisaa_sivu';
}
if (action=='muokkaa_johtokuntaa'){
document.getElementById('admin_johtokunta_lista_edit').style.display = 'block';
}
if (action=='lisaa_johtokuntaa'){
document.getElementById('admin_johtokunta_lista_add').style.display = 'block';
}
if (action!='muokkaa_sivua'){
document.admin_pages_dropdown.valitsemuokattavasivu.options[0].selected = true;
}
if (action=='muokkaa_kayttajatietoja'){
document.location.href='/admin_kayttajatiedot';
}
if (action=='muokkaa_salasanaa'){
document.location.href='/admin_vaihdasalasana';
}
return valid;

}

function validateForm(arvo){
var valid=true;
if(arvo==''){
alert('valitse toiminto');
valid=false;
}
return valid;
}

function set_paajaosto(luokitus){
var paataso_luokitus=luokitus.substr(0,4);
document.getElementById('cmf_0_2').value=paataso_luokitus;
}


function editJohtokunta(luokitus, mode){
var valid=true;
if(luokitus==''){
alert('valitse johtokunta');
valid=false;
}
if(luokitus!=''&&mode=='edit'){
document.location.href="/admin_muokkaa_johtokuntaa?id=" + luokitus;
}
if(luokitus!=''&&mode=='add'){
document.location.href="/admin_lisaa_johtokuntaa?id=" + luokitus;
}
return valid;
}

function validateAdminSivu(mode){
var valid=true;
if(mode=='add'&&document.getElementById('cmf_0_2').value == ''){
alert('Valitse sivulle yläsivu.');
valid=false;
}
if(mode=='add'&&document.getElementById('cmf_0_3').value == ''){
alert('Kirjoita sivulle nimi.');
valid=false;
}
if(mode=='edit'&&document.getElementById('cmf_0_3').value == ''){
alert('Kirjoita sivulle nimi.');
valid=false;
}
return valid;
}
