var iedom=navigator.appName=='Microsoft Internet Explorer';


function addEvent(obj, evType, fn) 
{ 
	if (obj.addEventListener) 
	{ 
		obj.addEventListener(evType, fn, true); 	
		return true; 
	} 
	else if (obj.attachEvent) 
	{ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} 
	else 
	{ 
		return false; 
	} 
}

function kulso_link() 
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");

	for (var i=0; i<anchors.length; i++) 
	{
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "kulso")
		{
		    anchor.target = "_blank";
	
		}
	}
}

function input_torol(txt)
{
	var doErase = (!txt.erased && txt.value == txt.defaultValue);
	if(doErase) 
	{
		txt.value = '';
		txt.select();
	}
	txt.erased = true;
	return doErase;
}

function csere(gomb,kep)
{
	document.getElementById(gomb).src=kep;

}

function hirlevel_teszt()
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	document.hirlevel.hirlevel_email.style.border = "1px solid #F90"
	if (!emailfilter.test(document.hirlevel.hirlevel_email.value))
	{ 
		document.hirlevel.hirlevel_email.style.border = "1px solid red"
		document.hirlevel.hirlevel_email.focus()
		return false
	}
}

function vendegkonyv_teszt()
{
	document.vendegkonyv.vendegkonyv_nev.style.border = "2px solid #FFCB63"
	document.vendegkonyv.vendegkonyv_uzenet.style.border = "2px solid #FFCB63"
	document.vendegkonyv.szam.style.border = "2px solid #FFCB63"
	
	if (document.vendegkonyv.vendegkonyv_nev.value == "") 
	{
		document.vendegkonyv.vendegkonyv_nev.style.border = "2px solid red"
		document.vendegkonyv.vendegkonyv_nev.focus()
		return false
	}
	
	if (document.vendegkonyv.vendegkonyv_uzenet.value == "") 
	{
		document.vendegkonyv.vendegkonyv_uzenet.style.border = "2px solid red"
		document.vendegkonyv.vendegkonyv_uzenet.focus()
		return false
	}
	
	if (document.vendegkonyv.szam.value == "") 
	{
		document.vendegkonyv.szam.style.border = "2px solid red"
		document.vendegkonyv.szam.focus()
		return false
	}
}

function keres_teszt()
{
	document.keres.keresmezo.style.border = "1px solid #81C6C6"
	if (document.keres.keresmezo.value == "") 
	{
		document.keres.keresmezo.style.border = "1px solid red"
		document.keres.keresmezo.focus()
		return false
	}
}


function regisztracio_teszt()
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	var nevfilter=/^[0-9a-z]/;
	document.regisztracio.teljes_nev.style.border = "2px solid #FFCB63"
	document.regisztracio.regisztracio_nev.style.border = "2px solid #FFCB63"
	document.regisztracio.regisztracio_email.style.border = "2px solid #FFCB63"
	document.regisztracio.regisztracio_jelszo_1.style.border = "2px solid #FFCB63"
	document.regisztracio.regisztracio_jelszo_2.style.border = "2px solid #FFCB63"
	document.regisztracio.szam.style.border = "2px solid #FFCB63"
		
	if (document.regisztracio.teljes_nev.value == "") 
	{
		document.regisztracio.teljes_nev.style.border = "2px solid red"
		document.regisztracio.teljes_nev.focus()
		return false
	}
		
	if (!nevfilter.test(document.regisztracio.regisztracio_nev.value))
	{ 
		document.regisztracio.regisztracio_nev.style.border = "2px solid red"
		document.regisztracio.regisztracio_nev.focus()
		return false
	}

	if (!emailfilter.test(document.regisztracio.regisztracio_email.value))
	{ 
		document.regisztracio.regisztracio_email.style.border = "2px solid red"
		document.regisztracio.regisztracio_email.focus()
		return false
	}

	if (document.regisztracio.regisztracio_jelszo_1.value == "") 
	{
		document.regisztracio.regisztracio_jelszo_1.style.border = "2px solid red"
		document.regisztracio.regisztracio_jelszo_1.focus()
		return false
	}

	if (document.regisztracio.regisztracio_jelszo_2.value == "") 
	{
		document.regisztracio.regisztracio_jelszo_2.style.border = "2px solid red"
		document.regisztracio.regisztracio_jelszo_2.focus()
		return false; 
        }

	if (document.regisztracio.regisztracio_jelszo_2.value != document.regisztracio.regisztracio_jelszo_1.value) 
	{
		document.regisztracio.regisztracio_jelszo_2.style.border = "2px solid red"
		document.regisztracio.regisztracio_jelszo_2.focus()
		alert("A két jelszó nem egyezik!")
		return false; 
     }

	 if (document.regisztracio.szam.value == "") 
	{
		document.regisztracio.szam.style.border = "2px solid red"
		document.regisztracio.szam.focus()
		return false
	}
}


