$(document).ready(function() {
	anchor.init()
			
	$(".roll1").animate({"bottom": "+=390px"}, "slow");
	$(".roll2").animate({"bottom": "+=400px"}, "slow");
	$(".roll3").animate({"bottom": "+=400px"}, "slow");
	$("#star-3d").animate({"bottom": "-=525px"}, "slow");
	$("#menu").animate({"bottom": "+=320px"}, "slow");
	$("#menu2").animate({"bottom": "+=550px"}, "slow");
	$("#tel").animate({"left": "+=44px"}, "slow");
	$("#mail").animate({"left": "+=44px"}, "slow");
	$("#home").animate({"left": "+=44px"}, "slow");
	//$("#stars").fadeIn("slow");
	//$("body").fadeIn(500);

	
	$("#tel").mouseover(function(){
		$(this).animate({"left": "+=257px"}, "fast");
	});
	$("#tel").mouseout(function(){
		$(this).animate({"left": "-=257px"}, 1000);
	});

	$("#mail").mouseover(function(){
		$(this).animate({"left": "+=277px"}, "fast");
	});
	$("#mail").mouseout(function(){
		$(this).animate({"left": "-=277px"}, 1000);
	});
	
	$("#info").mouseover(function(){
		$(this).animate({"left": "+=50px"}, "fast");
	});
	$("#info").mouseout(function(){
		$(this).animate({"left": "-=50px"}, 500);
	});
	
	$("#services").mouseover(function(){
		$(this).animate({"left": "+=50px"}, "fast");
	});
	$("#services").mouseout(function(){
		$(this).animate({"left": "-=50px"}, 500);
	});	
	
	$("#referencies").mouseover(function(){
		$(this).animate({"left": "+=50px"}, "fast");
	});
	$("#referencies").mouseout(function(){
		$(this).animate({"left": "-=50px"}, 500);
	});	
	
	$("#contact").mouseover(function(){
		$(this).animate({"left": "+=50px"}, "fast");
	});
	$("#contact").mouseout(function(){
		$(this).animate({"left": "-=50px"}, 500);
	});	
	
	$("#career").mouseover(function(){
		$(this).animate({"left": "+=30px"}, "fast");
	});
	$("#career").mouseout(function(){
		$(this).animate({"left": "-=30px"}, 500);
	});
		
	$("#tutorials").mouseover(function(){
		$(this).animate({"left": "+=30px"}, "fast");
	});
	$("#tutorials").mouseout(function(){
		$(this).animate({"left": "-=30px"}, 500);
	});
	
	$(function(){
    $('a.out').click(function(){
        window.open(this.href);
        return false;
    });
});
});

//görgető
anchor = {
	init : function()  {
		$("a.anchor").click(function () {	
			elementClick = $(this).attr("href")
			destination = $(elementClick).offset().top-20;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 2000 );
		  	return false;
		})
	}
}

//preview 
this.imagePreview = function(){	
		
	xOffset = -600;
	yOffset = -300;
		
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.getElementsByTagName("input")[0].value +"' alt='Kép betöltése...' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px")
			.css("z-index","100")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY + yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});