<!--
	function CategoryChange(Cat,Id){
		var URL = ("adm_change_category.asp?kategori=" + Cat + "&id=" + Id);
		location.href = URL;
	}
	
	function deleteCourseCategory(Cat,Id){
		var URL = ("adm_delete_category.asp?id=" + Id);
		location.href = URL;
	}
	
	function tabort() // Säkerhetskoll vid borttagning
	{
		if (confirm ("Detta kommando går inte att ångra. Vill du fortsätta?"))
			document.form1.submit();
		else
			return false;
	}

	function CheckCustomerForm() // Kontrollerar vissa fält är ifyllda
	{
		var flag = 0;
		var mess = "";
	
		if (document.customer.organisation.value == "")
		{
			mess = (mess + "Var vänlig fyll i företagsnamn!\n");
			flag = 1;
		}
		if (document.customer.orgnr.value == "")
		{
			mess = (mess + "Var vänlig fyll i organisationsnummer!\n");
			flag = 1;
		}
		if (document.customer.bransch.value == "")
		{
			mess = (mess + "Var vänlig fyll i bransch!\n");
			flag = 1;
		}
		if (document.customer.postnr.value == "")
		{
			mess = (mess + "Var vänlig fyll i postnr!\n");
			flag = 1;
		}
		if (document.customer.ort.value == "")
		{
			mess = (mess + "Var vänlig fyll i ort!\n");
			flag = 1;
		}
		if (document.customer.telefon.value == "")
		{
			mess = (mess + "Var vänlig fyll i telefon!\n");
			flag = 1;
		}
		if (document.customer.epost.value == "")
		{
			mess = (mess + "Var vänlig fyll i epost!\n");
			flag = 1;
		}
		
		if(flag == 1){
			alert(mess);
			return false;
		}
	}

	//Kollar att namn är ifyllt i anmälan - dock endast på onBlur
	function checkName(formItem){
		if (formItem.value == "")
		{
			alert("Du har glömt att fylla i deltagarnamn!");
			return false;
		}
		else
		return true;
	}
	
	// Kontrollerar att vissa fält är ifyllda
	function checkNyKurs()
	{
		
	var flag = 0;
	var mess = "";
	
		if (document.form1.ArtikelNr.value == "")
		{
			mess = (mess + "Var vänlig fyll i kursnummer!\n");
			flag = 1;
		}
		if (document.form1.ProductName.value == "")
		{
			mess = (mess + "Var vänlig fyll i kursnamn!\n");
			flag = 1;
		}
		if (document.form1.Category.value == "")
		{
			mess = (mess + "Var vänlig fyll i kategori!\n");
			flag = 1;
		}/*
		if (document.customer.adress.value == "")
		{
			mess = (mess + "Var vänlig fyll i adress!\n");
			flag = 1;
		}
		if (document.customer.postnr.value == "")
		{
			mess = (mess + "Var vänlig fyll i postnummer!\n");
			flag = 1;
		}
		if (document.customer.ort.value == "")
		{
			mess = (mess + "Var vänlig fyll i ort!\n");
			flag = 1;
		}
		if (document.customer.telefon.value == "")
		{
			mess = (mess + "Var vänlig fyll i telefonnummer!\n");
			flag = 1;
		}
		*/
	if(flag == 1){
		alert(mess);
		return false;
		}
	}


	function areAllNumbers(item){
	for(var j=0; j < item.length; j++){
		if(!isNumber (item.charAt(j))) {return false}
		}
		return true
	}

	function isNumber(item){
	numeric = "01234556789"
	for (var i = 0; i < numeric.length; i++){
	if (item == numeric.charAt (i)) {return true}
		}
	return false
	}

	// sökning
	function SearchHandler(){
		var Cri = document.searchform.criterium.value;
		var Cat = document.searchform.category.value;
		var URL = ("ehandel_search_2.asp?category=" + Cat + "&criterium=" + Cri);
		parent.content.location.href = URL;
	}
	
	
	// Lista vald kategori
	function CategoryHandler(){
		var Cat = document.categoryform.kategori.value;
		var URL = ("ehandel_lista_produkter.asp?category=" + Cat );
		parent.content.location.href = URL;
	}
	
	function orderCourseBy(vOrderBy){
		var Cat = document.all.category.value;
		var URL = ("ehandel_lista_produkter.asp?category=" + Cat + "&orderby=" + vOrderBy);
		document.location.href = URL;
		
	}
	
	function searchCourseBy(vOrderBy){
		var Cri = document.all.criterium.value;
		var Cat = document.all.category.value;
		var URL = ("ehandel_search_2.asp?category=" + Cat + "&criterium=" + Cri + "&orderby=" + vOrderBy);
		document.location.href = URL;
		
	}
	
	//Lägger i en ny kurs i kundvagnen
	function CartHandler(antal,ProdNr){
		antal = 1;	
		var URL = ("ehandel_cart.asp?prodid=" + ProdNr +"&antal=" + antal);
		//var URLb = ("ehandel_cashier.asp");
		parent.cart.location.href = URL;
		//parent.content.location.href = URLb;
		ShowBooking(antal,ProdNr);	
		
	}
	
	//Ändrar antalet för en kurs i kundvagnen
	function CashierHandler(antal,ProdNr){
		var URLb = ("ehandel_update_cart.asp?update=1&prodid=" + ProdNr +"&antal=" + antal);
		document.customer.action=URLb;
		document.customer.submit();

	}
	
	//Ta bort enskild vara från kundvagnen
	function CashierDelete(ProdNr){
		var URL = ("ehandel_delete_from_cart.asp?prodid=" + ProdNr);
		var URLb = ("ehandel_cart.asp?prodid=" + ProdNr);
		parent.content.location.href= URL;
		parent.cart.location.href = URLb;
	}
	
	
	//Tömmer kundvagn ex vid  färdigt köp
	function EmptyCart(){
		//var URL = ("ehandel_empty_cart.asp");
		//var URLb = ("ehandel_cashier.asp");
		//parent.cart.location.href = URL;
		//parent.content.location.href = URLb;	
	}
	
	//Tömmer kundvagn ex vid  färdigt köp
	function InitCart(){
	var URL = ("ehandel_empty_cart.asp");
	document.cart.location.href = URL;
	}
	
	function isFloat(ch) {
	if ( (ch >= '0' && ch <= '9') || ch == ',' || ch == '.' )
		return true;
	return false;
}

