var targ;
var holvagyok=0;
var itt=0;
var ok=0;
var megvolt=0;
var hoveresemeny=0;
var elozolegholvolt=0;
var eztkellmodositani;

function flashrelinket(e){
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;
  }
var tname;
tname=targ.tagName;
switch(targ.id){
	case "penzespentekflash": window.open("http://www.penzespentek.eu/");
	break;
	}
}

function whichElement(e)
{
		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;
		  }
		var tname;
		tname=targ.tagName;
		cname=targ.className;
                if (e.type=="mouseover") hoveresemeny=1
                else if(e.type=="mouseout") hoveresemeny=2
                else hoveresemeny=0;
		if (tname=="A" && hoveresemeny==1) whereami(targ)
		else tname=tname;
}

function menubezar(){
         try
         {
         eztkellmodositani.nextSibling.style.display="none";
         }
         catch(err)
         {
         }
}

function whereami(ezt){
ezt=targ;
	holvagyok=probaldujra();
        mutat(ezt);
}

function mutat(ezt){
				switch(holvagyok){
                                case 1: menumod1(ezt);
                                      break;
                                case 2: menumod2(ezt);
                                      break;
                                case 3: menumod3(ezt);
                                      break;
                                default:
                                }
    elozolegholvolt=holvagyok;
}

function menumod1(ezt){
 				try
				{
				/*alert(elozolegholvolt+","+holvagyok);*/
				if (elozolegholvolt==2 || elozolegholvolt==3) {eztkellmodositani.nextSibling.style.display="none";
                                megvolt=1;
                                }
				else if (megvolt==1) eztkellmodositani.nextSibling.style.display="none"
				else menubezar();
				while (ezt.nextSibling.className!="menu"){
				ezt=ezt.nextSibling;
				}
				eztkellmodositani=ezt;
                ezt.nextSibling.style.display="block";
				ezt2a=ezt.nextSibling.firstChild.firstChild.firstChild.firstChild;
				ezt2afull=ezt.nextSibling.firstChild.firstChild;
				ezt2li=ezt.nextSibling.firstChild;
				var leghosszabbaszinten=0;
					try {
						for(i=0;i<1000;i++){
							if (leghosszabbaszinten<=ezt2a.innerHTML.length) leghosszabbaszinten=ezt2a.innerHTML.length
							else leghosszabbaszinten=leghosszabbaszinten;
							ezt2afull.style.width=ezt2a.innerHTML.length*6+"px";
							while (ezt2li.nextSibling.tagName!="LI"){
								ezt2li=ezt2li.nextSibling;
							}
/*					alert(leghosszabbaszinten);*/
							ezt2a=ezt2li.nextSibling.firstChild.firstChild.firstChild;
							ezt2afull=ezt2li.nextSibling.firstChild;
							ezt2li=ezt2li.nextSibling;
	}
					}
					catch(err){
					/*alert(leghosszabbaszinten);*/
					}
				ezt2a=ezt.nextSibling.firstChild.firstChild.firstChild.firstChild;
				ezt2afull=ezt.nextSibling.firstChild.firstChild;
				ezt2li=ezt.nextSibling.firstChild;
					try {
						for(i=0;i<1000;i++){
							ezt2afull.style.width=leghosszabbaszinten*6+"px";
							while (ezt2li.nextSibling.tagName!="LI"){
								ezt2li=ezt2li.nextSibling;
							}
/*					alert(leghosszabbaszinten);*/
							ezt2a=ezt2li.nextSibling.firstChild.firstChild.firstChild;
							ezt2afull=ezt2li.nextSibling.firstChild;
							ezt2li=ezt2li.nextSibling;
							}
					}
					catch(err){
					/*alert(leghosszabbaszinten);*/
					}
					if (targ.firstChild.firstChild.innerHTML.length>23) ezt.nextSibling.style.marginTop="-36px";
					else ezt=ezt;
			}
			catch(err)
			  {
			  }
}

function menumod2(ezt){

}

function menumod3(ezt){

}

function probaldujra(){
ezt=targ;
	try
	{
			var ok=0;
			while (ezt.parentNode.className!="menu" || ok!=1000){
			if (ezt.parentNode.className=="menu") ok=ok+1
			else ok=ok;
			ezt=ezt.parentNode;
			}
	}
	catch(err)
	{	
	return ok;
	}
}

function nullakeresesitalalatmodder(){
	try
	{
	if (document.getElementById("content-inner").innerHTML.indexOf(">Nincs tal")>0 || document.getElementById("content-inner").innerHTML.indexOf(">Your search yielded no results</")>0) {
			var temp1='<div class="designdoboz"><div class="node"><div class="content">';
			var temp2='</div></div></div><style type="text/css"> #pageTitle, #search-form { display: none; } .belsotartalomdiv h2 { *margin-top: 20px; } </style>';
			document.getElementById("content-inner").innerHTML=temp1+document.getElementById("content-inner").innerHTML+temp2;
		}
		else ok=ok;
	}
	catch(err)
	{

	}
}

function szavazasosszesitooldalmodder(){
	try
	{
	if (document.getElementById("pageTitle").innerHTML.indexOf(">Szavaz")>0 || document.getElementById("pageTitle").innerHTML.indexOf(">Polls")>0 ) {
			var temp1='<div class="designdoboz"><div class="node">';
			var temp2='';
                        if ((location.href.indexOf("/english/")>0) || (location.href.indexOf("/english")+8==location.href.length)) temp2='<span class="nodecim"><h1 class="nodecimtartalom">Poll results</h1></span><div class="content">'
	                else temp2='<span class="nodecim"><h1 class="nodecimtartalom">Szavazási eredmények</h1></span><div class="content">';
			var temp3='</div></div></div><style type="text/css"> #pageTitle { display: none; } .designdoboz .node .content ul { padding-top: 20px; } </style>';
			document.getElementById("content-inner").innerHTML=temp1+temp2+document.getElementById("content-inner").innerHTML+temp3;
		}
		else ok=ok;
	}
	catch(err)
	{

	}
}

function menuvalt(){
	try {document.getElementById("sidebar-left").innerHTML='<div class="balmenu" onmouseout="whichElement(event);" onmouseover="whichElement(event);">'+document.getElementById("sidebar-left").innerHTML+'</div>';} catch(err){}
	nullakeresesitalalatmodder();
	szavazasosszesitooldalmodder();
}

function write_randomized_code(code) {
    var random = Math.floor(Math.random()*1000000);
    code = code.replace(/#random#/, '' + random);
    document.write(code);
}

function openGal(url) {
    var gal=window.open(url+'?action=Gallery&Order=USERDEF','Gal','width=800,height=700');
    if (typeof(gal) != 'undefined') gal.focus();
}

function openHirlevel(url) {
    var hirl=window.open(url,'Hirlevel','width=540,height=700,scrollbars=yes,resizable=yes');
    if (typeof(hirl) != 'undefined') hirl.focus();
}

function googleanalizalo(){
    var szoveg='\n<script type="text\/javascript">\nvar gaJsHost = (("https:" == document.location.protocol) ? "https:\/\/ssl." : "http:\/\/www.");\ndocument.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com\/ga.js\' type=\'text\/javascript\'%3E%3C\/script%3E"));\n<\/script>\n<script type="text\/javascript">\ntry {\nvar pageTracker = _gat._getTracker("UA-6937609-1");\npageTracker._trackPageview();\n} catch(err) {}<\/script>';
    document.write(szoveg);
}
