function imgslideSwitch() {
    var $active = $('#visualparthome IMG.active');

          if ( $active.length == 0 ) $active = $('#visualparthome IMG:last');
  
          var $next =  $active.next().length ? $active.next()
                  : $('#visualparthome IMG:first');
  
          $active.addClass('last-active');
  
          $next.css({opacity: 0.0})
                  .addClass('active')
                  .animate({opacity: 1.0}, 1000, function() {
                          $active.removeClass('active last-active');
                  });
}

$(function() {
	var $active = $('#visualparthome IMG');
	$active.css({opacity: 0.0})   
	var $active = $('#img1');
	$active.css({opacity: 1.0})
	var playSlideshowimg =  setInterval( "imgslideSwitch()", 5000 );
	
	$('#visualparthome').hover(function() {
	   clearInterval(playSlideshowimg);
	},
	function() {
	   playSlideshowimg =  setInterval( "imgslideSwitch()", 5000 );
	});	   
	$("#visualparthome div").hover(
	  function () {
			 //	alert($(this).attr("id"));
			 
			 var targetid = '#'+$(this).attr("id")+'main';
			 //	alert(targetid);
			 $(targetid).css("z-index","12");
			 $(targetid).addClass('active');
			 clearInterval(playSlideshow);
	  },
	  function () {
			 //	alert($(this).attr("id"));
			 var targetid = '#'+$(this).attr("id")+'main';
			 //	alert(targetid);
			 $(targetid).css("z-index","8");
			 $(targetid).addClass('last-active');
			 
			 //playSlideshow =  setInterval( "slideSwitch()", 5000 );
	  }
	);
	//setInterval("slideSwitch()", 5000 );
});
