
function createConnection( parameter ){
	var xmlhttp;
	var browser = navigator.userAgent;
	if ( browser.indexOf("Gecko") !=-1 || browser.indexOf("Firefox") !=-1 || browser.indexOf("Opera") !=-1 )
		xmlhttp = new XMLHttpRequest();
	if ( browser.indexOf("MSIE") !=-1 ) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");	
	}
	xmlhttp.open('POST', 'commons/countyList.php?megye='+parameter, false);
	xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;');
	xmlhttp.send(parameter);

	return xmlhttp.responseText;
}

function video( vUrl, winName ){
	window.open( "player.php?vid="+vUrl, winName, "width=400, height=350, toolbar=no, resizable=no, status=no, titlebar=no, scrollbars=no, directories=no, location=no, hotkeys=no" );
}

function sound( aUrl, winName ){
	window.open( "audioplayer.php?aid="+aUrl, winName, "width=400, height=90, toolbar=no, resizable=no, status=no, titlebar=no, scrollbars=no, directories=no, location=no, hotkeys=no" );
}

function isNumber( n ){
	if( isNaN( n.value ) ) {
		alert( "Csak számjegy írható a mezőbe!" );
		n.value = "";
	}
}

function showPicture(foto, fototitle){
	window.open("photoview.php?url="+foto+"&ftitle="+fototitle, "photoview", "width=200px, height=100px, statusbar=0, status=0");
}

function checkUerData(){
	var doc = document.forms.letterUserForm;
	var error = false;
	var errorText = "HIBA!\n";

	if( !doc.nev.value || doc.nev.value=="" ){
		error = true;
		errorText += "Nincs megadva név!\n";		
	}

	if( !doc.email.value || doc.email.value=="" ){
		error = true;
		errorText += "Nincs megadva e-mail cím!\n";		
	}

	if( doc.email.value != doc.email2.value ){
		error = true;
		errorText += "A két e-mail cím nem azonos!\n";		
	}

	if( doc.email.value.indexOf("@")==-1 || doc.email.value.indexOf(".")==-1  ){
		error = true;
		errorText += "Az e-mail cím nem megfelelő formátumú!\n";		
	}

	if( error ) alert(errorText);
	else doc.submit();

}

