
function openWindow(clickLink) {
	newWindow = window.open(clickLink,'newWindow','location=no,status=no,width=500,height=350');
}

function resizeMemberWindow() {
	window.resizeTo(1030,800);
}

function calculateBMI() {
	bmiHeight = parseFloat(document.getElementById('bmi_height').value);
	bmiWeight = parseFloat(window.getElementById('bmi_weight').value);
	
	alert(bmiHeight);
	alert(bmiWeight);
	
	bmi = parseInt(33); //(bmiWeight / (bmiHeight*2));
	calculatedBMI = "<p>Ditt BMI är " + bmi + "</p>";
	
	document.getElementById('bmiMessage').innerHTML = calculatedBMI;
	document.getElementById('bmiMessage').style.display = "block";

}




// Kontrollera om mail är valid // -------------------------

function checkMemberForm() {
	var inputMail = document.getElementById('inputNewMember').value;
	
	var srch1 = inputMail.indexOf("@");
	var srch2 = inputMail.indexOf(".");
			   
		if (srch1 == "-1" || srch2 == "-1") {
			document.getElementById("errorFieldOne").style.display = "block";
			return false;
		} else {
			return true;
			}			  
}

function checkMember() {
	var inputMail2 = document.getElementById('inputMember').value;
	
	var srch21 = inputMail2.indexOf("@");
	var srch22 = inputMail2.indexOf(".");
			   
		if (srch21 == "-1" || srch22 == "-1") {
			document.getElementById("errorFieldTwo").style.display = "block";
			return false;
		} else {
			return true;
			}			  
}

// ----------------------------------------------- //

	$(document).ready(function() {
		
			baseURL = location.protocol + "//";
			baseURL = baseURL + location.host;
			baseURL = baseURL + location.pathname

			$("#meny a").each(function() {
				
				theLink = baseURL;
				theLink = theLink.replace("http://www.stavgang.se/", "");
				theLink = theLink.replace("http://stavgang.se/", "");				
				theLink = theLink.replace("http://www.fjall-vandring.se/", "");
				theLink = theLink.replace("http://fjall-vandring.se/", "");
				theLink = theLink.replace("http://www.vandringsstavar.se/", "");
				theLink = theLink.replace("http://vandringsstavar.se/", "");
				
				//if (theLink == "") { theLinkIndex = "index.html"; }
				
			  if($(this).attr('href') == theLink) {
				($(this).addClass('redlink'));
			  }
			});
			
	});