function kerdes_teszt()
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	var nevfilter=/^[0-9a-zA-Z]/;
	document.kerdes.cimzett.style.border = "2px solid #FFCB63"
	document.kerdes.kerdes_nev.style.border = "2px solid #FFCB63"
	document.kerdes.kerdes_email.style.border = "2px solid #FFCB63"
	document.kerdes.kerdes_telefon.style.border = "2px solid #FFCB63"
	document.kerdes.kerdes_uzenet.style.border = "2px solid #FFCB63"
	document.kerdes.szam.style.border = "2px solid #FFCB63"
	
	if (document.kerdes.cimzett.value == "") 
	{
		document.kerdes.cimzett.style.border = "2px solid red"
		document.kerdes.cimzett.focus()
		return false
	}
	
	if (!nevfilter.test(document.kerdes.kerdes_nev.value))
	{ 
		document.kerdes.kerdes_nev.style.border = "2px solid red"
		document.kerdes.kerdes_nev.focus()
		return false
	}

	if (!emailfilter.test(document.kerdes.kerdes_email.value))
	{ 
		document.kerdes.kerdes_email.style.border = "2px solid red"
		document.kerdes.kerdes_email.focus()
		return false
	}
	
	if (document.kerdes.kerdes_telefon.value == "") 
	{
		document.kerdes.kerdes_telefon.style.border = "2px solid red"
		document.kerdes.kerdes_telefon.focus()
		return false
	}

	if (document.kerdes.kerdes_uzenet.value == "") 
	{
		document.kerdes.kerdes_uzenet.style.border = "2px solid red"
		document.kerdes.kerdes_uzenet.focus()
		return false; 
    }

	if (document.kerdes.szam.value == "") 
	{
		document.kerdes.szam.style.border = "2px solid red"
		document.kerdes.szam.focus()
		return false
	}
}

function hazhoz_visszuk_teszt()
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	document.uzenet.input1.style.border = "2px solid #FFCB63"
	document.uzenet.input3.style.border = "2px solid #FFCB63"
	document.uzenet.input4.style.border = "2px solid #FFCB63"
	document.uzenet.input5.style.border = "2px solid #FFCB63"
	document.uzenet.input6.style.border = "2px solid #FFCB63"
	document.uzenet.input7.style.border = "2px solid #FFCB63"
	document.uzenet.input8.style.border = "2px solid #FFCB63"
	document.uzenet.input9.style.border = "2px solid #FFCB63"
	document.uzenet.input10.style.border = "2px solid #FFCB63"
	document.uzenet.captcha.style.border = "2px solid #FFCB63"
	
	if (document.uzenet.input1.value == "") 
	{
		document.uzenet.input1.style.border = "2px solid red"
		document.uzenet.input1.focus()
		return false
	}
	if (document.uzenet.input3.value == "") 
	{
		document.uzenet.input3.style.border = "2px solid red"
		document.uzenet.input3.focus()
		return false
	}
	if (document.uzenet.input4.value == "") 
	{
		document.uzenet.input4.style.border = "2px solid red"
		document.uzenet.input4.focus()
		return false
	}
	if (document.uzenet.input5.value == "") 
	{
		document.uzenet.input5.style.border = "2px solid red"
		document.uzenet.input5.focus()
		return false
	}
	if (document.uzenet.input6.value == "") 
	{
		document.uzenet.input6.style.border = "2px solid red"
		document.uzenet.input6.focus()
		return false
	}
	if (!emailfilter.test(document.uzenet.input7.value))
	{
		document.uzenet.input7.style.border = "2px solid red"
		document.uzenet.input7.focus()
		return false
	}
	if (document.uzenet.input8.value == "") 
	{
		document.uzenet.input8.style.border = "2px solid red"
		document.uzenet.input8.focus()
		return false
	}
	if (document.uzenet.input9.value == "") 
	{
		document.uzenet.input9.style.border = "2px solid red"
		document.uzenet.input9.focus()
		return false
	}
	if (document.uzenet.input10.value == "") 
	{
		document.uzenet.input10.style.border = "2px solid red"
		document.uzenet.input10.focus()
		return false
	}
	if (document.uzenet.captcha.value == "") 
	{
		document.uzenet.captcha.style.border = "2px solid red"
		document.uzenet.captcha.focus()
		return false
	}
}