function floatCheck(procent)
{
	for (n = 0; n < procent.length; n++)
		if ( ! isFloat(procent.charAt(n)))
			return false;
		return true;
}

function checkFloat(formItem) {
	if(!floatCheck(formItem.value)) {
		alert('Värdet måste vara en siffra!');
		formItem.focus();
		formItem.select();
		return;
	}
	var str, re;
	re = /,/g;
	str = formItem.value;	
	formItem.value = str.replace(re, ".");		
}

function ShowHelp(){
NewWindow = window.open("HelpWindow.asp","Remote","height=250px, width=150px,status=yes, toolbar=no, menubar=no,location=no, top=30, left=30, edgeStyle=raised")
}

function fetch(url) {
        window.opener.location.href = url
}

	
// sökning
	function REMSearchHandler(){
	var Cri = document.searchform.criterium.value;
	var Cat = document.searchform.category.selectedIndex-1;
	var URL = ("ehandel_search_2.asp?category=" + Cat + "&criterium=" + Cri);
	window.opener.content.location.href = URL;
	}
	
	// Lista vald kategori
	function REMCategoryHandler(){
	var Cat = document.categoryform.kategori.value;
	var URL = ("ehandel_lista_produkter.asp?category=" + Cat );
	window.opener.content.location.href = URL;
	}
// -->


function ShowBooking(antal,ProdNr){
	var URL = ("ehandel_cashier_2_ny.asp?antal=" + antal + "&ProdNr=" + ProdNr);
	NewWindow = window.open(URL,"Remote","height=540px, width=640px,status=yes, toolbar=no, menubar=no,location=no, top=30, left=30, edgeStyle=raised, scrollbars=yes")
}

function deleteCourse(vNot){
	var URL = ("ehandel_empty_cart.asp");
	window.opener.parent.cart.location.href = URL;
	window.close();
	return;
}

function showCourseWin(vURL){
	
	NewWindow = window.open(vURL,"Booking","height=600px, width=800px,status=yes, toolbar=no, menubar=no,location=no, top=30, left=30, edgeStyle=raised, scrollbars=yes")
	
}

function showPUL(){

	URL = ("include/pul.html");
	NewWindow = window.open(URL,"PUL","height=600px, width=640px,status=yes, toolbar=no, menubar=no,location=no, top=50, left=50, edgeStyle=raised, scrollbars=yes")	
	
}