// JavaScript Document
	var lastBlock = "store"; 
	var minWidth = 175;
	var maxWidth = 620;
	
	function closed(target) {
		$('#'+target).find('h2').fadeIn(400).next().fadeOut(400);
	}
	function opened(target) {
		var id = $(target).attr("id");
		$(target).find('h2').fadeOut(400).next().fadeIn(400);
	}
	
// Slider
	function onAfter(curr, next, opts) {
		var index = $(this).parent().children().index(this);
		$('#prev')[index == 0 ? 'hide' : 'show']();
		$('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
		$('.slider_indicator img').attr('src','img/home/ico_dot01.gif');
		$('.slider_indicator img').eq(index).attr('src','img/home/ico_dot02.gif');
		return false;
	}	
	
	$(document).ready(function(){
							   
		if (jQuery.browser.msie) {
			try { 
				document.execCommand("BackgroundImageCache", false, true); 
			} catch(err) {}
		}
		
		$(".service").mouseenter(
			function(){
				var id = $(this).attr("id");
				if( id != lastBlock){
					$('#'+lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400, complete:closed(lastBlock)} );
				}
				$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400, complete: opened(this) } );
				lastBlock = $(this).attr('id');
			}
		);
		
		$('#store').find('h2').fadeOut(400).next().fadeIn(400);
		
		// Slider
		$('#slider').cycle({
			fx:      'scrollHorz', 
			timeout:  0,
			next:   '#next', 
			prev:   '#prev', 
			after: onAfter
		});
	
		// Insert Scroller icons
		if($("#slider .slider_group").length > 1) {
			$("#slider .slider_group").each(function(index) {
				$('.slider_indicator').append("<img src='img/home/ico_dot01.gif' alt='slide icon'/>");
			});
		} else {
			$('.slider_nav').hide();
		}
		
		$('.slider_indicator img:first').attr('src','img/home/ico_dot02.gif');		
				
		
		$('body').addClass('home_js');
		
	});