function terjesztesihely_teszt()
{
	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
	document.uzenet.input1.style.border = "2px solid #FFCB63"
	document.uzenet.input2.style.border = "2px solid #FFCB63"
	document.uzenet.input4.style.border = "2px solid #FFCB63"
	document.uzenet.input5.style.border = "2px solid #FFCB63"
	document.uzenet.input7.style.border = "2px solid #FFCB63"
	document.uzenet.input8.style.border = "2px solid #FFCB63"
	document.uzenet.szam.style.border = "2px solid #FFCB63"
	
	if (document.uzenet.input1.value == "") 
	{
		document.uzenet.input1.style.border = "2px solid red"
		document.uzenet.input1.focus()
		return false
	}
	if (document.uzenet.input2.value == "") 
	{
		document.uzenet.input2.style.border = "2px solid red"
		document.uzenet.input2.focus()
		return false
	}
	if (document.uzenet.input4.value == "") 
	{
		document.uzenet.input4.style.border = "2px solid red"
		document.uzenet.input4.focus()
		return false
	}
	if (document.uzenet.input5.value == "") 
	{
		document.uzenet.input5.style.border = "2px solid red"
		document.uzenet.input5.focus()
		return false
	}
	
	if (!emailfilter.test(document.uzenet.input7.value))
	{
		document.uzenet.input7.style.border = "2px solid red"
		document.uzenet.input7.focus()
		return false
	}
	if (document.uzenet.input8.value == "") 
	{
		document.uzenet.input8.style.border = "2px solid red"
		document.uzenet.input8.focus()
		return false
	}
	if (document.uzenet.szam.value == "") 
	{
		document.uzenet.szam.style.border = "2px solid red"
		document.uzenet.szam.focus()
		return false
	}
}

function changeInputType(oldElm, iType, iValue, blankValue, noFocus) 
{
  if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
    !document.getElementById || !document.createElement) return;
  var isMSIE=/*@cc_on!@*/false; //http://dean.edwards.name/weblog/2007/03/sniff/
  if(!isMSIE){
    var newElm=document.createElement('input');
    newElm.type=iType;
  } else {
    var newElm=document.createElement('span');
    newElm.innerHTML='<input type="'+iType+'" name="'+oldElm.name+'">';
    newElm=newElm.firstChild;
  }
  var props=['name','id','className','size','tabIndex','accessKey'];
  for(var i=0,l=props.length;i<l;i++){
    if(oldElm[props[i]]) newElm[props[i]]=oldElm[props[i]];
  }
  newElm.onfocus=function(){return function(){
    if(this.hasFocus) return;
    var newElm=changeInputType(this,'password',iValue,
      (this.value.toLowerCase()==iValue.toLowerCase())?true:false);
    if(newElm) newElm.hasFocus=true;
  }}();
  newElm.onblur=function(){return function(){
    if(this.hasFocus)
    if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) {
      changeInputType(this,'text',iValue,false,true);
    }
  }}();
 
  newElm.hasFocus=false;
  
  if(!blankValue) newElm.value=iValue;
  oldElm.parentNode.replaceChild(newElm,oldElm);
  if(!isMSIE && !blankValue) newElm.value=iValue;
  if(!noFocus || typeof(noFocus)=='undefined') {
    window.tempElm=newElm;
    setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
  }
  return newElm;
}

