window.onload = function() {
	clearDefault();
//	ActivateFlash();
};


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17780181-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

///////////////////////////////////////////////////////////////////////////////
// Email
	var atChar = "@";
	
	var obf_eml = "i"+"n"+"f"+"o";
	obf_eml += atChar;
	obf_eml += "a"+"rt"+"e"+"fo"+"lk"+".hu";

	var obf_eml_royal = "f"+"e"+"s"+"t"+"iv"+"a"+"l";
	obf_eml_royal += atChar;
	obf_eml_royal += "r"+"oy"+"a"+"ld"+"a"+"y"+"s"+".hu";

///////////////////////////////////////////////////////////////////////////////


//////////
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popUp(URL) {
var xtavolsag =((screen.width)-530);
adatok = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=520,height=670,left ="+xtavolsag+",top = 0";
newwindow = window.open(URL, "Galeria", adatok); 
newwindow.focus();
}

function clearDefault(){ 
var dbg='#F0F0F0'; // Background color, Default
var fbg='#FFFFFF'; // Background color, onFocus 
	var tI = document.getElementsByTagName('input'); var tT = document.getElementsByTagName('textarea');
	for (var i = 0; i < tI.length; i++) { 
		if (tI[i] && tI[i].getAttribute('type') != '' && tI[i].getAttribute('type').toLowerCase() == 'text' || tI[i].getAttribute('type').toLowerCase() == 'password') 
		{tI[i].style.backgroundColor = dbg; thisValue = tI[i].getAttribute("title");
			if (thisValue){	tI[i].value = thisValue;} 
			tI[i].onfocus = function(){this.style.backgroundColor = fbg; if (this.value != this.getAttribute("title") && this.value != '') {return;} 
			else {this.value = '';}};
			tI[i].onblur = function(){this.style.backgroundColor = dbg; if (this.value == ''){this.value = this.getAttribute("title");}};}} 
	for (var i = 0; i < tT.length; i++){if (tT[i]){tT[i].style.backgroundColor = dbg; thisValue = tT[i].getAttribute("title");if (thisValue){tT[i].value = thisValue;} 
			tT[i].onfocus = function(){this.style.backgroundColor = fbg; if (this.value != this.getAttribute("title") && this.value != ''){return;}
			else {this.value = '';}};
			tT[i].onblur = function(){this.style.backgroundColor = dbg;if (this.value == ''){this.value =  this.getAttribute("title");}};}} 
}


function checkForm()
{
	var cname, cemail, csubject, cmessage, cnumber;
    with(window.document.msgform)
    {
        cname    = sname;
        cemail   = email;
        csubject = subject;
        cmessage = message;
		cnumber = txtNumber;
    }
    
    if(trim(cname.value) == '')
    {
        alert('Kérem adja meg a nevét');
        cname.focus();
        return false;
    }
    else if(trim(cemail.value) == '')
    {
        alert('Kérem adja meg az email címét');
        cemail.focus();
        return false;
    }
    else if(!isEmail(trim(cemail.value)))
    {
        alert('A megadott email cím hibás');
        cemail.focus();
        return false;
    }
    else if(trim(csubject.value) == '')
    {
        alert('Kérem adja meg üzenete tárgyát');
        csubject.focus();
        return false;
    }
    else if(trim(cmessage.value) == '')
    {
        alert('Az üzenet mező üres');
        cmessage.focus();
        return false;
    }
    else if(trim(cnumber.value) == '')
    {
        alert('Kérem adja meg az ellenőrző kódot');
        cnumber.focus();
        return false;
    }

    else
    {
        cname.value    = trim(cname.value);
        cemail.value   = trim(cemail.value);
        csubject.value = trim(csubject.value);
        cmessage.value = trim(cmessage.value);
        cnumber.value = trim(cnumber.value);
        return true;
    }
}



/*
Strip whitespace from the beginning and end of a string
Input : a string
*/
function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

/*
Check if a string is in valid email format. 
Returns true if valid, false otherwise.
*/
function isEmail(str)
{
    var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
}
function checkFormENG()
{
	var cname, cemail, csubject, cmessage, cnumber;
    with(window.document.msgform)
    {
        cname    = sname;
        cemail   = email;
        csubject = subject;
        cmessage = message;
		cnumber = txtNumber;
    }
    
    if(trim(cname.value) == '')
    {
        alert('Enter your name please');
        cname.focus();
        return false;
    }
    else if(trim(cemail.value) == '')
    {
        alert('Enter your email address');
        cemail.focus();
        return false;
    }
    else if(!isEmail(trim(cemail.value)))
    {
        alert('The email address is not correct');
        cemail.focus();
        return false;
    }
    else if(trim(csubject.value) == '')
    {
        alert('Enter your subject');
        csubject.focus();
        return false;
    }
    else if(trim(cmessage.value) == '')
    {
        alert('Enter your message');
        cmessage.focus();
        return false;
    }
    else if(trim(cnumber.value) == '')
    {
        alert('Enter the verification code');
        cnumber.focus();
        return false;
    }

    else
    {
        cname.value    = trim(cname.value);
        cemail.value   = trim(cemail.value);
        csubject.value = trim(csubject.value);
        cmessage.value = trim(cmessage.value);
        cnumber.value = trim(cnumber.value);
        return true;
    }
}

function checkFormENG2()
{
	var cverification_code;
	var image_random_value;
	
    with(window.document.application)
    {
		cimage_random_value = image_random_value;
		cverification_code = verification_code;
    }
    
    if(trim(cverification_code.value) != trim(cimage_random_value.value))
    {
        alert('Enter the correct verification code');
        cverification_code.focus();
        return false;
    }

    else
    {
        cverification_code.value = trim(verification_code.value);
        return true;
    }
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function ablak(theURL,winName,szelesseg,magassag){
jobbcsucsok=0;
features="width="+szelesseg+",height="+magassag+",scrollbars=no";
jobbcsucsok=screen.width-szelesseg;
msg=window.open("","akarmi",features);

msg.document.close();

msg=window.open("","akarmi",features);

msg.moveTo(jobbcsucsok,0)

//msg.resizeTo(szelesseg,ablakmagassag);
//msg.resizeTo(screen.width,screen.height)
valtozo="<head><html><title>\n";
valtozo+=winName;
valtozo+="</title></head>";
valtozo+="<body leftmargin='0' marginwidth='0' topmargin='0' bottommargin='0' rightmargin='0' >";
valtozo+="<img src=\"";
valtozo+=theURL;
valtozo+="\" />";
valtozo+="</body></html>";

msg.document.writeln(valtozo);
msg.document.close();
msg.focus();
}
