

function slideSwitch() {
    var $active = $('#blender .active');
    
    if ( $active.length == 0 ) $active = $('#blender img:last');
    
    
    var $next = $active.next('img').length ? $active.next('img') : $('#blender img:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        }); 
}


$(document).ready(function(){
	
	/* Start keyvisual navigation */
	$('.page-header .container .tabs ul li[class!=active]').mouseover(function(){
		$(this).stop().animate({"margin-top": "0px"}, "normal")
	}).mouseout(function(){
		$(this).stop().animate({"margin-top": "60px"}, "normal")
	});
	
	if($('a.submit-button').length > 0 )
	$('a.submit-button').click( function(){ $('#tx_amfworderform_pi1_form').submit(); return false; } );
	
	// Home Fader
	
  if ($('#blender img').length >= 1) {
  	$('#blender img:first').addClass('active');
  	$('.keyvisual .border').click( function(){ if( $('#blender img.active').attr('longdesc') )location.href='/'+$('#blender img.active').attr('longdesc'); });
  	$('.keyvisual .border').mouseover( function(){ if( $('#blender img.active').attr('longdesc') ){$(this).css('cursor','pointer') }else{ $(this).css('cursor','')}; });
  	if ($('#blender img').length > 1)
  	setInterval( "slideSwitch()", 5500 );
  }
  
  
  $().piroBox({
  			
			my_speed: 400, //animation speed
			bg_alpha: 0.5, //background opacity
			slideShow : false, // true == slideshow on, false == slideshow off
			slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
			close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox

	});
	
  $(".image a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});

	
 	
});

/* DOM READY CODE */
Cufon.DOM.ready (function() 
{
	Cufon.replace('h1');
	Cufon.replace('a.more-button');
	Cufon.replace('a.submit-button');
}); 