var LoadHandler = {
  handlers:[],
  add:function(fn){
    if(window.onload!=LoadHandler.theHandler) LoadHandler._push(window.onload);
    LoadHandler._push(fn);
    window.onload=LoadHandler.theHandler;
  },
  _push:function(fn){
    if(typeof(fn)!='function') return;
    LoadHandler.handlers[LoadHandler.handlers.length]=fn;
  },
  theHandler:function(){
    var handlers=LoadHandler.handlers,i=-1,fn;
    while(fn=handlers[++i]) fn();
  }
}

var ims = new Array ("images/gomb.png", "images/gomb_2.png");
var i;
for (i=0; i<ims.length; i++) 
{ 
	var img = new Image(); img.src = ims[i]; 
}

addEvent(window, 'load', kulso_link);

function initArray() {  
  this.length = initArray.arguments.length  
  for (var i = 0; i < this.length; i++)  
  this[i+1] = initArray.arguments[i]  
}  
  
function havinev(ev,ho,nap) {  
if (ho==1)  
  { var napok = new initArray("ÚJÉV","Ábel","Benjámin", 
        "Titusz","Simon","Boldizsár","Attila, Ramóna","Gyöngyvér","Marcell",  
        "Melánia","Ágota","Ernő","Veronika","Bódog","Lóránt",  
        "Gusztáv","Antal","Piroska","Sára, Márió","Fábián",  
        "Ágnes","Vince","Rajmund","Timót","Pál","Vanda",  
        "Angelika","Károly,","Adél","Martina","Marcella","") }  
if (ho==2)  
  if ((ev!=2000) && (ev!=2004) && ev!=1996)  
    { var napok=new initArray("Ignác","Karolina","Balázs","Ráhel", 
        "Ágota","Dorottya","Tódor","Aranka","Abigél","Elvira",  
        "Marietta","Lívia","Ella","Valentin",  
        "Kolos","Julianna","Donát","Bernadett","Zsuzsanna",  
        "Aladár","Eleonóra","Gerzson","Alfréd",  
        "Mátyás","Géza","Edina","Ákos, Bátor","Elemér","","")  }  
     else  
    { var napok=new initArray("Ignác","Karolina","Balázs","Ráhel", 
        "Ágota","Dorottya","Rómeó","Aranka","Abigél","Elvira",  
        "Marietta","Lívia","Ella","Valentin",  
        "Kolos","Julianna","Donát","Bernadett","Zsuzsanna",  
        "Aladár","Eleonóra","Gerzson","Alfréd",  
        "Szőkőnap","Mátyás","Géza","Edina","Ákos, Bátor","Elemér","","") }  
if (ho==3)  
  { var napok=new initArray("Albin","Lujza","Kornélia","Kázmér","Adorján", 
        "Leonóra","Tamás","Zoltán","Franciska","Ildikó", 
        "Szilárd","Gergely","Krisztián","Matild","Kristóf",  
        "Henrietta","Gertrúd","Sándor","József","Klaudia",  
        "Benedek","Beáta","Emőke","Gábor","Irén",  
        "Emánuel","Hajnalka","Gedeon","Auguszta","Zalán","Árpád","" ) }  
if (ho==4)  
  { var napok=new initArray("Hugó","Áron","Richárd","Izidor","Vince", 
        "Vilmos","Herman","Dénes","Erhard","Zsolt","Leó","Gyula", 
        "Ida","Tibor","Anasztázia","Csongor","Rudolf","Andrea","Emma",  
        "Tivadar","Konrád","Csilla","Béla","György","Márk","Ervin",  
        "Zita","Valéria","Péter","Katalin, Kitti","" )}  
if (ho==5)  
  { var napok=new initArray("Fülöp","Zsigmond","Tímea", 
        "Mónika","Györgyi","Ivett","Gizella","Mihály","Gergely", 
        "Ármin","Ferenc","Pongrác","Szervác","Bonifác","Zsófia",  
        "Mózes","Paszkál","Erik","Ivó, Milán",  
        "Bernát","Konstantin","Júlia, Rita","Dezső","Eszter",  
        "Orbán","Fülöp","Hella","Emil","Magdolna",  
        "Zsanett","Angéla","" )}  
if (ho==6)  
  { var napok=new initArray("Tünde","Anita","Klotild","Bulcsú","Fatime", 
        "Norbert","Róbert","Medárd","Félix","Margit","Barnabás", 
        "Villő","Antal","Vazul","Jolán","Jusztin","Laura",  
        "Levente","Gyárfás","Rafael","Alajos","Paulina",  
        "Zoltán","Iván","Vilmos","János","László","Levente",  
        "Péter, Pál","Pál","" ) }  
if (ho==7)  
  { var napok=new initArray("Tihamér","Ottó","Kornél","Ulrik", 
        "Sarolta","Csaba","Appolónia","Ellák","Lukrécia","Amália",  
        "Nóra","Izabella","Jenő","Őrs","Henrik","Valter",  
        "Endre","Frigyes","Emília","Illés","Dániel",  
        "Magdolna","Lenke","Kinga, Kincső","Kristóf, Jakab","Anna, Anikó",  
        "Olga","Szabolcs","Márta","Judit","Oszkár","" )}  
if (ho==8)  
  { var napok=new initArray("Boglárka","Lehel","Hermina","Domonkos", 
        "Krisztina","Berta","Ibolya","László","Emőd","Lörinc",  
        "Zsuzsanna","Klára","Ipoly","Marcell","Mária","Ábrahám",  
        "Jácint","Ilona","Huba","István","Sámuel",  
        "Menyhért","Bence","Bertalan","Lajos","Izsó",  
        "Gáspár","Ágoston","Beatrix","Rózsa","Erika") }  
if (ho==9)  
  { var napok= new initArray("Egon","Rebeka","Hilda","Rozália", 
        "Viktor","Zakariás","Regina","Mária","Ádám","Nikolett",  
        "Teodóra","Mária","Kornél","Szeréna","Enikő","Edit",  
        "Zsófia","Diána","Vilhelmina","Friderika","Máté,","Móric",  
        "Tekla","Gellért","Eufrozina","Jusztina","Adalbert",  
        "Vencel","Mihály","Jeromos","" )}  
if (ho==10)  
  { var napok= new initArray("Malvin","Petra","Helga","Ferenc","Aurél","Renáta", 
       "Amália","Koppány","Dénes","Gedeon","Brigitta","Miksa","Kálmán","Helén",  
        "Teréz","Gál","Hedvig","Lukács","Nándor","Vendel","Orsolya","Előd",  
        "Gyöngyi","Salamon","Bianka","Dömötör",  
        "Szabina","Simon","Nárcisz","Alfonz","Farkas","" )}  
if (ho==11)  
  { var napok=new initArray("Marianna","Achilles","Győző","Károly","Imre","Lénárd", 
        "Rezső","Zsombor","Tivadar","Réka","Márton","Jónás, Renátó","Szilvia",  
        "Aliz","Albert, Lipót","Ödön","Hortenzia, Gergő","Jenő","Erzsébet",  
        "Jolán","Olivér","Cecília","Kelemen, Klementina","Emma","Katalin",  
        "Virág","Virgil","Stefánia","Taksony","András, Andor","" )}  
if (ho==12)  
  { var napok=new initArray("Elza","Melinda","Ferenc","Barbara", 
        "Vilma","Miklós","Ambrus","Mária","Natália","Judit","Árpád","Gabriella",  
        "Luca","Szilárda","Valér","Etelka","Lázár",  
        "Auguszta","Viola","Teofil","Tamás","Zéno","Viktória","Ádám, Éva",  
        "KARÁCSONY","KARÁCSONY","János","Kamilla",  
        "Tamás","Dávid","Szilveszter","") }  
   return napok[nap];  
}  
  
