 var baseURL="http://www.tarhely2.hu/";

 function autoSelect(id)
  {
    var obj=eval(id);
    obj.focus();
    obj.select();
  }

 function get_pr()
  {
    for (var i=0; i < document.styleform.style.length; i++)
     {
       if (document.styleform.style[i].checked)
        {
          var style = document.styleform.style[i].value;
        }
     }
    document.getElementById('pr_result').innerHTML='<p>Ezt a forráskódot illesze be a weblapodra: </p><textarea id="pr_src" cols="18" rows="14" onclick="autoSelect(this)"><a href="http://www.tarhely2.hu"><img border="0" alt="www.tarhely2.hu pagerank" title="www.tarhely2.hu pagerank" src="http://www.tarhely2.hu/pagerank/getpr.php?url='+document.styleform.url.value+'&amp;style='+style+'"/></a></textarea>'; 
  }

 function showPR(url)
  {
    document.getElementById('pagerank').innerHTML='<h3>Oldal pagerank: </h3><img alt="Oldalad pagerankje" title="Oldalad pagerankje" src="http://www.tarhely2.hu/pagerank/getpr.php?url='+url+'&amp;style=2"/>'; 
  }
 
 function check()
  {
    parameters=check.arguments;
    error=false;
    for(i=0;i<parameters.length;i++)
     {
       if(document.getElementById(parameters[i]).value=="") error=true;
     }
    if(error) calert("kotelezo"); 
    return error; 
  }
	
 function calert(txt)
  {
	// shortcut reference to the document object
	d = document;
 
	// if the modalContainer object already exists in the DOM, bail out.
	if(d.getElementById("modalContainerBack")) return;
	if(d.getElementById("modalContainer")) return;
 
	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainerBack";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	//mObj.style.height = document.documentElement.scrollHeight + "px";

	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	//mObj.style.height = document.documentElement.scrollHeight + "px";
 
	// create the DIV that will be the alert 
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alert"+txt;
 
	// create an anchor element to use as the confirmation button.
	btn = alertObj.appendChild(d.createElement("img"));
	btn.id = "closeBtn";
	btn.src= baseURL+"images/alert_ok.png";
	// set up the onclick event to remove the alert when the anchor is clicked
	btn.onmouseover = function() { this.src=baseURL+"images/alert_ok_hover.png"; return false; }	
	btn.onmouseout = function() { this.src=baseURL+"images/alert_ok.png"; return false; }	
	btn.onclick = function() { removecAlert();return false; }	
  }
 
 // removes the custom alert from the DOM
 function removecAlert()
  {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainerBack"));
  }
  
   function send(string)
    {
    	if(string=="olEP85!r")
    	 {
    	 	obj=document.getElementById('mail');
    	 	var e="office";
    	 	var b="ole";
    	    obj.innerHTML=e+"@"+b+".hu","_self","";
            obj.href="mailto:"+e+"@"+b+".hu";
		 }
    } 

  $(document).ready(function() {
   var elements=$('div.menu_box');
   w=$(elements[0]).attr("id");
   x=$('#'+w.replace("_box","")).offset().left;
   xend=$('.menuitem :last').offset().left+$('.menuitem :last').width()+$('#menu li :last').width()-x;
   for(i=0;i<elements.length;i++)
    {
      w=$(elements[i]).attr("id");
      if($('#'+w.replace("_box","")).length!=0)
       {
         newx=$('#'+w.replace("_box","")).offset().left-x+70;
         if((newx+652)>xend) newx=xend-648;
         $(elements[i]).css("left",newx+"px");
       }  
    }
    
   $('li.menuitem').live("mouseenter", function() {
      $('img.feher_top_left').remove();
      $('img.feher_top_right').remove();
      $("div.menu_box_selected").removeClass("menu_box_selected");
      $(this).prepend("<img src='images/feher_top_left.jpg' alt='' title='' class='feher_top_left' /><img src='images/feher_top_right.jpg' alt='' title='' class='feher_top_right' />");
      $('li.menuitem').css({ "background-color" : "transparent" }).children().css({ "color" : "white" });
      $(this).css({ "background-color" : "white" }).children().css({ "color" : "black" });
      $("#"+$(this).attr("id")+"_box").addClass("menu_box_selected").removeClass("menu_box");
      $('div.menu_box').hide(300);
      $('div.menu_box:first').hide(300, function() { $("div.menu_box_selected").addClass("menu_box").show(300); });
    });

   $('div.menu_box').live("mouseleave", function() {
      $("div.menu_box_selected").removeClass("menu_box_selected");
      $('li.menuitem').css({ "background-color" : "transparent" }).children().css({ "color" : "white" });
      $('div.menu_box').hide(300);
      $('img.feher_top_left').remove();
      $('img.feher_top_right').remove();
    });

  })

