
jQuery(document).ready(function($) {

$('.slideshow').divSlideShow( {width:980, height:340, arrow:"split", controlClass:"control", delay:10000, controlActiveClass:"control-active", loop:100000} );

$("#nextVideoHighlight").click(function(){ 
 $("#videoHighlightsDynamic").load("/dynamic/videohighlights.php"); 
 return false;
});

$("#sharePage").click(function(){ 
 $("#footerContainer").height("400px"); 
 return false;
});

$("a[rel=lightbox]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

// Load the classic theme
    Galleria.loadTheme('/includes/galleria/themes/classic/galleria.classic.js');


$('.galleria').galleria({
    extend: function() {
        this.play(7000); // will advance every 7th second
    }
});


$('#q').each(function() {
    var default_value = this.value;
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            this.value = default_value;
        }
    });
});


$(".ajaxLoad").click(function() {
	$("#highlightResults").empty().load($(this).attr('href'));
	return false;
	});




$("#showComments").click(function(){ 
 
 var page = $(this).attr('pageID');
 
 $("#comments").slideUp('fast', function() {
 $("#showSubmittedComments").load("/comments/viewcomments.php?pageID=" + page, function() {
 		
		$("#showComments").hide();
		$("#comments").height("300px");
 		$("#comments").slideDown("fast");
		$('#addCommentForm').fadeIn("fast");
 
 });

 		});
 
 	return false;
	});



//if submit button is clicked  
     $('#addComment').click(function () {
						
		//Get the data from all the fields  
         var page = $('input[name=commentsPage]');
		 var name = $('input[name=commentsName]');  
         var comment = $('textarea[name=commentsComment]');  
           
         //organize the data properly  
         var data = 'name=' + name.val() + '&comment=' + comment.val() + '&page=' + page.val() + '&action=add';

 		$.ajax({  
             //this is the php file that processes the data and send mail  
             url: "/comments/process.php",   
               
             //GET method is used  
             type: "GET",  
   
             //pass the data           
             data: data,       
               
             //Do not cache the page  
             cache: false,  
               
             //success  
             success: function (html) {                
                 //if process.php returned 1/true (send mail success)  
                 if (html==1) {                    
                     //hide the form                   
                       
                     //show the success message  
                     $('#addCommentForm').html('<h3>Thanks for adding your comment, it will appear here as soon as it\'s been checked by the Webmaster.</h3>');

                       
                 //if process.php returned 0/false (send mail failed)  
                 } else alert('Sorry, we couldn\'t add your comment at this time.  Please try again later.');                 
             }         
         });  
		
	  return false;  
    }); 
	 
	 
	 	 $('#commentsName').focus(function () {

			if ($('#commentsName').val() == "Your Name") {

				$('#commentsName').val('');
				
			}
		
		});
	 
	 $('#commentsComment').focus(function () {

			if ($('#commentsComment').val() == "Your comment...") {

				$('#commentsComment').val('');
				
			}
		
		});




})

