$.ifixpng('/includes/blank.gif');
$.fn.mailcsere = function()
{
this.each(
    function()
	{
	var emailcim = $(this).text();
	emailcim = emailcim.replace(/\(kukac\)/gi,'@');
	emailcim = emailcim.replace(/\(pont\)/gi,'.');
	$(this).text(emailcim);
//	alert(emailcim);
	return this;
	});

}
function load_page(href)
    {
    $.ajax({
	type: 'POST',
	url: '/ajax.php',
	data: 'href='+href,
	dataType: 'html',
	success: function(data)
	    {
	    $("#main_box").html(data);
//	    $("#back-left, #back-right").correct_height();
	    $("#main_box .email").mailcsere();
	    $('#main_box .to-shadow').shadow();
	    $('#main_box a:not(.external)').link_to_ajax();
	    $('#main_box a:has(img)[href$=.jpg]').click(function(event){
		    // stop default behaviour
		    event.preventDefault();
		    // remove click border
		    this.blur();
		    // get caption: either title or name attribute
		    var caption = this.title || this.name || "";
		    // get rel attribute for image groups
		    var group = this.rel || false;
		    // display the box for the elements href
		    TB_show(caption, this.href, group);
		      });
	    $("#indicator").hide();
	    }
	});
    }
$.fn.link_to_ajax = function()
{
this.each(
    function()
	{
	$(this).click(function(){
	    var ret = true;
	    $("#indicator").show();
	    load_page(this.href);
	return false;
	/*this.href='#'*/});
	});
}

function fejlec()
    {
    if ($("#header").css('height') == '150px')
	{
	$("#header").animate({height:'400px'},500);
	$(".belogo").animate({height:'380px'},500);
	$("#hatter, #auto_1_c, #auto_2_c, #auto_3_c").animate({opacity:'toggle'},500).ifixpng();
	}
    else
	{
	$("#header").animate({height:'150px'},500);
	$(".belogo").animate({height:'100px'},500);
	$("#hatter, #auto_1_c, #auto_2_c, #auto_3_c").animate({opacity:'toggle'},500).ifixpng();
	}
    }
if ($.browser.msie)
    {
    $(".google-map-shadow").css({height: '408px',width: '208px'});
    }
$.fn.check_alms = function()
    {
    $(this).find(">li").each(function(){
	if ($(this).find(".almenu").size())
	    {
//	    $(this).prepend("<span class='almenu-ind'>&gt;</span>")
	    var am = $(this).find(".almenu");
	    $(am).hide();
	    $(this).hover(
		function(){$(am).show();},
		function(){$(am).hide();}
		);
	    }
    });
    }    

$(document).ready(function(){
    $("#indicator").html("<img src='/images/indicator.gif' alt='Kérem várjon...'/> Kérem várjon, az oldal töltődik.");
    $(".email").mailcsere();
    $("#menusor").check_alms();
//    $('.to-shadow').shadow();
//    $('a:not(.external)').link_to_ajax();
//    setTimeout('fejlec()',1000);

});

