<!-- Hide from older browsers...

//Function to check form is filled in correctly before submitting
function CheckForm () {

	var errorMsg = "";
	
	//Check for a Username
	if (document.frmMembers.Name.value==""){
	
		alert("Namn är ett obligatoriskt fält. Ange för- och efternamn");
		document.frmMembers.Name.focus();
		return false;
	}

	//Check for the address
	if (document.frmMembers.Adress.value==""){
	
		alert("Adress är ett obligatoriskt fält. Ange adress och postadress");
		document.frmMembers.Adress.focus();
		return false;
	}
	
	//Check for the address
	if (document.frmMembers.Postadress.value==""){
	
		alert("Adress är ett obligatoriskt fält. Ange adress och postadress");
		document.frmMembers.Postadress.focus();
		return false;
	}

	//Check for the phone
	if (document.frmMembers.Telefon.value==""){
	
		alert("Telefon är ett obligatoriskt fält. Ange telefonnr där vi kan nå dig");
		document.frmMembers.Telefon.focus();
		return false;
	}

	//Check for the e-mail
	var email = document.frmMembers.EMail.value;
	if (!(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/.test(email))){
		alert("E-Mail är ett obligatoriskt fält. Ange en adress som du bevakar");
		document.frmMembers.EMail.focus();
		return false;
	}

	return true
}

//Function to check whisky form
function CheckWhiskyForm () {

    var errorMsg = "";
    
    //Check for whisky name
    if (document.frmWhisky.Name.value==""){
    
       alert("Namn är obligatoriskt");
       document.frmWhisky.Name.focus();
       return false;
    }
}

//Function to select action from Medlemsmatrikeln
function SelectAction(Show) {

   	strShow = escape(Show.options[Show.selectedIndex].value);

   	self.location.href = unescape(strShow);
	return true;

}

//Function to check feedback form is filled in correctly before submitting
function CheckFeedback () {

	var errorMsg = "";
	
	//Check for a Username
	if (document.frmEnquiry.Username.value==""){
	
		alert("Namn är obligatoriskt");
		document.frmEnquiry.Username.focus();
		return false;
	}

	//Check for the e-mail address
	if (document.frmEnquiry.UserEmail.value==""){
	
		alert("Ange din e-post adress så att vi kan kontakta dig.");
		document.frmEnquiry.UserEmail.focus();
		return false;
	}
	
	return true
}

//Function to validate application
function ValidateApply () {

	var errorMsg = "";
	var x = document.getElementById("frmApply");

	if (x.applied.value == "0"){
	 	if (x.C1.checked == false){
	
			alert("Du måste bekräfta din anmälan");
			x.C1.focus();
			return false;
		}
	}
		
    for (var i = 0; i < x.length; i++) {
        if(x.elements[i].value == "" && x.elements[i].title) {
            alert(x.elements[i].title + " måste fyllas i.");
            x.elements[i].focus();
            return false;
        }
    }
	return true;
}

//Function to validate contest
function ValidateContest () {

	var errorMsg = "";
	
	//Check for a Name
	if (document.contestform.subject.value==""){
	
		alert("Namn är obligatoriskt");
		document.contestform.subject.focus();
		return false;
	}

	//Check for a startdate
	if (document.contestform.startdate.value==""){
	
		alert("Startdatum för tävlingen är obligatoriskt");
		document.contestform.startdate.focus();
		return false;
	}
	
	//Check for a enddate
	if (document.contestform.enddate.value==""){
	
		alert("Slutdatum för tävlingen är obligatoriskt");
		document.contestform.enddate.focus();
		return false;
	}

	return true

}

//Function to validate questions in a contest
function ValidateQuery () {

	var checkbox_choices = 0
	
	if (document.queryform.sort.value==""){
		alert("Sortering är ett obligatoriskt fält. Du anger i vilken ordning frågorna ska komma");
		document.queryform.sort.focus();
		return false;
	}
	
	for (counter = 0; counter < document.queryform.C1.length; counter++){

		// If a checkbox has been selected it will return true
		// (If not it will return false)
		if (document.queryform.C1[counter].checked){
			checkbox_choices = checkbox_choices + 1;
		}
	}
	
	if (checkbox_choices == 0){
		alert("Minst ett alternativ måste markeras som rätt svar!");
		return false;
	}

	return true
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

//Function to choose how many topics are show
function ShowTopics(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "AL=" + strShow

   	if (Show != "") self.location.href = "activities.asp";
	return true;
}

//Function to show applied members
function ShowReported(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "RL=" + strShow

   	if (Show != "") self.location.href = "reported.asp";
	return true;
}

//Function to choose how many topics are show
function ShowInfo(Show,Type){

   	strShow = escape(Show.options[Show.selectedIndex].value);

   	if (Show != "") self.location.href = "listinfo.asp?sort=" + strShow + "&type=" + Type ;
	return true;
}

//Function to choose how many topics are show
function ShowWhiskies(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "TL=" + strShow

   	if (Show != "") self.location.href = "whiskies.asp";
	return true;
}

//Function to choose how many topics are show
function ShowDestillery(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "DL=" + strShow

   	if (Show != "") self.location.href = "destilleries.asp";
	return true;
}

//Function to choose news source
function ShowSource(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "newssource=" + strShow

   	if (Show != "") self.location.href = "extNews.asp";
	return true;
}

//Function to choose how many topics are show
function NumGuests(Show){

   	strShow = escape(Show.options[Show.selectedIndex].value);
   	document.cookie = "nGuests=" + strShow

   	window.location.reload( true );
	return true;
}

//Function to get a cookie
function GetCookie(c_name) {
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1){
			c_start=c_start + c_name.length01
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
			}
		}
	return null
}
// -->