var t;var $select;var $index = 0;var imagesize = 990;var $nextindex = 1;var $maxImages = 0;var $buttonCounter = 1;var $maxButtons = 4;function startAnimation(){	t = setTimeout(function(){		if($select != undefined){			//			jQuery('img', $select).eq($nextindex).animate({opacity: 'show'}, 300,nextImage);					}	 },800);}function stopAnimation(){	jQuery('img', $select).each(function(){		jQuery(this).stop(true, true);	});		$select = undefined;	$index = 0;	$nextindex = 1;	if(t != undefined){		clearTimeout(t);	}}function nextImage(){	jQuery('img', $select).eq($index).animate({opacity: 'hide'}, 500 );	$index++;	$nextindex++;	if($index == $maxImages -1){		//stopAnimation();		$buttonCounter++;				t = setTimeout(function(){				jQuery('#ib'+ $buttonCounter).click();				},5000);		if($buttonCounter > $maxButtons){			$buttonCounter = 1;		}			}else{		startAnimation();	}	//if($nextindex == $maxImages){		//simulate next button click				//$nextindex = 0;	//}}jQuery.SlideImage = function(select, options) {		var me = select;		jQuery(me).children().each(function(index){		imgID = jQuery(this).attr('id');		//jQuery(this).prepend('<div class="image-link"><a href"" >me is: slideimg.js line:22</a></div>');		var link = jQuery('#ib'+ jQuery(this).attr('id').slice(1));		jQuery('img', this).wrap('<a href="'+ jQuery('a',link).attr('href') +'" />');				//imagesize = 990;//jQuery('img', this).width();						if(index == 0){			$select = jQuery('#i1');			$index = 0;			$nextindex = 1;			$maxImages = jQuery('img', $select).length;			jQuery('img', $select).each(function(index){				jQuery(this).css('position', 'absolute');				if(index > 0){						jQuery(this).hide();				}else{					jQuery(this).show();				}			});			if($maxImages > 1){				startAnimation();			}		}				    			jQuery('#ib'+ jQuery(this).attr('id').slice(1)).click(function(){						stopAnimation();	    	var buttinID = jQuery(this).attr('id').slice(2);	    	var position = (buttinID - 1) * imagesize;	    	//var link = jQuery('a', this).attr('href');			jQuery(this).addClass('active');			$buttonCounter = buttinID;						//start slide show for images in one group			$select = jQuery('#i'+ buttinID);			$index = 0;			$nextindex = 1;			$maxImages = jQuery('img', $select).length;									jQuery('img', $select).each(function(index){								jQuery(this).css('position', 'absolute');				if(index > 0){						jQuery(this).hide();				}else{					jQuery(this).show();				}			});			if($maxImages > 1){				startAnimation();			}									jQuery(this).siblings().removeClass('active');			jQuery(this).siblings().find('.bg_over').fadeTo("normal", 0);			jQuery(this).siblings().find('.bg_normal').stop(true).fadeTo("normal", 1);			jQuery(this).find('.bg_over').stop(true).fadeTo("normal", 1);			jQuery(this).find('.bg_normal').fadeTo("normal", 0);				    	jQuery('#slider').animate({'left':-position+'px'}, 500, 'easeInQuint');	    		    	return false;	    		    });				jQuery('#ib'+ jQuery(this).attr('id').slice(1)).hover(			function(){								if(!jQuery(this).hasClass('active')){					jQuery('.bg_over', this).stop(true).fadeTo("normal",1);					jQuery('.bg_normal', this).fadeTo("normal",0);				}			},			function(){				if(!jQuery(this).hasClass('active')){					jQuery('.bg_normal', this).stop(true).fadeTo("normal",1);					jQuery('.bg_over', this).fadeTo("normal",0);				}							}					);	});	};jQuery.fn.SlideImage = function(options) {		options = options || {};	var select = this;	new jQuery.SlideImage(select, options);};jQuery.SlideKV = function(select, options) {		var $select = select;	var $index = 0;	var $nextindex = 1;	var $maxImages = jQuery('img', $select).length;		jQuery('img', $select).slice(1).each(function(){		jQuery(this).hide();	});		if($maxImages > 1){		startAnimation();	}		function startAnimation(){		t = setTimeout(function(){			jQuery('img', $select).eq($index).animate({opacity: 'hide'}, 500, nextImage);			jQuery('img', $select).eq($nextindex).animate({opacity: 'show'}, 500);		 },3000);	}	function nextImage(){		$index++;		$nextindex++;		if($index == $maxImages){			$index = 0;			}		if($nextindex == $maxImages){			$nextindex = 0;		}		startAnimation();	}};jQuery.fn.SlideKV = function(options) {		options = options || {};	var select = this;	new jQuery.SlideKV(select, options);};jQuery(document).ready(function() {	jQuery("#slider").SlideImage( {});	jQuery('#ib1').addClass('active');		jQuery('#ib1 .bg_over').show();	jQuery('#ib2 .bg_normal').show();	jQuery('#ib3 .bg_normal').show();	jQuery('#ib4 .bg_normal').show();		jQuery('#keyvisual').SlideKV( {});		jQuery(".first_level_nav > li").hover(			function(){				    jQuery('ul',jQuery(this)).stop().height('auto').slideDown('fast');				},			function(){    					jQuery('ul',jQuery(this)).stop().slideUp('fast');			}	);});
