$(document).ready(function(){
	
	$("a.fbox").fancybox({
		'hideOnContentClick': false,
		'overlayShow': false
	});
	
	
	$('a.guideicon[title]').qtip({
      content: {
         text: false 
      },
      
      position: {
      	corner: {
      		target: 'bottomMiddle',
         	tooltip: 'topMiddle'
      	}
   		},
   		
      style: {
				width: 200,
   			background: 'white',
   			color: '#367fad',
   			textAlign: 'center',
   			fontSize: '1.2em',
   			fontWeight: 'bold', 
   			tip: 'topMiddle',
   			name: 'blue'
			}
   });
   
   $('input[alt], textarea[title]').qtip({
      content: {
         text: false 
      },
      
      position: {
      	corner: {
      		target: 'leftMiddle',
         	tooltip: 'rightMiddle'
      	}
   		},
   		
      style: {
				width: 200,
   			background: 'white',
   			color: '#367fad',
   			textAlign: 'center',
   			fontSize: '1.2em',
   			fontWeight: 'bold', 
   			tip: true,
   			name: 'blue'
			}
   });
   
   $("ul.menu_body li ul li:even a").addClass("alt");
  
  $('ul.menu_body li').hover(  
        function () {  
        		$(this).parents().css('z-index', 100);
            $('ul', this).slideDown(100);  
        },   
        function () {  
            $('ul', this).slideUp(100);   
						$(this).parents().css('z-index', 10);        
        }  
    ); 
	
	$('#rotator').galleryView({
    panel_width: 549,
    panel_height: 123,
    transition_speed: 1000,
    transition_interval: 4000,
    nav_theme: 'dark',
    border: '0px',
    pause_on_hover: true, 
    show_filmstrip: false, 
    gallery_padding: 0, 
    border: '1px solid black',
    filmstrip_margin: 0
	});
	
	$("div[id^='snippet-']").addClass('inline');
	
	var spamvalue = $("input.spamProtection").attr("title");
	$("input.spamProtection").val(spamvalue);
	
   
});

$(function () {
	$("form.ajax_attributes input:submit").hide();
});

(function ($) {

$.topZIndex = function (selector) {

	return Math.max(0, Math.max.apply(null, $.map($(selector || "body *"), 
		function (v) {
			return parseInt($(v).css("z-index")) || null;
		}
	)));
};

$.fn.topZIndex = function (opt) {

	if (this.length === 0) {
		return this;
	}
	
	opt = $.extend({increment: 1, selector: "body *"}, opt);

	var zmax = $.topZIndex(opt.selector), inc = opt.increment;

	return this.each(function () {
		$(this).css("z-index", zmax += inc);
	});
};

})(jQuery);


