// JavaScript Document

jQuery(document).ready(function(){
	jQuery("#menu-top-navigation").superfish({ 
		pathClass: 'current-menu-parent',
		speed:       'fast',
		autoArrows:  false,
		dropShadows: false
	});	
	jQuery("#top-navigation").hover(
	  function () {
		jQuery(this).addClass("top-nav-hover");
		jQuery("#top-navigation-left").css("dispay", "block");
		jQuery("#top-navigation-right").css("dispay", "block");
	  },
	  function () {
		$(this).removeClass("top-nav-hover");
		jQuery("#top-navigation-left").css("dispay", "none");
		jQuery("#top-navigation-right").css("dispay", "none");
		jQuery("#menu-top-navigation").css("background", "none");
	  }
	); 
	jQuery("#top-navigation li.menu-item").hover( 
		function () { jQuery(this).addClass("menu-item-hover"); },
	  	function () { $(this).removeClass("menu-item-hover"); }
	); 
	jQuery("ul.top-nav li a:not('ul.top-nav li li a')").before("<span class='leftcorner'>"+"</span>");
    jQuery("ul.top-nav li a:not('ul.top-nav li li a')").after("<span class='rightcorner'>"+"</span>");
	
	jQuery('#top-navigation-bg').css({'width' :  jQuery('#top-navigation').width() - 40});
	if(jQuery(window).width() < 1024 ) { jQuery('#top-navigation-bg').css({'width' : 908 }); }
	jQuery(window).resize(function () {    
		if(jQuery(window).width() < 1024 ){
			jQuery('#top-navigation-bg').css({'width' : 908 });
		} else {
			jQuery('#top-navigation-bg').css({'width' :  jQuery('#top-navigation').width() - 40});
		}
	});	
	jQuery(".excerpt-images .excerpt-lnk:nth-child(1n+3)").addClass("last");
	
	// fancybox
	var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox");
		jQuery("a.fancybox:not('.thumbs a')").fancybox({
		'imageScale': true,
		'padding': 10,
		'zoomOpacity': true,
		'zoomSpeedIn': 500,
		'zoomSpeedOut': 500,
		'zoomSpeedChange': 300,
		'overlayShow': true,
		'overlayColor': "#666666",
		'overlayOpacity': 0.3,
		'enableEscapeButton': true,
		'showCloseButton': true,
		'hideOnOverlayClick': true,
		'hideOnContentClick': true,
		'frameWidth':  560,
		'frameHeight':  340,
		'callbackOnStart': null,
		'callbackOnShow': null,
		'callbackOnClose': null,
		'centerOnScroll': true
	});
});
