jQuery(document).ready(function(){

	var runningAnim = false;
    lastBlock = jQuery("a#home-icons-first");
    jQuery("ul#home-icons li a.home-icon-button").hover(
      function(){if(runningAnim) return;var _this=this;
		if(lastBlock!=_this) {
			runningAnim = true;
			minCont = {width: "0px", height:"25px"};maxCont = {width: "320px", height:"25px"};
    		jQuery("ul#home-icons .notice").hide();
			jQuery(lastBlock).parent().find(".notice").hide();
			jQuery(lastBlock).find("img.home-icons-gray").animate({opacity: 1}, { queue:false, duration:400});
			jQuery(this).find("img.home-icons-gray").animate({opacity: 0}, { queue:false, duration:400,complete: function() {}});			
			var noti = jQuery(this).parent().find(".notice");var cls = noti.attr("class");
			noti.find("b").hide();noti.width(0);noti.height(0);
			var steps = 2;
			if(cls.indexOf("notice-3")!=-1){//alert("notice-3");
				var left = 126;
				var width = 319;
				minCont = {left: (left+width)+"px",width: "1px", height:"0px"};
				minCont2 = {left: (left+width)+"px",width: "1px", height:"25px"};
				maxCont = {left: left+"px", width: width+"px", height:"25px"};
				steps = 3;
			}
			if(steps == 2){
			//alert(noti.css("border-left") + noti.css("border-right"));
			noti.animate(minCont,{ queue:false, duration:30,
				complete: function(){
				noti.animate(maxCont,{queue: false, duration: 300,
					complete: function(){
						noti.parent().find(".notice > *").show();
						runningAnim = false;
					}
				});
			}});
			}else{
				noti.animate(minCont,{ queue:false, duration:30,
					complete: function(){
					noti.animate(minCont2,{ queue:false, duration:30,
						complete: function(){
					noti.animate(maxCont,{queue: false, duration: 300,
						complete: function(){
							noti.parent().find(".notice > *").show();
							runningAnim = false;
						}
					});
					}});	
				}});	
			}
 		}
		lastBlock = _this;
      }
    );
    
	jQuery("#our-work-controls #prev").click(function(){
		var sel = jQuery("#our-work-scroller .our-work-visible");var prev = sel.prev("li");
		if(prev.length==0){
			prev = jQuery("#our-work-scroller .our-work-last");
		}
		prev.addClass("our-work-visible");
		sel.removeClass("our-work-visible");
	});
	
	jQuery("#our-work-controls #next").click(function(){
		var sel = jQuery("#our-work-scroller .our-work-visible");var prev = sel.next("li");
		if(prev.length==0){
			prev = jQuery("#our-work-scroller .our-work-first");
		}
		prev.addClass("our-work-visible");
		sel.removeClass("our-work-visible");
	});
	var switch_right_menu_timeout_id = -1;
	function switch_right_menu_start(){
		window.clearTimeout(switch_right_menu_timeout_id);
		switch_right_menu_timeout_id = window.setTimeout(function() {
			switch_right_menu();
		}, 10000);
	}
	function switch_right_menu(){
		var sel = jQuery("#our-work-scroller .our-work-visible");var prev = sel.next("li");
		if(prev.length==0){
			prev = jQuery("#our-work-scroller .our-work-first");
		}
		prev.animate({opacity: 1}, { queue:false, duration:400});
		sel.animate({opacity: 0}, { queue:false, duration:400,complete: function() {prev.addClass("our-work-visible"); sel.removeClass("our-work-visible");switch_right_menu_start();}});
	}
	switch_right_menu_start();
//	jQuery.noConflict();
//	$('a[@rel*=lightbox]').lightBox();
//    jQuery("ul#home-icons li a.home-icon-button").hover(
//      function(){if(runningAnim) return;var _this=this;
//			noti.animate(minCont,{ queue:false, duration:30,complete: function(){noti.animate(maxCont,{queue: false, duration: 300,complete: function(){noti.parent().find(".notice > *").show();runningAnim = false;} });}});//.animate(maxCont,{ queue:false, duration:300}).find("strong").show();
// 		}';
});

