/**
  Website: Prominecon.cz
  Script URI: http://w3w.cz/
  Version: 1.0
  Author: Stuart Homfray, W3W.cz
  Author URI: http://w3w.cz
*/

// provide keyboard access to all menu items
jQuery(document).ready(function(){
	jQuery('body').addClass('js');
	// galleryView
	if (jQuery('.galleryView').length > 0) {
		jQuery('.galleryView').galleryView({
			show_filmstrip: false,
			panel_width: 595,
			panel_height: 500,
			panel_scale: 'crop',
			overlay_position: 'left',
			pause_on_hover: true
		});
	}




	jQuery('#nav li a').bind('focus', function() {
		jQuery(this).parents('li').addClass('hover');
	}).bind("blur", function() {
			jQuery(this).parents('li').removeClass('hover');
	});

	jQuery('#sec-nav ul').hide();
	jQuery('#sec-nav .current_page_ancestor ul').show().addClass('showing');
	
	// keyboard access
	jQuery('#sec-nav-container #sec-nav > li > a').bind('focus', function() {
		if(jQuery(this).next().length > 0) {
      jQuery('#sec-nav ul.showing').removeClass('showing').slideUp();
		  jQuery(this).next().addClass('showing').slideDown('slow');
		}
	});

	jQuery('#sec-nav > li > a').click(function(){
	  if (jQuery(this).next().is(':visible') != true ) { jQuery(this).focus(); }

	  if(jQuery(this).next().length > 0) {
		  return false;
		}
	});
	
	// add search label to form
	var searchlabel = jQuery('#s').prev().text();
	jQuery('#s').prev().hide();
	if (jQuery('#s').val() == '') jQuery('#s').val(searchlabel).css('color', '#999');
	jQuery('#s').focus(function(){
		if(jQuery(this).val() == searchlabel) jQuery(this).val('').css('color', '#000');
	}).blur(function(){
		if(jQuery(this).val() == '') jQuery('#s').val(searchlabel).css('color', '#999');
	});

});