/* Hónap neve */  
function honev(ho) {  
  
  if (ho.substring(0,1)=='0'){
    ho=ho.substring(1,2);
  }
  var ho_int=parseInt(ho);
   var month = new initArray("január","február","március","április","május",  
   "június","július","augusztus","szeptember","október","november","december");  
   return month[ho_int]  
   }  
  
/* Nap neve */  
function napnev(szam) {  
   var napok = new initArray("vasárnap","hétfő","kedd","szerda","csütörtök", 
                             "péntek","szombat","vasárnap")  
   return napok[szam]  
   }  
  
  var ido = new Date()  
  var ev = ido.getYear()  
  var ho = ido.getMonth()+1  
  var nap = ido.getDate()  
  if (ev<1900) ev+=1900;
// eddig-->

function Nevnap(){
  var mainev=havinev(ev,ho,nap);  
  if (ho<10){
    ho='0'+ho;
  }
  if (nap<10){
    nap='0'+nap;
  }

  document.writeln('<span style="font-weight: bold">' + ev + '. ' + honev(ho) + ' ' + nap + '., '+napnev(ido.getDay()+1)+'</span>'
									+'<span>&nbsp;Ma&nbsp;<span class="name">'+mainev+'</span>&nbsp;névnapja van.</span>');

}

