	
	/*
	*	Function validates all fields in the form sent as parameter
	*/
	function valInput(fFormA) {
		for (var i = 0; i < fFormA.length; i++) {
			if (trim(fFormA.elements[i].value) == "") {
				alert("Du måste ange " + fFormA.elements[i].name);
				return false;
			}
		}
		return true;
	}
	
	
	/*
	*	Function removes preceeding/ending whitespaces on a string
	*/
	function trim(sStrA) {
		var sRet = new String(sStrA);
		var sEmtyStr = " ";
		if (sRet.length > 0) {
			while (sRet.charAt(0) == sEmtyStr || sRet.charAt(sRet.length - 1) == sEmtyStr) {
				if (sRet.charAt(0) == sEmtyStr)
					sRet = sRet.substring(1, sRet.length)
				if (sRet.charAt(sRet.length - 1) == sEmtyStr)
					sRet = sRet.substring(0, sRet.length - 1)
			}
		}
		return sRet
	}
	
	
	
	
	/*
	*	Function swaps img source on argument image
	*/
	function swapImg(iImgA) {
		document.all[iImgA.name].src = eval(iImgA.name + "_b").src
	
	}
	
	
	
	
	/*
	*	Function unSwaps img source on argument image
	*/
	function unSwapImg(iImgA) {
		document.all[iImgA.name].src = eval(iImgA.name).src
	
	}
		
	
	
	
	/*
	*	Function checks email input string for errors
	*/
	function chkEmailAdr(iEmailStrA) {

		var emailexp = /^[A-Za-z0-9]+[\.\-\w\_]*@[A-Za-z0-9][\.\-\w\_]*[\.]{1}[a-z]{2,3}$/ig
		var dotdotexp = /\.\./
	
		return (!dotdotexp.test(iEmailStrA) && emailexp.test(iEmailStrA))
	}
	

 

