/*A projekthez tartozó összes JS funkció gyűjtője*/

function toggleIt(node) {
	if (document.getElementById(node).style.display == "none") {
		document.getElementById(node).style.display = "block";
	} else {
		document.getElementById(node).style.display = "none";
	}
}

function popUp(url, windowName, height, width) {
	var wnd = window.open(url, windowName, "height="+height+",width="+width+",status=no,menubar=no,resizable=no,directories=no,locationbar=no");
	wnd.focus();
}

function popUpScroll(url, windowName, height, width) {
	var wnd = window.open(url, windowName, "height="+height+",width="+width+",status=no,menubar=no,resizable=no,directories=no,locationbar=no,scrollbars=yes");
	wnd.focus();
}

function imgPopUp(image, width, height) {
	var imagePopUp = popUpScroll("img_popup.php?image=" + image, "imagePopUp", height, width);
}

function map(where) {
	var actualUrl = "http://www.hill.hu";
	if (where == "budapest") {
		window.location.href = actualUrl + "/hill_budapest/";
	}
	if (where == "szombathely") {
		window.location.href = actualUrl + "/hill_szombathely/";
	}
	if (where == "pecs") {
		window.location.href = actualUrl + "/hill_pecs/";
	}
	if (where == "debrecen") {
		window.location.href = actualUrl + "/hill_debrecen/";
	}
}

function map_en(where) {
	var actualUrl = "http://www.hill.hu";
	if (where == "budapest") {
		window.location.href = actualUrl + "/hill_budapest_en/";
	}
	if (where == "szombathely") {
		window.location.href = actualUrl + "/hill_szombathely_en/";
	}
	if (where == "pecs") {
		window.location.href = actualUrl + "/hill_pecs_en/";
	}
	if (where == "debrecen") {
		window.location.href = actualUrl + "/hill_debrecen_en/";
	}
}

function checkLogin() {
	var	pattern = /^[0-9a-zA-Z\.-_]+@[0-9a-zA-Z\.-]+\.[a-zA-Z]{2,4}$/i;
	if (document.forms.loginForm.email.value == "" || document.forms.loginForm.password.value == "" || document.forms.loginForm.email.value == "e-mail" || document.forms.loginForm.password.value == "jelszó") {
		alert("Bejelentkezéshez kérjük, töltse ki a mezőket");
		return false;
	} else if (pattern.test(document.forms.loginForm.email.value) == false) {
		alert("Nem megfelelő e-mail cím");
		return false;
	} else {
		return true;
	}
}

function forgotPassword(url, page) {
	var	pattern = /^[0-9a-zA-Z\.-_]+@[0-9a-zA-Z\.-]+\.[a-zA-Z]{2,4}$/i;
	if (document.forms.loginForm.email.value == "" || document.forms.loginForm.email.value == "e-mail") {
		alert("A jelszó elküldéséhez kérjük, adja meg e-mail címét");
	} else if (pattern.test(document.forms.loginForm.email.value) == false) {
		alert("Nem megfelelő e-mail cím");
	} else {
		window.location.href = url + "/forgot.php?email=" + document.forms.loginForm.email.value + "&page=" + page;
	}
}