var original='';


function getInternetExplorerVersion() {    
  var rv = -1; // Return value assumes failure.    
  if (navigator.appName == 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent;        
    var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");        
    if (re.exec(ua) != null)            
    rv = parseFloat(RegExp.$1);    
  }    
  return rv;
}

if (iedom){
  var iever=getInternetExplorerVersion();
}


function showHide(obj,sh){
  if (sh!=null){
    if (sh){
	    document.getElementById(obj).style.display='block';
    }else{
	    document.getElementById(obj).style.display='none';
    }
  }else{
	  if (document.getElementById(obj).style.display=='none'){
	    document.getElementById(obj).style.display='block';
	  }else{
	  	document.getElementById(obj).style.display='none';
	  }
	}
}

function showHidePopup(){

    var winH = $(window).height();
    var winW = $(window).width();
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();

		hideSelects();
		
		if (source_id==null || source_id==''){
      source_id='login_button';
    }

    $('#mask').css({'width':maskWidth,'height':maskHeight});
    $('#mask').css('opacity', 0.3);
    $("#dialog").css('z-index',9999);

    $('#dialog').css('top',  (winH/2-$('#dialog').height()/2+document.documentElement.scrollTop));
    $('#dialog').css('left', winW/2-$('#dialog').width()/2);
    
// 		$('#popup').html(html);
		
	  $("#"+source_id).effect('transfer',{ to: "#dialog", className: 'ui-effects-transfer' },250, function(){
      $("#dialog").fadeTo('fast',1);
    });

		$('#mask').show();
    $("#mask").click(closeDialog);
}



function closeDialog(){
	$("#dialog").fadeTo('fast',0.01).effect('transfer',{ to: "#"+source_id, className: 'ui-effects-transfer' },250,function(){
			$("#dialog").css('top',-400).css('left',-400);
	});
	$('#mask').fadeOut('fast');
	$("#dialog").css('z-index',-1);
	hideSelects('visible');
}

function hideSelects(action) {
	//documentation for this script at http://www.shawnolson.net/a/1198/hide-select-menus-javascript.html
	//possible values for action are 'hidden' and 'visible'
	if (action!='visible'){action='hidden';}
		if (iever==6) {
			for (var S = 0; S < document.forms.length; S++){
				for (var R = 0; R < document.forms[S].length; R++) {
					if (document.forms[S].elements[R].options) {
						document.forms[S].elements[R].style.visibility = action;
					}
				}
			}
		}
	}

function topClick(event){
  var targ;
  if (!e)
    {
    var e=window.event;
    }
  if (e.target)
    {
    targ=e.target;
    }
  else if (e.srcElement)
    {
    targ=e.srcElement;
    }
  if (targ.nodeType==3) // defeat Safari bug
    {
    targ = targ.parentNode;
    }
    alert(targ.tagName);
  if (targ.tagName!='A' && targ.tagName!='IMG'){
    document.location='index.php';
    return false;
  }else{
    document.location=targ.href;
    return true;
  }
}




function floatDiv(id, sx, sy)
{

	ns = (navigator.appName.indexOf("Netscape") != -1);
	d = document;
	px = document.layers ? "" : "px";

	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
	el.flt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
		document.documentElement && document.documentElement.clientWidth ?
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0)
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/12;this.cy += (pY + this.sy - this.cy)/12;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.flt()", 10);
	}
	return el;
}

