var i=0;
var ie=(document.all)?1:0;
var ns=(document.layers)?1:0;
function initStyleElements()
{var a = document.pad;
if (ie)
{
a.text.style.backgroundColor="#FCB415";
a.submit.style.backgroundColor="#FCB415";
a.submit.style.cursor="hand";
a.clear.style.backgroundColor="#FCB415";
a.clear.style.cursor="hand";
}
else return;
}
function LightOn(what)
{
if (ie) what.style.backgroundColor = '#FCB415', what.style.cursor="hand";  
else return;
}
function LightOff(what)
{if (ie) what.style.backgroundColor = '#FFD987';
else return;
}

//-----------------------------------------------------
//onmeretezo popupablak kepeknek
//-----------------------------------------------------
    function picwin(img)
    {
        popup = window.open('','','toolbar=no,location=no,directories=no,menubar=no,resizable=yes,status=no,scrollbars=auto,width=200,height=100');

    var sz = " "
    + "function getElementStyle(elementId) {"
    + "	if (document.getElementById)"
    + "		return document.getElementById(elementId).style;"
    + "	else if (document.all) "
    + "		return document.all[elementId].style;"
    + "	else if (document.layers) "
    + "		document.layers[elementId];"
    + "}"
    + "function updateWindow() { "
    + "   getElementStyle('wait').display='none';"
    + "   resizeTo(document.images[0].width+40,document.images[0].height+60);"
    + "   window.clearInterval(timer);"
    + "}"
    + "var timer = null;"
    + "function checkImage() { "
    + "    if (document.images.length>0 && (document.images[0].width>0 || document.images[0].height>0)) { "
    + "        resizeTo(document.images[0].width+40,document.images[0].height+60);"
    + "        window.clearInterval(timer);"
    + "    } "
    + "}"
    + "timer = window.setInterval(checkImage, 500);";




    	popup.document.write("<HTML><head><script>"+sz+"</script></head>");
    	popup.document.write('<BODY>');
        popup.document.write('<div id="wait" name="wait" style="position:absolute;left:10px;top:10px; font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: black; background-color: #eee; padding: 2px;">Pillanat türelmet!</div>');
        popup.document.write('<IMG name=kep id=kep src="'+escape( img )+'" style="border: solid 1px black;" border=0 OnClick="self.close()" onLoad="');
        popup.document.write("updateWindow()");
        popup.document.write('"></BODY></HTML>');
    	popup.document.close();
    }

	function ClearIfMust( id )
	{
		var obj = document.getElementById( id );

		if( typeof( obj.Cleared ) == 'undefined' )
		{
			obj.Cleared = 'true';
			obj.value='';
		}
	}

	function checkNEmail(form) {
		if (isBlank_(form.hirlnev.value, "Név" )) {
			alert("Kérjük írja be a nevét.");
			form.hirlnev.focus();
			return false;
		}
		if (isBlank_(form.hirlemail.value, "E-mail") || !isEmailValid(form.hirlemail.value) ) 	{
			alert("Kérjük ellenőrizze a beírt e-mail címet.\nNem tűnik valósnak.");
			form.hirlemail.focus();
			return false;
		}
		return true;
	}

	function checkEmail(form) {
		if (isBlank_(form.hirlemail.value, "E-mail") || !isEmailValid(form.hirlemail.value) ) {
			alert("Kérjük ellenőrizze a beírt e-mail címet.\nNem tűnik valósnak.");
			form.hirlemail.focus();
			return false;
		}
	return true;

	}

	function isBlank_(fieldValue, _blank) {
		var blankSpaces = / /g;
		fieldValue = fieldValue.replace(blankSpaces, "");
		return (fieldValue == "" || fieldValue == _blank) ? true : false;
	}

	function isEmailValid(fieldValue) {
		var emailFilter = /^.+@.+\..{2,4}$/;
		var atSignFound = 0;
		for (var i = 0; i <= fieldValue.length; i++)
			if ( fieldValue.charAt(i) == "@" )
				atSignFound++;
		if ( atSignFound > 1 )
			return false;
		else
			return ( emailFilter.test(fieldValue) && !doesEmailHaveInvalidChar(fieldValue) ) ? true : false;
	}

	function doesEmailHaveInvalidChar(fieldValue) {
		var illegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\] ]/;
		return ( illegalChars.test(fieldValue) ) ? true : false;
	}


