
function checkProductForm(oForm){
	if(oForm.clientNameOrder.value==""){
		alert(orderAlert[2]);
		oForm.clientNameOrder.focus();
		return false
	}
	if(oForm.clientEmailOrder.value==""){
		alert(orderAlert[7]);
		oForm.clientEmailOrder.focus();
		return false;
	}
	if(!checkMail(oForm.clientEmailOrder,claimAlert[8])) return false	
	if(oForm.clientAddressOrder.value==""){
		alert(orderAlert[4]);
		oForm.clientAddressOrder.focus();
		return false
	}
	if(oForm.clientZoneCodeOrder.value==""){
		alert(orderAlert[5]);
		oForm.clientZoneCodeOrder.focus();
		return false
	}
	if(oForm.clientZoneOrder.value==""){
		alert(orderAlert[6]);
		oForm.clientZoneOrder.focus();
		return false
	}
	if(oForm.clientTelOrder.value==""){
		alert(orderAlert[8]);
		oForm.clientTelOrder.focus();
		return false
	}	
	return true
}

function checkCourseForm(oForm){
	var bCheck = false;
	for(i=0;i<oForm.elements.length;i++){
		if(oForm.elements[i].type=="checkbox"&&oForm.elements[i].name!="AcceptClaim"&&oForm.elements[i].checked==true){
			var bCheck = true;
			oForm.elements[i].name = "Course: " + oForm.elements[i].name;
		}
	}
	if(!bCheck){
		alert(claimAlert[0])
		return false
	}
	if(oForm.clientNameClaim.value==""){
		alert(claimAlert[1]);
		oForm.clientNameClaim.focus();
		return false
	}
	if(oForm.clientEmailClaim.value==""){
		alert(claimAlert[2]);
		oForm.clientEmailClaim.focus();
		return false;
	}
	if(!checkMail(oForm.clientEmailClaim,claimAlert[8])) return false	
	if(oForm.clientAddressClaim.value==""){
		alert(claimAlert[3]);
		oForm.clientAddressClaim.focus();
		return false
	}
	if(oForm.clientZoneCodeClaim.value==""){
		alert(claimAlert[4]);
		oForm.clientZoneCodeClaim.focus();
		return false
	}
	if(oForm.clientZoneClaim.value==""){
		alert(claimAlert[5]);
		oForm.clientZoneClaim.focus();
		return false
	}
	if(oForm.clientTelClaim.value==""){
		alert(claimAlert[6]);
		oForm.clientTelClaim.focus();
		return false
	}	
	if(!oForm.AcceptClaim.checked){
		alert(claimAlert[7]);
		oForm.AcceptClaim.focus();
		return false
	}						
	return true
	//if(oForm.)
	//oForm.submit();

	return false	
}
function checkContactForm(oForm){
	var oForm = document.forms["contactForm"]
	return checkMail(oForm.Email, claimAlert[8])
}


function checkTipsForm(){
	var oForm = document.forms["tipsForm"]
	if(checkMail(oForm.receiverEmail.value, oForm.receiverEmail)){
		return checkMail(oForm.senderEmail.value, oForm.senderEmail)
	}
	else return false
}




function checkMaillistForm(sInputValue){
	if(document.forms['maillistForm'].MemberName.value ==""){
		alert(noNameML);
		return false;
	}
	else{
		document.forms['maillistForm'].SubmitMode.value = (document.forms['maillistForm'].Status[0].checked)? "create":"delete"
		var myRe = /[a-z0-9_.=-]+@([a-z0-9-]+\.)+([a-z]{2,3})/i;
		if (!(sInputValue).match(myRe))	{
			alert(emailErrorML)
			return false
		}
		else {
			return true
		}
	}
}		

function checkMail(oFormField,sAlert){
	var myRe = /[a-z0-9_.=-]+@([a-z0-9-]+\.)+([a-z]{2,3})/i;
	if (!(oFormField.value).match(myRe))	{
		alert(sAlert)
		oFormField.focus()
		return false
	}
	else {
		return true
	}
}


function validera(){
	if(document.order.kund.value == ""){alert("Du måste fylla i fältet: Kund!");document.order.kund.focus();return false;}
	if(document.order.objekt.value == ""){alert("Du måste fylla i fältet: Objekt!");document.order.objekt.focus();return false;}
	if(document.order.contact.value == ""){alert("Du måste fylla i fältet: Kontaktperson!");document.order.contact.focus();return false;}
	if(document.order.adress.value == ""){alert("Du måste fylla i fältet: Adress!");document.order.adress.focus();return false;}
	if(document.order.postnr.value == ""){alert("Du måste fylla i fältet: Postnummer!");document.order.postnr.focus();return false;}
	if(document.order.ort.value == ""){alert("Du måste fylla i fältet: Ort!");document.order.ort.focus();return false;}
	if(document.order.phone.value == ""){alert("Du måste fylla i fältet: Telefon!");document.order.phone.focus();return false;}
	if(document.order.todo.value == ""){alert("Du måste fylla i fältet: Vad ska göras!");document.order.todo.focus();return false;}
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(order.email.value)){
	return (true)
	}
	alert("Du har angivit en ogiltig epostadress. Kontrollera den angivna adressen!")
	return (false)
}

function setImageSize(oObj){

}


 function setDeliveryInfoLikeInvoiceInfo(oFormElm){
	var oContactForm = document.forms["courseForm"];	
	if(oFormElm.checked){
		oContactForm.invoiceName.value = oContactForm.clientNameClaim.value;
		oContactForm.invoiceAddress.value = oContactForm.clientAddressClaim.value;
		oContactForm.invoiceZoneCode.value = oContactForm.clientZoneCodeClaim.value;
		oContactForm.invoiceZone.value = oContactForm.clientZoneClaim.value;
	}
	else{
		oContactForm.invoiceName.value = "";
		oContactForm.invoiceAddress.value = "";
		oContactForm.invoiceZoneCode.value = "";
		oContactForm.DeliveryCity.value = "";	
		oContactForm.invoiceZone.value = "";
	}
 }

 function setDeliveryInfoLikeInvoiceInfoDiv(oFormElm){
	var oContactForm = document.forms["courseForm"];	
	if(oFormElm.checked) oFormElm.checked = false;
	else oFormElm.checked = true;
	setDeliveryInfoLikeInvoiceInfo(oFormElm)
 }
 
