	$(document).ready(function() {

	//close window
    $("#closing").click(function () {
      $("#main").slideToggle("slow");
    });
	
	//close button
	$('.close .img_act').css({opacity:'0'})
	$('.close').hover(function(){
			$(this).find('.img').stop().animate({opacity:'0'},400);
			$(this).find('.img_act').stop().animate({opacity:'1'},400);
		}, function(){
			$(this).find('.img_act').stop().animate({opacity:'0'},400);
			$(this).find('.img').stop().animate({opacity:'1'},400);
		}
	)	
	
	//bg animate
	$('#bgSlider').bgSlider({
	  	duration:1000,
	  	images:['http://www.metaform.gr/images/bg1.jpg','http://www.metaform.gr/images/bg2.jpg','http://www.metaform.gr/images/bg3.jpg','http://www.metaform.gr/images/bg4.jpg'],
	 	preload:true,
	  	spinner:'.bg_spinner',
	  	nextBu:'.next',
	  	prevBu:'.prev'
	})
	//buttons for bg
	$('.prev, .next').find('.img_act').css({opacity:'0'})
	$('.prev, .next').hover(function(){
			$(this).find('.img').stop().animate({opacity:'0'});
			$(this).find('.img_act').stop().animate({opacity:'1'});						 
		}, function(){
			$(this).find('.img_act').stop().animate({opacity:'0'});
			$(this).find('.img').stop().animate({opacity:'1'});	
		}
	)
	var w_img=2000, h_img=1200;
	var w,new_w,h, new_h, num;
	setWidth();
	setHeight();
	w=new_w;h=new_h;
	setSize();
	function setWidth(){
		new_w=$(window).width();
	}
	function setHeight(){
		new_h=$(window).height();
	}
	function setSize(){
		if ((w/w_img) > (h/h_img)) {
			w_img_new=w+20;
			h_img_new=~~((w+20)*h_img/w_img);
		} else {
			h_img_new=h+20;	
			w_img_new=~~((h+20)*w_img/h_img);
		}
		$('#bgSlider img').css({width:w_img_new, height:h_img_new});
	}
	setInterval(setNew,1);
	function setNew(){
		setWidth();
		setHeight();
		if ((w!=new_w)|(h!=new_h)) {
			w=new_w;h=new_h;
			setSize();
		}
	}
 });
//$(window).load(function() {	
	// scroll
//	$('.scroll').cScroll({
//		duration:700,
//		step:100,
//		trackCl:'track',
//		shuttleCl:'shuttle',
//	});
//});

