
var isNS4 = (navigator.appName=="Netscape")?1:0;

function selectmenu(c){
document.getElementById('countrymenu').style.display = 'block';

	if(c != 0){
	document.getElementById('country').value = c;
	document.getElementById('countrymenu').style.display = 'none';
	}
}

// egy div láthatóságának állítása
function ShowHideDiv(elem, mode, text){
	document.getElementById(elem).style.display = mode;	
	if(text != '')
	document.getElementById(elem).innerHTML = text;
}


// regisztráció és rendelés form ellenörzése

// inputok

function defineArray(){
inputs = new Array();
inputs[1] = document.getElementById('firstname'); 
inputs[2] = document.getElementById('lastname');
inputs[3] = document.getElementById('address');
inputs[4] = document.getElementById('city');
inputs[5] = document.getElementById('zip');
inputs[6] = document.getElementById('country');
inputs[7] = document.getElementById('telephone');
inputs[8] = document.getElementById('email');
inputs[9] = document.getElementById('password');	
return inputs;
}

function validateForm(){

var inputs = defineArray();

	for(var i=1; i<10; i++){
		if(inputs[i].value == ''){
		ShowHideDiv('errormsg', 'block', 'Minden mező kitöltése kötelező');
		return false;
		}
	}
	
	if(validateEmail())
	return true;
	
return false;
}

//ha input mezőbe csak számot lehet írni 
function validateNumber(e){
var key;
	if(window.event) key = window.event.keyCode; else key = e.which;
	
	for(i=48; i<58; i++){
			if(key == i || key == 8)
			return true;
	}
	
return false;
}

// formailag helyes email cím ellenörzés
function validateEmail(){
var x = document.getElementById('email').value;
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if (filter.test(x)){ 
	return true;
	}
	else{
	ShowHideDiv('errormsg', 'block', 'Hibás email cím');
	return false;
	}
}

// menu over out
function MenuOverOut(elem, mode, color){
	if(mode == 1){
	elem.style.borderLeftColor = '#d9107a'
	elem.style.backgroundColor = color; // over
	//elem.style.color = '#cccccc';
	}
	if(mode == 0){
	elem.style.borderLeftColor = '#495f84'
	elem.style.backgroundColor = color; // out
	//elem.style.color = '#f2f2f2';
	}
}
