function default_setup() {
	// expandable sections
	// hide expandable boxes onload
    jQuery(".expandable").each(function() {
        // hide content
        if (jQuery(this).hasClass("open")) {
            //jQuery(this).children(".hidden").hide();
            jQuery(this).children("p").children(".arrow_link").addClass("open");
        }
        else {
            jQuery(this).children(".hidden").hide();
            jQuery(this).children("p").children(".arrow_link").addClass("closed");
        } 
    });
	
	jQuery(".arrow_link").click(function() {
		// // get open/close text vars
		var open_close = jQuery(this).attr("rel");
		var open_close_txt = open_close.split(",");
		var open_txt = open_close_txt[0];
		var close_txt = open_close_txt[1];
		//
		if(jQuery(this).hasClass("closed")) {
			jQuery(this).parent().parent(".expandable").children(".hidden").slideDown();
			jQuery(this).removeClass("closed").addClass("open").text(close_txt).css("background-position", "right -24px");
		} else {
			jQuery(this).parent().parent(".expandable").children(".hidden").slideUp();
			jQuery(this).removeClass("open").addClass("closed").text(open_txt).css("background-position", "right 4px");
		}
		return false;
	});
	//
	// show and hide initial text input value on focus/blur
    jQuery('.show_hide_value').each(function() {
        // get initial value on page load									 
        var value = jQuery(this).val();
        jQuery(this).bind("focus", function() {
            // compare current value with initial on focus
            if (jQuery(this).val() == value) jQuery(this).val('');
        }).bind("blur", function() {
            var current_value = jQuery(this).val();
            if (current_value == '') jQuery(this).val(value);
        });
    });
}
function boxes_setup() {
	var counter = 0;
	jQuery('.expandable_box').each(function() {
		// leave first sponsor open by default / or they have open class
		if (counter == 0 || jQuery(this).hasClass("open")) {
			// leave open and change link to close
			var open_close = jQuery(this).children("p.box_links").children(".expandable_control").attr("rel");
			var open_close_txt = open_close.split(",");
			var close_txt = open_close_txt[1];
			jQuery(this).children("p.box_links").children(".expandable_control").addClass("open").text(close_txt).css("background-position", "right -10px");
			
		} else {
			// hide content
			jQuery(this).children(".hidden_box").hide();
			jQuery(this).children("p.box_links").children(".expandable_control").addClass("closed");
		}
		counter++;
	});
	jQuery('.expandable_control').click(function() {
		// // get open/close text vars
		var open_close = jQuery(this).attr("rel");
		var open_close_txt = open_close.split(",");
		var open_txt = open_close_txt[0];
		var close_txt = open_close_txt[1];
		//
		if(jQuery(this).hasClass("closed")) {
			jQuery(this).parent().parent(".expandable_box").children(".hidden_box").slideDown();
			jQuery(this).removeClass("closed").addClass("open").text(close_txt).css("background-position", "right -10px");
		} else {
			jQuery(this).parent().parent(".expandable_box").children(".hidden_box").slideUp();
			jQuery(this).removeClass("open").addClass("closed").text(open_txt).css("background-position", "right 4px");
		}
		
		return false;
	});
}
function category_boxes_setup() {
    var counter = 0;
    jQuery('.expandable_category').each(function() {
        // leave first sponsor open by default / or they have open class
        if (counter == 0 || jQuery(this).hasClass("open")) {
            // leave open and change link to close
            var open_close = jQuery(this).children("p.box_links").children(".expandable_control").attr("rel");
            var open_close_txt = open_close.split(",");
            var close_txt = open_close_txt[1];
            jQuery(this).children("p.box_links").children(".expandable_control").addClass("open").text(close_txt).css("background-position", "right -10px");

        } else {
            // hide content
            jQuery(this).children(".expandable_box").hide();
            jQuery(this).children("p.box_links").children(".expandable_control").addClass("closed");
        }
        counter++;
    });
    jQuery('.expandable_control').click(function() {
        // // get open/close text vars
        var open_close = jQuery(this).attr("rel");
        var open_close_txt = open_close.split(",");
        var open_txt = open_close_txt[0];
        var close_txt = open_close_txt[1];
        //
        if (jQuery(this).hasClass("closed")) {
            jQuery(this).parent().parent(".expandable_category").children(".expandable_box").slideDown();
            jQuery(this).removeClass("closed").addClass("open").text(close_txt).css("background-position", "right -10px");
        } else {
            jQuery(this).parent().parent(".expandable_category").children(".expandable_box").slideUp();
            jQuery(this).removeClass("open").addClass("closed").text(open_txt).css("background-position", "right 4px");
        }

        return false;
    });
}

