$(function () {
	
	// Banner text
	//$('#mast-head ul').innerfade({ animationtype: 'fade', speed: 1000, timeout: 5000, type: 'random_start', containerheight: '1em' }); 
	
	//Category list
	scrollOptions = {
		showArrows:true,
		scrollbarWidth: 20,
		scrollbarOnLeft:true,
		arrowSize: 25,
		scrollbarMargin: 10,
		animateTo: true,
		animateInterval:50, animateStep:5
	};
	treeviewOptions = {
		collapsed: true,
		speed: "slow",
		unique: true,
		persist: "location"
	};
	
	// quick search controller
	$('form#quick-search a#clear-search').click(function() {
		$(this).blur();
		$('form#quick-search input#Keywords').val('').focus();
		return false;
	});
	$('form#quick-search input#Keywords').bind("focus", function() {
		if ($(this).val() == "Enter Search Keywords" )
			$(this).val('').focus();										
	});
	
	
	
	/*
	//Image slideshow
	if ( $("div.pics").length > 0 ) {
		$('div.pics').after('<div id="picsnav">').cycle({ 
			fx: 'fade',
			timeout: 5000,
			pager:  '#picsnav',
			pause: true,   
			pauseOnPagerHover: true
		});
		$('div.pics a').bind('click', function() {
			window.open($(this).attr('href'),$(this).attr('alt'),"menubar=no,width=400,height=300,resizable=1,scrollbars=1,toolbar=no");
			return false;
		});
	}
	*/
	
	//Image slideshow
	if ( $("div#slide-inner").length > 0 ) {
		$('div#slide-inner').cycle({ 
			fx: 'fade',
			timeout: 6000,
			pause: true,   
			pauseOnPagerHover: true
		});
		$('a#pause').toggle(function() {
			$('div#slide-inner').cycle('pause');
			$(this).css('background-position', 'top left');
			return false;
		}, function() {
			$('div#slide-inner').cycle('resume', true);
			$(this).css('background-position', 'bottom left');
			return false;
		});
	
	
	}	
	
	/*
	if ( $("div#categories").length > 0 ) {
		//equalise columns
		var catH = parseFloat($("div#categories").height());
		var mainH =  parseFloat($("div#main").height());
		if (catH < mainH) {
			var mainP = parseFloat($("div#main").css('padding-bottom').replace(/px/, ''));
			$("div#categories").css('height', (mainH+mainP)+'px');
		}
		//adjust category menu
		var newH = (mainH-80)
		if (mainH > 280 && newH > 220) {
			//alert(newH);
			$("#pane").css('height', newH+'px');
		}
	}
	
	$("#pane").treeview(treeviewOptions);
	$('#pane').jScrollPane(scrollOptions);
	//$('#pane li.expandable span, #pane li.collapsable span:first').append(' &raquo;');
	
	
	//$('table.data_table').attr('width', '600');
	
	*/
	
	
	//focus form fields
	$('input:text, textarea').focus(function() {
		$(this).addClass('input-focus');
	});
	$('input:text, textarea').blur(function() {
		$(this).removeClass('input-focus');
	});
	
});