	
	//menu animate
	function menu_hover(){
		$('#menu > li > a').mouseenter(function(){
			$(this).parent().stop().animate({backgroundPosition:'-100px -266px'},400,'easeInSine')
		}).mouseleave(function(){
			$(this).parent().stop().animate({backgroundPosition:'-600px -266px'},400,'easeOutSine')	
		})
	}
	//banners animate
	function banners_hover(){
		$('.banners a').mouseenter(function(){
				$(this).find('img').stop().animate({rotate:'-45deg'},1200,'easeOutElastic');
			}).mouseleave(function(){
				$(this).find('img').stop().animate({rotate:'0deg'},1200,'easeOutElastic');
			}
		)
	}
$(document).ready(function() {				   
	//menu animate					   
	function menu_arrow(){
		$('#menu > li').mouseenter(function(){
			if ($(this).find('img')) {$(this).find('img').stop().animate({rotate:'90deg'},400)}
		}).mouseleave(function(){
			if ($(this).find('img')) {$(this).find('img').stop().animate({rotate:'0deg'},400)}
		})
	}
	menu_hover();
	menu_arrow();
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	//banners animate
	banners_hover();
	// tool tip
	$('.normaltip').aToolTip({
    	toolTipClass: 'aToolTip'});
	//gallery projects
	$('.projects a').mouseenter(function(){
			$(this).find('.img').stop().animate({opacity:'0'},400);	
			$(this).find('.act_img').stop().animate({opacity:'1'},400);				
		}).mouseleave( function(){
			$(this).find('.img').stop().animate({opacity:'1'},400);
			$(this).find('.act_img').stop().animate({opacity:'0'},400);	
		}
	)
	// gallery1
	$("#gallery1").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 4,
		speed: 400,
		easing: 'easeOutCirc'
	});
	var Img= $("#largeImg").attr('src');
	$(".folio ul li a").click(function(){
									   
  	var largePath = $(this).attr("href");
	if (Img!=largePath) {
		$("#largeImg").animate({ opacity: "0" }, "middle",function(){
			 $("#largeImg").attr({ src: largePath})
			 })
		$("#largeImg").animate({ opacity: "1" }, "middle")
	}
	Img=largePath;
      return false;
   })
	$('#gallery1 a.active').find('.img').stop().animate({opacity:'0'},400);
	$('#gallery1 a.active').find('.act_img').stop().animate({opacity:'1'},400);
	$('#gallery1 li a').click(function(){
		$('#gallery1 li a').removeClass('active');
		$(this).addClass('active')			
		$('#gallery1 li a:not(.active)').find('.img').stop().animate({opacity:'1'},400);
		$('#gallery1 li a:not(.active)').find('.act_img').stop().animate({opacity:'0'},400);	
	})
	$('#gallery1 li a').mouseenter(function(){
			if ($(this).attr('class')!='active') {
				$(this).find('.img').stop().animate({opacity:'0'},400);	
				$(this).find('.act_img').stop().animate({opacity:'1'},400);				
			}
		}).mouseleave( function(){
			if ($(this).attr('class')!='active') {
				$(this).find('.img').stop().animate({opacity:'1'},400);
				$(this).find('.act_img').stop().animate({opacity:'0'},400);	
			}
		}
	)
	// for lightbox
	if ($("a[rel^='prettyPhoto']").length) {
			$(document).ready(function() {
				// prettyPhoto
				$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
			});
	}
	// bg animate
	 $('#bgSlider').bgSlider({
	  	duration:1000,
	  	images:['images/bg_img1.jpg','images/bg_img2.jpg','images/bg_img3.jpg','images/bg_img4.jpg','images/bg_img5.jpg','images/bg_img6.jpg','images/bg_img7.jpg','images/bg_img8.jpg','images/bg_img9.jpg'],
	 	preload:false,
	  	spinner:'.bg_spinner',
	  	nextBu:'.bg_next',
	  	prevBu:'.bg_prev'
	 })
	var w_img=1680, h_img=1050;
	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();
		}
	}
 });
