

// this is the document ready section only

$(document).ready(function() {
		
	var $loading = $('<img src="/graphics/loading.gif" alt="loading" class="loading">');

    $(".checkLine").hover( function() { $(this).toggleClass('ui-state-highlight'); });		

    $(".anav2").hover( function() { $(this).toggleClass('menuOver'); });
    $(".anav2selected").hover( function() { $(this).toggleClass('menuOverSel'); });

	$(".showHoverBrief").hover( function() {
          var $hoverID = $(this).attr('rel');
          $('#'+$hoverID).toggleClass('showBrief');
	});

	$(".docPop").fancybox({
		'padding'	:	5, 
       'width'		: 	'65%',
      'height'	: 	'56%',
     'type'		: 	'iframe'
  });

    $(".imagePop").fancybox({
		'hideOnContentClick' : true,
        'titlePosition' : 'over',   
        'onComplete'    :   function() {
        	$("#fancybox-wrap").hover(function() {
            	$("#fancybox-title").show();
                }, function() {
                	$("#fancybox-title").hide();
				});
           	}
		}); 

	$(".helpPop").fancybox({
    	'title' : 'Help',   
        'padding':  5,      
        'width': '75%',     
        'height': '75%',    
        'type': 'iframe'    
	});

    $(".prodPop").fancybox({
        'title' : 'Info',   
        'padding':  5,      
        'width': '50%',     
        'height': '40%',    
        'type': 'iframe'    
    });

	$(".evPop").fancybox({
    	'title' : 'Help',   
        'padding':  5,      
        'width': '60%',     
        'height': '50%',    
        'type': 'iframe'    
	});
	
	$(".mapPop").fancybox({
    	'title' : 'Location/Map',   
        'padding':  5,      
        'width': 600,     
        'height': 600,
   	    'transitionIn': 'fade',     
        'type': 'iframe'    
	});
	
	$(".extPop").fancybox({
    	'padding':  5,
        'width': '80%',
        'height': '80%',
        'type': 'iframe'
        });
           
	$(".dlgPop").fancybox({
    	'titlePosition'     : 'inside',
        'transitionIn'      : 'none',  
        'transitionOut'     : 'none'   
	});

// gallery tool - slideshow starts on click from the photo you start with auto advanced with timeout
		$("a[rel=gallery]").fancybox({
        	'transitionIn'      : 'fade',
        	'transitionOut'     : 'fade',
        	'autoScale'         : false,     
        	'autoDimensions'    : false,     
        	'titlePosition'     : 'inside',
        	'hideOnContentClick' : 'true',
        	'cyclic'            : 'true',
        	'onComplete'        :   function() {
            	setTimeout('$.fancybox.next();','4600'); },
            	'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
            	    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + '       ' + title + '</span>';
            	}
        	});  
	    });

// hoverBrief
//    $(".checkLine").hover( function() { $(this).toggleClass('ui-state-highlight'); });

//	  $(".showHoverBrief").hover( function() { $(this).toggleClass('ui-state-highlight'); });

//			var $hoverID = $(this).attr('rel');
//			$('#'+$hoverID).toggleClass('showBrief'); 
//			alert('hover');
//			$(this).toggleClass('ui-state-highlight');
//		});




// uiButton link dialogs (large dialog)	
		$('.uiBD button').each(function() {
			var $dialog = $('<div></div>')
			.append($loading.clone());
			var $title = $(this).attr('title');
			var $link = $(this).one('click', function() {
			$dialog
				.load($link.attr('rel'))
				.dialog({
					title: $title, 
//					title: $link.attr('title'),
//					title: $(this).attr('title'),
					width: 620,
					height: 500, 
					zIndex: 9999,
					modal: true
				});
			$link.click(function() {
				$dialog.dialog('open');
				return false;
			});
			return false;
		});
		});

// awk dialogs (small dialog)
	$('.uiAWK button').each(function() {
		var $dialog = $('<div></div>')
			.append($loading.clone());
		var $title = $(this).attr('title');
		var $link = $(this).one('click', function() {
			$dialog
            	.load($link.attr('rel'))
                .dialog({
					title: $title,
					width: 340, 
					height: 280,
					modal: true,
					close: function(event, ui){ location.replace(document.URL); },
					buttons: {
				    	Ok: function() {   
							$( this ).dialog( "close" );
						}  
					}
			});

			$link.click(function() {
				$dialog.dialog('open');
                return false;
			});
				return false;
	});

// subnav stuff


 });

