/* Auctionpay Global Javascript Functions

By Will Moore  - ISITE Design

5-27-08

*/

//start the jQuery functions
jQuery(function($){


	function cl(logit){
		if(window.console&&window.console.firebug){
			console.log(logit)
		}
	};//cl()	cl("If you use cl() instead of console.log(), it won't break IE when you forget to take it out.");



if($('#productsnav').length>0) {
	$("#productsnav").localScroll({
	   target:$("#producthighlights"),
	   axis: 'x',
	   duration:800,
	   hash: true,
       onBefore:function(){
   			$(this).parent().parent().find("li.active").removeClass('active');
			$(this).parent("li").addClass('active');
  		}
	})
};
if($('#suiteshighlights').length>0) {
	$("#productsnav").localScroll({
	   target:$("#suiteshighlights"),
	   axis: 'x',
	   duration:800,
	   hash: false,
       onBefore:function(){
   			$(this).parent().parent().find("li.active").removeClass('active');
			$(this).parent("li").addClass('active');
  		}
	})
};


	$("#tabs, #event-timeline").tabs();
	$(".tabs a").click(function () {
		return false;
	})

	/*apply automatic input clearing to the search input - add as needed*/
	$("#searchterm").inputClear();



	/* dnn doesn't support <button>. use a buttons if js is on.  if not, use standard input buttons.   */
	$("a.submitbutton").css("display", "block");
	$("input.submitbutton").hide();

	$("a.gobutton").css("display", "block");
	$("input.gobutton").hide();



	/* hide/show for subnav  */
	$("#subnav ul ul").hide();
	$("#subnav ul .active ul").show();
	$("#subnav ul .parent ul").show();



	$(".homepage h1").hide();



	//homepage flash tabs
	function tabToggle(tab){
		$("#home-tabs > div").hide();
		$("#home-tabs > div:eq("+ tab +")").show();
	} //tabToggle

	//remove the faux-grouping background image
	$("#fundraising-explorer #productsnav ul a").click(function(){
		$(this).parent().parent().removeClass("highlighted")
	})

	//bring back the faux suite
	$(".suitetoggle").click(function(){
		$("#fundraising-explorer #productsnav ul").addClass("highlighted");
		$("#fundraising-explorer #productsnav ul li.active").removeClass("active")
	})


	/* add class to drop downs and buttons for IE <6 */
	if(document.all){
	    $("#nav li, button").hover(
	            function() {
					$(this).addClass("over");
				},
	            function() {
					$(this).removeClass("over");
				}
	    );
	}// if document.all



});// document ready / end jquery functions

	function tabToggle(tab){
		jQuery("#home-tabs > div").hide();
		jQuery("#home-tabs > div:eq("+ tab +")").show();
	}//tabToggle

	/* clear search field on click - made into plugin so it can easily be used more than once. */
	jQuery.fn.inputClear = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};