function doSubmit(val,form){
	if (form==null){
		form='form1';
	}
  var f1=document.getElementById(form);
  f1.action.value=val;
	f1.submit();
}
function bill(ev,obj,action,form){
			//alert(ev.keyCode);
			switch(ev.keyCode){
				case 13:
						doSubmit (action,form);
						return false;
						break;

				case 27:
					
						return false;
						break;

				default :return true;
			}
}

function initEditor(){
  	tinyMCE.init({
		// General options
		mode : "exact",
		elements : "contribution",
		language: "hu",
		theme : "advanced",
		skin : "o2k7",
		skin_variant : "silver",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,|,charmap,emotions",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,|,link,unlink,|,forecolor,backcolor",
		theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "none",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/noiorgazmus.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});

}

		
function imageRefresh(){
  var now=new Date();
  document.getElementById('random_image').src='../tools/random_image.php?'+now.getTime();
}

function checkNumbers(myfield, e, dec){
  var key;
  var keychar;
  
  if (window.event)
     key = window.event.keyCode;
  else if (e)
     key = e.which;
  else
     return true;
  keychar = String.fromCharCode(key);
  
  // control keys
  if ((key==null) || (key==0) || (key==8) || 
      (key==9) || (key==13) || (key==27) )
     return true;
  
  // numbers
  else if ((("0123456789").indexOf(keychar) > -1))
     return true;
  
  // decimal point jump
  else if (dec && (keychar == "."))
     {
     myfield.form.elements[dec].focus();
     return false;
     }
  else
     return false;
}



if (typeof jQuery !== "undefined") { 

	$(document).ready(function() {
	
		$(':button').hover(function(){
			$(this).animate({color: '#767676'},'slow');
		}, function(){
		  $(this).animate({color: '#000'},'slow');
		}
		).css('cursor','pointer');
		
		$('.honda,.honda a').hover(function(){
		  $('.honda').animate({opacity: '1.0'},'slow',
        function(){
          $('#honda_link').animate({color: '#ffffff'},'slow');
        }
      );
		}, function(){
		  $('#honda_link').animate({color: '#ddddd'},'slow');
		  $('.honda').fadeTo('slow',0.6);
		}
		).css('cursor','pointer');
		
		$('.ford, .ford a').hover(function(){
			$('.ford').animate({opacity: '1.0'},'slow',
        function(){
          $('#ford_link').animate({color: '#ffffff'},'slow');
        }
      );
		}, function(){
		  $('#ford_link').animate({color: '#dddddd'},'slow');
		  $('.ford').fadeTo('slow',0.6);
		}
		).css('cursor','pointer');
		
    $('.honda').fadeTo('fast',0.6);
		$('.ford').fadeTo('fast',0.6);
		
		$('.menu_item a, .menu_item2 a, .menu_item3 a, .menu_item4 a').hover(function(){
			$(this).animate({color: '#316799'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		$('.hmenu_item a, .hmenu_item2 a, .hmenu_item3 a, .hmenu_item4 a').hover(function(){
			$(this).animate({color: '#cc0000'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		
		$('.news_more, .box_desc a').hover(function(){
			$(this).animate({color: '#ff0000'},'slow');
		}, function(){
		  $(this).animate({color: '#ff7808'},'slow');
		}
		).css('cursor','pointer');
		
		
		$('.hnews_more, .hbox_desc a').hover(function(){
			$(this).animate({color: '#ff0000'},'slow');
		}, function(){
		  $(this).animate({color: '#cc0000'},'slow');
		}
		).css('cursor','pointer');
		
		
		$('.model_name').hover(function(){
			$(this).animate({color: '#ff7808'},'slow');
		}, function(){
		  $(this).animate({color: '#005cba'},'slow');
		}
		).css('cursor','pointer');
		
		$('.navigator a').hover(function(){
			$(this).animate({color: '#316799'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		$('.news_title, .news_title, .news_title, .news_title').hover(function(){
			$(this).animate({color: '#316799'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		$('.hnavigator a').hover(function(){
			$(this).animate({color: '#cc0000'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		$('.hnews_title, .hnews_title, .hnews_title, .hnews_title').hover(function(){
			$(this).animate({color: '#cc0000'},'slow');
		}, function(){
		  $(this).animate({color: '#000000'},'slow');
		}
		).css('cursor','pointer');
		
		
	});
	
}

