// Fixar den fula ramen som IE ger "besökta länkar"
function fixUglyIE(){
	for (a in document.links) document.links[a].onfocus = document.links[a].blur;
}

if (document.all){
	 document.onmousedown = fixUglyIE;
}

function changeBkground(id,link){
	id.style.backgroundColor = "#003366";
	link.style.color = "#ffffff";
}
function changeBack(id,link){
	id.style.backgroundColor = "#99ccff";
	link.style.color = "#000000";
}

function changeText(id){
	id.style.color = "#ffffff";
}
function changeTextBack(id){
	id.style.color = "#000000";
}

var popUpWin;
function popup(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(path, "popUpWin","scrollbars=no,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

} 

function popupBar(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(path, "popUpWin","scrollbars=no,menubar=yes,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

}

function popupFull(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(path, "popUpWin","scrollbars=no,menubar=yes,scrollbars=yes,personalbar=yes,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

}

function popupScroll(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(path, "popUpWin","scrollbars=yes,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

} 

function popupScrollResize(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(path, "popUpWin","scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

}

function popupDoc(path,width,height){

	if(popUpWin)popUpWin.close();
	popUpWin=window.open(escape(path), "popUpWin","scrollbars=yes,width=" + width + ",height=" + height + ",dependent=no,top=150,left=150");
	popUpWin.self.focus();

} 

function its_showtime(){
	nu =  new Date();
	tim = nu.getHours();
	min = nu.getMinutes();
	sek = nu.getSeconds();

	varde = tim;
	varde += ((min < 10) ? ":0" : ":") + min;
	varde += ((sek < 10) ? ":0" : ":") + sek;
	setTimeout("its_showtime()",1000);
	//document.tidig.tid.value = varde; 
	Clock.innerHTML = varde;
}

//Datumfunktionen
function its_showDay(){
	s_date = new Date();
    var weekDay = "";

	selectMonth = new Array(12);
			selectMonth[0] = "januari";
			selectMonth[1] = "februari";
			selectMonth[2] = "mars";
			selectMonth[3] = "april";
			selectMonth[4] = "maj";
			selectMonth[5] = "juni";
			selectMonth[6] = "juli";
			selectMonth[7] = "augusti";
			selectMonth[8] = "september";
			selectMonth[9] = "oktober";
			selectMonth[10] = "november";
			selectMonth[11] = "december";

	if(s_date.getDay() == 1){
			weekDay = "Måndagen";
	}
	if(s_date.getDay() == 2){
			weekDay = "Tisdagen";
	}
	if(s_date.getDay() == 3){
			weekDay = "Onsdagen";
	}
	if(s_date.getDay() == 4){
			weekDay = "Torsdagen";
	}
	if(s_date.getDay() == 5){
			weekDay = "Fredagen";
	}
	if(s_date.getDay() == 6){
			weekDay = "Lördagen";
	}
	if(s_date.getDay() == 7){
			weekDay = "Söndagen";
	}
	if(s_date.getDay() == 0){
			weekDay = "Söndagen";
	}


	var setYear = s_date.getYear();

	var BName = navigator.appName;

	 if(BName == "Netscape"){
         var setYear = s_date.getYear() + 1900;}
	
	varde= weekDay + " den "  +s_date.getDate() +  " "+ selectMonth[s_date.getMonth()] +" " + setYear
	
	Datum.innerHTML = varde;
}

// Vi kollar att formuläret är korrekt ifyllt när anv ska skicka det
function validateForm(daForm)
{
	if(	daForm.forening.value == ""){
		alert("Du har glömt att fylla i \nFöreningens namn");
		return false;
	}
	else if( daForm.deltkort.value == ""){
		alert("Du har glömt att fylla i \nAntal deltagarkort");
		return false;
	}
	else if( daForm.kontakt.value == ""){
		alert("Du har glömt att fylla i namnet på en \nKontaktperson");
		return false;
	}
	else if( daForm.adress.value == ""){
		alert("Du har glömt att fylla i \nAdress");
		return false;
	}
	else if( daForm.postnr.value == ""){
		alert("Du har glömt att fylla i \nPostnummer");
		return false;
	}
	else if( daForm.ort.value == ""){
		alert("Du har glömt att fylla i \nOrt");
		return false;
	}
	else if( daForm.email.value == ""){
		alert("Du har glömt att fylla i \nNågon emailadress");
		return false;
	}
	else if( daForm.tfnhem.value == ""&& daForm.tfnarb.value == "" && daForm.cell.value == ""){
		alert("Du har glömt att fylla i ett telefonnummer \ndär vi kan nå kontaktpersonen\nDet räcker med ett av de tre alternativen");
		return false;
	}
	else if( daForm.classID.value < 1){
		alert("Du har glömt att välja åldersklass");
		return false;
	}
	else if( daForm.antLag.value == ""){
		alert("Du har glömt att ange \nAntal lag");
		return false;
	}
	else
	{
		return true;
	}
}


