// F O R M __ V A L I D A T I O N

function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="password")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Felaktiga uppgifter!")
return false
}
else
return true
}



// F O R M __ V A L I D A T I O N 2

function emailvalidation(entered, alertbox)
{
// E-mail-Validation (c) Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove the this line and the two lines above.
with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}

function emptyvalidation(entered, alertbox)
{
// Emptyfield-Validation (c) Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove the this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function formvalidation(thisform)
{
with (thisform)
{
if (emptyvalidation(name,"Saknar namn")==false) {name.focus(); return false;};
if (emptyvalidation(subject,"Saknar adress")==false) {subject.focus(); return false;};
if (emailvalidation(epost,"Skriv korrekt epost")==false) {epost.focus(); return false;};
if (emptyvalidation(message,"Meddelandet är tomt")==false) {message.focus(); return false;};
}
}

function formvalidation2(thisform)
{
with (thisform)
{
if (emptyvalidation(message,"Glöm inte att lämna en kommentar")==false) {message.focus(); return false;};
}
}

function formvalidation3(thisform)
{
with (thisform)
{
if (emptyvalidation(name,"Ange antal barn och ålder")==false) {name.focus(); return false;};
if (emptyvalidation(subject,"Ange antal barnbarn och ålder")==false) {subject.focus(); return false;};
if (emptyvalidation(message,"Ange datum eller vecka")==false) {message.focus(); return false;};
}
}

function formvalidation666(thisform)
{
with (thisform)
{
if (emptyvalidation(name,"Saknar namn")==false) {name.focus(); return false;};
if (emptyvalidation(subject,"Saknar adress")==false) {subject.focus(); return false;};
if (emptyvalidation(postnr2,"Saknar postnr")==false) {postnr2.focus(); return false;};
if (emptyvalidation(telefon,"Saknar telefon")==false) {telefon.focus(); return false;};
if (emailvalidation(epost,"Skriv korrekt epost")==false) {epost.focus(); return false;};
}
}

//D E L E T E __ L I N K __ C O N T R O L L

function performDelete(DestURL) {
var ok = confirm("Vill du ta bort informationen?");
if (ok) {location.href = DestURL;}
return ok;
}
