$(document).ready(function() {

	$("#cForm").validate();
	$("#esForm").validate();
	
	$('div.frvblk img').jcaption({
		copyStyle: true,
		animate: true,
		show: {height: "show"},
		showDuration: 0,
		hide: {height: "hide"},
		hideDuration: 0
	});
	
	$('#mnav ul li:nth-child(3) ul').css('display', 'none');
	
	$("#langblk ul li").hover(function(){
	
	    $(this).addClass("hover");
	    $('ul:first',this).css('visibility', 'visible');
	
	}, function(){
	
	    $(this).removeClass("hover");
	    $('ul:first',this).css('visibility', 'hidden');
	
	});

});


function slideSwitch2() {
    var $active = $('#rotator DIV.active');

    if ( $active.length == 0 ) $active = $('#rotator DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#rotator DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch2()", 5000 );
});	



	// Apply the Highslide settings
	hs.registerOverlay({
		useOnHtml: true,
		html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
		position: 'top right',
		fade: 2 // fading the semi-transparent overlay looks bad in IE
	});
	hs.showCredits = false;
	hs.align = 'center';
	hs.dimmingOpacity = 0.75;
	hs.dimmingGeckoFix = true;
	
	hs.graphicsDir = '/highslide/graphics/';
	//hs.outlineType = 'rounded-white';
	hs.wrapperClassName = 'borderless no-footer';
	hs.allowSizeReduction = false;
	// always use this with flash, else the movie will be stopped on close:
	hs.preserveContent = false;
	
// Image Swap
$.swapImage(".swapImage");

