$(document).ready(function(){ 
	//Sitespecific javascript here
	//Searchbox clear and fill
	function search_input_values()
	{	
		var searchBox = $('#search input');
		$('#search input').focus(function(){
			if (searchBox.val() != "") {
				
				var theValue = searchBox.val();
				searchBox.attr('temp', theValue)
				searchBox.val('');
			};
		
		});
		$('#search input').blur(function(){
			if (searchBox.val() == "") {
				var theValue = searchBox.attr('temp');
				searchBox.val(theValue);
			};
			
		});
	}
	search_input_values();
	
	function input_values()
	{	
		var inputBox = $('#newsletter #subscriber_name, #newsletter #subscriber_email');
	
		
		inputBox.focus(function(){
			if ($(this).val() != "") {
				
				var theValue = $(this).val();
				$(this).attr('temp', theValue)
				$(this).val('');
			};
		
		});
		inputBox.blur(function(){
			if ($(this).val() == "") {
				var theValue = $(this).attr('temp');
				$(this).val(theValue);
			};
			
		});
	}
	input_values();
	
	//Even and odd rows in tables
	/* if Environment is NOT Editor */
		$("table tr").mouseover(function() {
			$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");
		});
		$("table tr:nth-child(even), table tr td:nth-child(even)").addClass("even");
		$("table tr:nth-child(odd), table tr td:nth-child(odd)").addClass("odd");
		$("table tr:first-child").removeClass('even').addClass("th");
		$('table tr td:first, ul li:first').addClass('first');
		$('table tr td:last, ul li:last').addClass('last');

/*$.fn.media.defaults.flvPlayer = '/System/Templates/js/jwplayer/player.swf';
$.fn.media.defaults.mp3Player = '/System/Templates/js/jwplayer/player.swf';
	$('a[title="media"]').media({ 
		width: 200, 
		height: 20, 
		bgColor: '#000000',
		autoplay: true }).css('position:fixed;top: 20px;left:20px;');*/

/*Subnav animation*/
	$('#nav_sub > ul > li').hover(function(){
		if ($(this).children().is('ul')) {
		$(this).children('ul').show('slow');
		}
	},function(){
		$(this).children('ul').hide('slow');
	});	
	
		$('#gallery  a').lightBox(
		{
		imageLoading: '/System/Templates/js/lightbox/images/lightbox-ico-loading.gif',
		imageBtnClose:'/System/Templates/js/lightbox/images/lightbox-btn-close.gif',
		imageBtnPrev: '/System/Templates/js/lightbox/images/lightbox-btn-prev.gif',
		imageBtnNext: '/System/Templates/js/lightbox/images/lightbox-btn-next.gif'

	}
	);

	
});
