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=yes,resizable=yes" + (width>0 ? ",width="+width+",height="+height : ""));

}


function generatePword(form) {
	var type=form.type.selectedIndex;
	if (type<4) {
		var selectionarray=new Array(62)
		selectionarray[1]="A";
		selectionarray[2]="B";
		selectionarray[3]="C";
		selectionarray[4]="D";
		selectionarray[5]="E";
		selectionarray[6]="F";
		selectionarray[7]="G";
		selectionarray[8]="H";
		selectionarray[9]="I";
		selectionarray[10]="J";
		selectionarray[11]="K";
		selectionarray[12]="L";
		selectionarray[13]="M";
		selectionarray[14]="N";
		selectionarray[15]="O";
		selectionarray[16]="P";
		selectionarray[17]="Q";
		selectionarray[18]="R";
		selectionarray[19]="S";
		selectionarray[20]="T";
		selectionarray[21]="U";
		selectionarray[22]="V";
		selectionarray[23]="W";
		selectionarray[24]="X";
		selectionarray[25]="Y";
		selectionarray[26]="Z";
		selectionarray[27]="0";
		selectionarray[28]="1";
		selectionarray[29]="2";
		selectionarray[30]="3";
		selectionarray[31]="4";
		selectionarray[32]="5";
		selectionarray[33]="6";
		selectionarray[34]="7";
		selectionarray[35]="8";
		selectionarray[36]="9";
		selectionarray[37]="a";
		selectionarray[38]="b";
		selectionarray[39]="c";
		selectionarray[40]="d";
		selectionarray[41]="e";
		selectionarray[42]="f";
		selectionarray[43]="g";
		selectionarray[44]="h";
		selectionarray[45]="i";
		selectionarray[46]="j";
		selectionarray[47]="k";
		selectionarray[48]="l";
		selectionarray[49]="m";
		selectionarray[50]="n";
		selectionarray[51]="o";
		selectionarray[52]="p";
		selectionarray[53]="q";
		selectionarray[54]="r";
		selectionarray[55]="s";
		selectionarray[56]="t";
		selectionarray[57]="u";
		selectionarray[58]="v";
		selectionarray[59]="w";
		selectionarray[60]="x";
		selectionarray[61]="y";
		selectionarray[62]="z";
		var length=62;
	  }
	if (type<3) {
		var selectionarray=new Array(36);
		selectionarray[1]="a";
		selectionarray[2]="b";
		selectionarray[3]="c";
		selectionarray[4]="d";
		selectionarray[5]="e";
		selectionarray[6]="f";
		selectionarray[7]="g";
		selectionarray[8]="h";
		selectionarray[9]="i";
		selectionarray[10]="j";
		selectionarray[11]="k";
		selectionarray[12]="l";
		selectionarray[13]="m";
		selectionarray[14]="n";
		selectionarray[15]="o";
		selectionarray[16]="p";
		selectionarray[17]="q";
		selectionarray[18]="r";
		selectionarray[19]="s";
		selectionarray[20]="t";
		selectionarray[21]="u";
		selectionarray[22]="v";
		selectionarray[23]="w";
		selectionarray[24]="x";
		selectionarray[25]="y";
		selectionarray[26]="z";
		selectionarray[27]="0";
		selectionarray[28]="1";
		selectionarray[29]="2";
		selectionarray[30]="3";
		selectionarray[31]="4";
		selectionarray[32]="5";
		selectionarray[33]="6";
		selectionarray[34]="7";
		selectionarray[35]="8";
		selectionarray[36]="9";
		var length=36;
	  }
	if (type<2) {
		var selectionarray=new Array(36);
		selectionarray[1]="A";
		selectionarray[2]="B";
		selectionarray[3]="C";
		selectionarray[4]="D";
		selectionarray[5]="E";
		selectionarray[6]="F";
		selectionarray[7]="G";
		selectionarray[8]="H";
		selectionarray[9]="I";
		selectionarray[10]="J";
		selectionarray[11]="K";
		selectionarray[12]="L";
		selectionarray[13]="M";
		selectionarray[14]="N";
		selectionarray[15]="O";
		selectionarray[16]="P";
		selectionarray[17]="Q";
		selectionarray[18]="R";
		selectionarray[19]="S";
		selectionarray[20]="T";
		selectionarray[21]="U";
		selectionarray[22]="V";
		selectionarray[23]="W";
		selectionarray[24]="X";
		selectionarray[25]="Y";
		selectionarray[26]="Z";
		selectionarray[27]="0";
		selectionarray[28]="1";
		selectionarray[29]="2";
		selectionarray[30]="3";
		selectionarray[31]="4";
		selectionarray[32]="5";
		selectionarray[33]="6";
		selectionarray[34]="7";
		selectionarray[35]="8";
		selectionarray[36]="9";
		var length=36;
	}
	
	if (form.length.selectedIndex > 0)  {
	var lngth=form.length.selectedIndex + 3;
	var i,j;
	var tmpstr;
	tmpstr="";
	i=0;
	do {
	{
		var randscript = -1
		while (randscript < 1 || randscript > length || isNaN(randscript))
		{randscript = parseInt(Math.random()*(length))}
		j=randscript}
		tmpstr=tmpstr+selectionarray[j]
		i=i+1}
		while (i<lngth)
		form.password.value = tmpstr;
	}
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}

function ValidateForm(objForm)
{
	if(objForm.Namn.value == "")
	{
		alert("Ange Namn!");
		return false;
	}
	else	
		return true;
}

function ValidateFormFI(objForm)
{
	if(objForm.Namn.value == "")
	{
		alert("Anna Nimi!");
		return false;
	}
	else	
		return true;
}

function ValidateMIForm(objForm)
{
	if(objForm.Kursnamn.value == "")
	{
		alert("Ange kurs namn!");
		return false;
	}
	
	if(objForm.kursnummer.value == "")
	{
		alert("Ange kursnummer!");
		return false;
	}
	
	if(objForm.DeltagarNamn.value == "")
	{
		alert("Ange ditt namn!");
		return false;
	}
	
	if(objForm.DeltagarAdress.value == "")
	{
		alert("Ange din adress!");
		return false;
	}
	
	if(objForm.PostnummerOrt.value == "")
	{
		alert("Ange postnummer och ort!");
		return false;
	}
	
	if(objForm.Telefon.value == "")
	{
		alert("Ange telefon!");
		return false;
	}
	
	if(objForm.Epost.value == "")
	{
		alert("Ange E-post!");
		return false;
	}
	
	return true;
}

function ValidateMIFormFI(objForm)
{
	if(objForm.Kursnamn.value == "")
	{
		alert("Kurssin nimi puuttuu!");
		return false;
	}
	
	if(objForm.kursnummer.value == "")
	{
		alert("Kurssinumero puuttuu!");
		return false;
	}
	
	if(objForm.DeltagarNamn.value == "")
	{
		alert("Nimi puuttuu!");
		return false;
	}
	
	if(objForm.DeltagarAdress.value == "")
	{
		alert("Osoite puuttuu!");
		return false;
	}
	
	if(objForm.PostnummerOrt.value == "")
	{
		alert("Postinumero ja osoite puuttuu!");
		return false;
	}
	
	if(objForm.Telefon.value == "")
	{
		alert("Puhelinnumero puuttuu!");
		return false;
	}
	
	if(objForm.Epost.value == "")
	{
		alert("Sähköposti puuttuu!");
		return false;
	}
	
	return true;
}