var ajax;               

if(window.XMLHttpRequest){
ajax = new XMLHttpRequest;
}                            
else{                        
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}                                                

listazas = function(){
if(ajax.readyState == 4){
	if((ajax.status == 200) || (ajax.status == 304)){
		if(ajax.responseText.substr(0,1) != "*"){
			eredmenybox.innerHTML = ajax.responseText; 
			if(vissza == 1)
			{
				ajax_reload_elozetes();
			}
			else if(vissza == 2)
			{
				ajax_reload_tv();
			}
			else if(vissza == 3)
			{
				ajax_reload_mozi();
			}
		}
	}                                                
}                                                   
}


kiskereso = function(qstr,celdoboz,mit) {
	vissza = mit;
	eredmenybox = document.getElementById(celdoboz);
	ajax.open("POST", "PHP/doboz_szuro.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("qstr="+qstr+"&mit="+mit);
	ajax.onreadystatechange = listazas;
}


function ajax_reload_mozi () {
	
	$(".mozi_item").hover(function(){

		$(this).find("img").fadeTo("normal", 0.65);
		$(this).find("img").css("border", "1px solid #414141");
		$(this).find(".mozi_item_text").animate({ borderBottomColor:"#FFFFFF" }, 500);
	
		},function(){
			
		$(this).find("img").fadeTo("normal", 1.0);
		$(this).find("img").css("border", "1px solid #2b2b2b");
		$(this).find(".mozi_item_text").animate({ borderBottomColor:"#2b2b2b" }, 500);
		
	});
	
	
	
	}

function ajax_reload_tv () {
	
		
	$(".tv_item").hover(function(){

		$(this).find("img").fadeTo("normal", 0.65);
		$(this).find("img").css("border", "1px solid #414141");
		$(this).find(".tv_item_text").animate({ borderBottomColor:"#FFFFFF" }, 500);
	
		},function(){
			
		$(this).find("img").fadeTo("normal", 1.0);
		$(this).find("img").css("border", "1px solid #2b2b2b");
		$(this).find(".tv_item_text").animate({ borderBottomColor:"#2b2b2b" }, 500);
		
	});
	
	
	
	
	}
	
function ajax_reload_elozetes () {
	
	
	$(".filmelozetes_item").hover(function(){

		$(this).find("img").fadeTo("normal", 0.65);
		$(this).find("img").css("border", "1px solid #414141");
		$(this).animate({ borderBottomColor:"#FFFFFF" }, 500);

		},function(){
			
		$(this).find("img").fadeTo("normal", 1.0);
		$(this).find("img").css("border", "1px solid #2b2b2b");
		$(this).animate({ borderBottomColor:"#2b2b2b" }, 500);
	
		
	});
	
	
	}


(function($){


	$(document).ready(function(){
						   
									   
						   
						   
	$("#header_image_frame").easySlider({
		auto: true,
		continuous: true 
	});
	

	
	$("#main_menu li div").hover(function(){
		$(this).fadeTo("normal", 1.0); 
		},function(){
			

		$(this).fadeTo("normal", 0.80); 
		
	});
	


	$(".login_slide_open").hover(function() {
		$(this).animate({ color:"#FFFFFF" }, 500);
	
		}, function() {
		$(this).animate({color:"#a1a1a1"}, 500);
	});
	
	$("#footer a").hover(function() {
		$(this).animate({ color:"#FFFFFF" }, 500);
	
		}, function() {
		$(this).animate({color:"#505050"}, 500);
	});
	
		
	$(".login_slide_open").click(function() {
										  							  
		if ($(".login_slide").height() == 0 ) $(".login_slide").animate({ height:"40px" }, 500);
		else if ($(".login_slide").height() == 40 ) $(".login_slide").animate({ height:"0px"}, 500);
	});
	

	
	
	$("#main_menu li").hover( 
			function () {
				$(this).find("div.main_menu_content").css({"background-color":"#121314"});
			},
			
			function() {
				
				$(this).find("div.main_menu_content").css({"background-color":""});
				
				}
	);

	
	
	
	$("#main_menu li.submenu").hover( 
			function () {
				$(this).find("ul").slideToggle(300);
			},
			
			function() {
				
				$(this).find("ul").slideUp(300);
				
				}
		);

	
	$(".header_image").hover(function(){
		$(this).fadeTo("normal", 1.0); 
		
		$('.header_image').mousemove(function(e){
		
		var alpha = $(this).css("opacity");
		if (alpha==1) {	$(this).stop(); }
		
		var x = e.pageX - this.offsetLeft;
		var y = e.pageY - this.offsetTop;
		var new_margin_pos = y/(273/50)*(-1);
		//	var new_margin_pos = (375-y)*(50/375)*(-1);
		// $('#status').html(x +', '+ y+': '+ new_margin_pos);
		
		if($.browser.msie){
	    if(Object.prototype.toString.call(self.JSON) === "[object JSON]"){
        } else {
 		new_margin_pos = new_margin_pos+14;
    	}
		}
		
		
		var new_position= "0 "+new_margin_pos+"px";
		$(this).css({"background-position":new_position});
		});
		
		
		
		
		
		
		},function(){
			
	$(this).animate( {backgroundPosition:"(0 -25px)"}, 500);
	$(this).fadeTo("normal", 0.8); 
		
	});
	
	
	
	
	$("#site_logo").hover(function(){
		$(this).fadeTo("normal", 0.85); 
		},function(){
		$(this).fadeTo("normal", 1.0); 
		
	});
	
	$("input").focus(function(){
		$(this).fadeTo("normal", 1.0); 

		});
	
	$("input").blur(function(){
		$(this).fadeTo("normal", 0.9); 

		});
	
	
	$("#prev_btn a, #next_btn a").hover(function(){
		$(this).parent().fadeTo("normal", 0.9); 

		},function(){
			
		$(this).parent().fadeTo("normal", 0.0); 
	
		
		});
	
	
	$("#jumpage_logo, #browsr_logo").hover(function(){
		$(this).fadeTo("normal", 1.0); 
	
		},function(){
		$(this).fadeTo("normal", 0.3); 
	
		
		});
	
	
	$(".col2_item").hover(function(){
		$(this).fadeTo("normal", 1.0); 
	
		},function(){
		$(this).fadeTo("normal", 0.7); 
	
		
	});
	
	$(".tv_item_list").hover(function(){
		$(this).fadeTo("normal", 1.0); 
	
		},function(){
		$(this).fadeTo("normal", 0.75); 
	
		
	});
		
	$('#main_menu li div').css({"opacity":"0.80"});
	$(".sub_menu").hide();
	$("#prev_btn").fadeTo("normal", 0); 
	$("#next_btn").fadeTo("normal", 0); 	
	$(".header_image").css({"background-position":"0 -25px"});
	$('a[rel*=modal]').facebox();
	
	$.easing.elasout = function (x, t, b, c, d) {
		 var s=1.70158;var p=0;var a=c;
		 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
		 if (a < Math.abs(c)) { a=c; var s=p/4; }
		 else var s = p/(2*Math.PI) * Math.asin (c/a);
		 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	 },

	 $.scrollTo( 0 );

	 $('.jumpto a').click(function(){
	 $.scrollTo( this.hash, 1500, { easing:'elasout' });
	 $(this.hash).find('span.message').text( this.title );
	 return false;
	 }); 
	
	ajax_reload_elozetes();
	ajax_reload_tv();
	ajax_reload_mozi();
	
	
}); 
	
})(jQuery);


jQuery(function(){jQuery('.tooltip').tooltip({track: true,delay: 0, fade: 250, showURL: false,bodyHandler: function() { return this.rel;}});
jQuery('.img_tooltip').tooltip({delay: 0, fade: 250, track: true,showURL: false,bodyHandler: function() { return jQuery("<img/>").attr("src", this.rel);}});}); 