////////////////////////////////////////////////////////  
//Client:	Alli Sports - Tours
//Project: 2010 Redesign
//Author:	Jessica Brown http://omniti.com/
//Date:	3.1.10

//CLEAR DEFAULT VALUES FOR INPUT FIELDS
////////////////////////////////////////////////////////
$.fn.cleardefault = function() {
	
	return this.focus(function() {
		
		if ( this.value == this.defaultValue ) {
		this.value = "";
		
		}
		
	}).blur(function() {
			
		if ( !this.value.length ) {
		this.value = this.defaultValue;
		
		}
		
	});
};
////////////////////////////////////////////////////////
//IMAGE BTTN FADES & ROUNDED CORNERS
////////////////////////////////////////////////////////
this.bttns = function(){	
	
	$(".bttn-image").hover(function(e){
		
		$(this).css("opacity", .6);	
    },
	
	function(){
		
		$(this).css("opacity", 1);
    });
    				
};
////////////////////////////////////////////////////////
//HOME NAV
////////////////////////////////////////////////////////
/*this.homenav = function(){

	$("#section-nav li").hover(function(e){
	
		if($("#section-nav li ul").children().size() > 0) {
	
		$(this).addClass("active").children(".sub-nav").show();
		$("ul.sub-nav li").removeClass("active");
		
		}
		
	},
	
	function(){
		
		$(this).removeClass("active").children(".sub-nav").hide();
	
	});
	
	$("#section-nav .sub-nav li").hover(function(e){
	
		var newposition = "-" + $(this).children(".tertiary-nav").width();
	
		$(this).addClass("active").children(".tertiary-nav").css("right", newposition + "px").show();
		$("ul.tertiary li").removeClass("active");
				
	},
	
	function(){
		
		$(this).removeClass("active").children(".tertiary-nav").hide();
	
	});
	
    if ($("ul.sub-nav").length > 0) {
        $("ul.sub-nav").corner("br");
    }
	
    if ($("ul.sub-nav li:last-child").length > 0) {
        $("ul.sub-nav li:last-child").corner("br");
    }
	
	//$("ul.sub-nav").corner("br");
	
	//$("ul.sub-nav li.last").corner("br");
	
	//$("ul.tertiary-nav").corner("br");
	
};
////////////////////////////////////////////////////////
//STAR RATING SYSTEM
////////////////////////////////////////////////////////
/*this.tourrating = function() {

	$(".rating-stars .none").click(function(e){
		
		var postdata = $(this).attr("name");
		
		//not sure how dev team will be doing this, so this is here as placeholder
		//$.ajax({
		//type: "POST",
		//url: "",
		//data: postdata, 
		//success:});
	
		$(this).prevAll().andSelf().addClass("rated");
		
		//remove click event, move to ajax success handler
		$(this).siblings().andSelf().removeClass("none").unbind("click");
		
	});

};*/
////////////////////////////////////////////////////////
//DOC READY
////////////////////////////////////////////////////////
$(document).ready(function(){

	//clear the inputs
	$("input.clear-default").cleardefault();
	
	//add icons
	//$(".video").added();
	
	//fading hovers on image buttons
	bttns();
	
	//rating stars
	//rating();
	
	//tour/section navigation
	//tournav();
	
});

