/* Aimtoplease javascript BY-HA 2010. 12. xx. */
// alert("!");
$(document).ready(function() {
	
	setHeight();
	setFooterWidth();
	
	
	$(".menulevel_1 li").hover(
			function () {
				$(this).children(".sample_legord").css("display","block");
				
			},
		  function () {
				$(this).children(".sample_legord").css("display","none");
		  }

		);
		
	if ($.browser.msie && $.browser.version == "8.0") {
		setTimeout("design_prepare_to_MSIE8()", 100);
	}
	
});

function setHeight() {
	/* under construction */
	var header = document.getElementById("header").offsetHeight;
	var left_col = document.getElementById("left_col").offsetHeight;
	var main_content = document.getElementById("main_content").offsetHeight;
	var right_col = document.getElementById("right_col").offsetHeight;
	var content = document.getElementById("content").offsetHeight;
	var page_conatiner = document.getElementById("page_container").offsetHeight;
	
	var maximum = Math.max(left_col,main_content,right_col);
	
	// alert("Max "+left_col+" - "+main_content+" - "+right_col+" = "+maximum);
	
	// bodyHeight = header + main_content;
	bodyHeight = header + maximum -40;
	// alert(bodyHeight);
	// $("#content").css("height", (main_content)-24);

	// if(bodyHeight-40 > 810){
		// $("#page_container").css("height", (bodyHeight)-40);   // -40 MERT  visszahúzzuk a magas footert
		// $("#content").css("height", (main_content)-40);
	// }
	if ((bodyHeight-40) < 975) {
		$("#page_container").css("height", 975);
	}else{
		$("#page_container").css("height", bodyHeight);   // -40 MERT  visszahúzzuk a magas footert
	}
	$("#content").css("height", maximum); 				// +45 mert hozzáadjuk a page_container felső paddingját
	
	$("#search_and_news").css("top", -(main_content) +305);
	langIt();
}

function setFooterWidth(){
	var windowWidth = $(window).width();
	if(windowWidth<=998){
		$("#footer").css("width",998);
	}else{
		$("#footer").css("width",windowWidth);
	}
	
}

function design_prepare_to_MSIE8(){
	$(".inputbox").css("float","left");
	$(".inputbox").css("margin-top",0);
	$(".inputbox").css("padding",0);
	$(".inputbox").css("height",30);
	
	$(".nl_name").css("float","left");
	$(".nl_name").css("margin-top",0);
	$(".nl_name").css("margin-bottom",5);
	$(".nl_name").css("padding",0);
	$(".nl_name").css("height",30);
	
	$(".nl_email").css("float","left");
	$(".nl_email").css("margin-top",0);
	$(".nl_email").css("margin-bottom",5);
	$(".nl_email").css("padding",0);
	$(".nl_email").css("height",30);
}

function langIt(){

	var url = window.location.toString();
		
		if( url.indexOf('/hu/') == -1 && url.indexOf('/en/') == -1	)
		{
			url = '/hu/';
		}

		if( url.indexOf('/en/') != -1	)
		{	
			$('div#logo').css('background-image','url("templates/kezdolap/images/header_logo1_en.png")');
			// $('div#logo').css('background-color','#FF0000');
			$('div#header_bottom').css('background-image','url("templates/kezdolap/images/header_bottom1_en.png")');
			$('div#search_and_news').css('background-image','url("templates/kezdolap/images/search_and_news1_en.png")');
			
			$('div#header_bottom img').attr('src','templates/kezdolap/images/header_bottom1_en.png');
			
			$('div#allas_ajanlatok img').attr('src','templates/kezdolap/images/allasajanlatok1_en.png');			
			$('div#allas_ajanlatok img').attr('width','104');			
			$('div#allas_ajanlatok img').attr('height','17');			
			
			if(document.getElementById('header_bottom')){
				$.ajax({
					// method: 'GET';
					url: 'flash/ajax.php?angol=1',
					success: function(data) {
						// alert(data);
						var data = eval('(' + data + ')');
						
						// alert(data[1].new_url);
						i=0;
						$.each($('div#header_bottom map area'),function () {						
							// alert(data[i].new_url);
							// $(this).attr('href');
							$(this).attr('href','en/'+data[i].new_url);
							// alert($(this).attr('href'));
							i++;	
						});
					
					
					}
				});
			}
		}
		// if( url.indexOf('/hu/') != -1	)
		// {	
			// $.ajax({
				// url: 'flash/ajax.php?hu=1',
				// success: function(data) {
					// alert(data);	
				// }
			// });
		// }
		
		
}

