function submit_login(e)
{
    if (typeof e != 'undefined' && !enter_key_trap(e)) {
        return;
    }

    if (document.imp_login.imapuser.value == "") {
        alert('Please provide your username.');
        document.imp_login.imapuser.focus();
		return false;
    } else if (document.imp_login.pass.value == "") {
        alert('Please provide your password.');
        document.imp_login.pass.focus();
		return false;
    } else {
        return true;
    }
}

function clear_form() {
document.imp_login.reset(); 
document.imp_login.pass.style.display='none';
document.imp_login.textword.style.display='inline';
}

function changePassField(el) {
	el.form.textword.style.display='none';
	el.form.password.style.display='inline';
	el.form.password.select();
}

function changeEpostPassField(el) {
	el.form.textword.style.display='none';
	el.form.pass.style.display='inline';
	el.form.pass.select();
}

function popup_scroll(location, width, height){
   OpenWin = this.open(location, "help",'toolbar=no,menubar=no,location=no,scrollbars=yes,resize=no,width='+width+',height='+height+'screenX=50,left=50,screenY=50,top=50');
}

function popup_chat(location, width, height) {
   OpenWin = this.open(location, "chatwnd",'toolbar=no,menubar=no,location=no,scrollbars=yes,resize=yes,width='+width+',height='+height+',screenX=50,left=50,screenY=50,top=50');
}



function help(){

   popup_scroll('index.php3?use=help&helpuse={USE}&helpcmd={CMD}', 450, 350);

}



function print(){

   if(document.location.search.length>0)

      loc = 'index.php3'+document.location.search+'&s_tpl=print';

   else

      loc = '?&s_tpl=print';

   OpenWin = this.open(loc, "help",'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resize=no,width='+780+',height='+400+'screenX=10,left=10,screenY=10,top=10');

}



function PopUpWin(source,name,width,height) {

        if(width>0) {

          width = width + 20;

          height = height + 20;

        }

        window.open(source, name,"location=0,toolbar=no,menubar=no,scrollbars=no,resizable=yes" + (width>0 ? ",width="+width+",height="+height : ""));

}

function Validera(theForm)
   {
     if (theForm.Fornamn.value == "")
     {
       alert("Ange förnamn!");
       theForm.Fornamn.focus();
       return (false);
     }    
	 
	 if (theForm.Efternamn.value == "")
     {
       alert("Ange efternamn!");
       theForm.Efternamn.focus();
       return (false);
     }    
	 
	 if (theForm.Fodelsedatum.value == "")
     {
       alert("Ange födelsedatum!");
       theForm.Fodelsedatum.focus();
       return (false);
     }    
	 
	 if (theForm.Telefon.value == "")
     {
       alert("Ange telefonnummer!");
       theForm.Telefon.focus();
       return (false);
     }    
	 
	 if (theForm.Gatuadress.value == "")
     {
       alert("Ange gatuadress!");
       theForm.Gatuadress.focus();
       return (false);
     }    
	 
	 if (theForm.Postadress.value == "")
     {
       alert("Ange postadress!");
       theForm.Postadress.focus();
       return (false);
     }    
	 
	 if (theForm.kommentar.value == "")
     {
       alert("Fyll i information om dig själv!");
       theForm.kommentar.focus();
       return (false);
     }    
	 
	 if (theForm.Epost.value != "")
     {
       at=theForm.Epost.value.indexOf("@")
       if (at == -1)
	   {
	     alert("Ange en giltig E-post adress!");
	     theForm.Epost.focus();
	     return (false);
	   }
	 
	   pnt=theForm.Epost.value.indexOf(".")
	   if (pnt == -1)
	   {
	     alert("Ange en giltig E-post adress!");
	     theForm.Epost.focus();
	     return (false);
	   }
	 }
   }


function Validera_fi(theForm)
   {
     if (theForm.Fornamn.value == "")
     {
       alert("Kirjoita etunimi!");
       theForm.Fornamn.focus();
       return (false);
     }    
	 
	 if (theForm.Efternamn.value == "")
     {
       alert("Kirjoita sukunimi!");
       theForm.Efternamn.focus();
       return (false);
     }    
	 
	 if (theForm.Fodelsedatum.value == "")
     {
       alert("Kirjoita syntymäaika!");
       theForm.Fodelsedatum.focus();
       return (false);
     }    
	 
	 if (theForm.Telefon.value == "")
     {
       alert("Kirjoita puhelinnumero!");
       theForm.Telefon.focus();
       return (false);
     }    
	 
	 if (theForm.Gatuadress.value == "")
     {
       alert("Kirjoita katuosoite!");
       theForm.Gatuadress.focus();
       return (false);
     }    
	 
	 if (theForm.Postadress.value == "")
     {
       alert("Kirjoita postiosoite!");
       theForm.Postadress.focus();
       return (false);
     }    
	 
	 if (theForm.kommentar.value == "")
     {
       alert("Täytä tietoja itsestäsi!");
       theForm.kommentar.focus();
       return (false);
     }    
	 
	 if (theForm.Epost.value != "")
     {
       at=theForm.Epost.value.indexOf("@")
       if (at == -1)
	   {
	     alert("Kirjoita voimassa oleva s-postiosoite!");
	     theForm.Epost.focus();
	     return (false);
	   }
	 
	   pnt=theForm.Epost.value.indexOf(".")
	   if (pnt == -1)
	   {
	     alert("Kirjoita voimassa oleva s-postiosoite!");
	     theForm.Epost.focus();
	     return (false);
	   }
	 }
   }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function clickepost(pre,dom,adr)
{
	window.location.replace('mailto:' +adr+ '@' +dom+pre);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
