jQuery(document).ready(function(){

   /***
    * Cufon replacements - Gotham on the web! 
    ***/
    Cufon.replace('#main-content h1');
    Cufon.replace('#main-content h2');
    Cufon.replace('#main-content h3');
    Cufon.replace('.sub-navigation', {hover: true});
    Cufon.replace('#main-navigation a', {hover: true});
    Cufon.replace('#foxee_cart_container h1');
    
    /***
     * Headers above the pictures (near the little icons)
     ***/
    jQuery("#icon-art-design").hover(function(){
        jQuery("#current-selection").text("Art + Design");
        Cufon.replace('#current-selection');
    },
				function() {
				    jQuery("#current-selection").empty();
				});
    jQuery("#icon-music").hover(function(){
        jQuery("#current-selection").text("Music");
        Cufon.replace('#current-selection');
    },
			   function() {
			       jQuery("#current-selection").empty();
			   });
    
    jQuery("#icon-dance").hover(function(){
        jQuery("#current-selection").text("Dance");
        Cufon.replace('#current-selection');
    },
			   function() {
			       jQuery("#current-selection").empty();
			   });
    
    jQuery("#icon-studio").hover(function(){
        jQuery("#current-selection").text("Studio");
        Cufon.replace('#current-selection');
    },
			    function() {
				jQuery("#current-selection").empty();
			    });
    jQuery("#icon-experiential").hover(function(){
        jQuery("#current-selection").text("Experiential");
        Cufon.replace('#current-selection');
    },
				  function() {
				      jQuery("#current-selection").empty();
				  });
    

    /***
     * Stuff for forms
     ***/
    jQuery("input[type='text']").addClass('default');
    jQuery("input[type='text']").focus(function() {
	if(!jQuery(this).attr("readonly") && jQuery(this).hasClass('default')) {
	    jQuery(this).attr( { value: '' });
	    jQuery(this).removeClass('default');
	}
    });

    jQuery("textarea").focus(function() {
	jQuery(this).html('');
    });


    function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
	    // test to see if the hint span exists first
	    if (inputs[i].parentNode.getElementsByTagName("label")[1]) {
		// the span exists! on focus, show the hint
		inputs[i].onfocus = function () {
		    this.parentNode.getElementsByTagName("label")[1].style.display = "inline";
		}
		// when the cursor moves away from the field, hide the hint
		inputs[i].onblur = function () {
		    this.parentNode.getElementsByTagName("label")[1].style.display = "none";
		}
	    }
	}  
    }
    prepareInputsForHints();

    jQuery("p.readmore").append(' <a class="more" style="cursor: pointer;">Read more &raquo;</a>');
    jQuery("p.hide").hide();
    
    jQuery("a.more").click(function(){
	jQuery("p.hide").slideToggle();
	if(jQuery(this).hasClass('less')){
	    jQuery(this).html('Read more &raquo;').removeClass('less');
	}
	else {
	    jQuery(this).html('&laquo; Read less').addClass('less');
	}
    });

 });

