
function formatText(index, panel) {
  return index + "";
}

var truefalse = false

$(function () {
	var count = $("#list").children().length;
	if(count > 1) {
        $('.anythingSlider').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 5000,                    // How long between slide transitions in AutoPlay mode
            startStopped: truefalse,            // If autoPlay is on, this can force it to start stopped
            animationTime: 600,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
    		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
    		startText: "Go",             // Start text
	        stopText: "Stop",               // Stop text
	        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
        });
    }
});
	        
$(document).ready(function() {
	$('#raisedoverlay').click( function()
	{	
		$('#raisedoverlay').hide();
	});
	
	if (!$.browser.webkit) {
		$('input').placeholder();
	}
	
	$("a.anchorLink").anchorAnimate();
	
	$("a#inline").fancybox();
	$("a#inlineLogo").fancybox();
	
	if (!$.browser.webkit) {
		$('input.halfbox').css('padding', '10px');
	}
});

new function($) {
    $.fn.placeholder = function(settings) {
        settings = settings || {};
        var key = settings.dataKey || "placeholderValue";
        var attr = settings.attr || "placeholder";
        var className = settings.className || "placeholder";
        var values = settings.values || [];
        var block = settings.blockSubmit || false;
        var blank = settings.blankSubmit || false;
        var submit = settings.onSubmit || false;
        var value = settings.value || "";
        var position = settings.cursor_position || 0;

        
        return this.filter(":input").each(function(index) { 
            $.data(this, key, values[index] || $(this).attr(attr)); 
        }).each(function() {
            if ($.trim($(this).val()) === "")
                $(this).addClass(className).val($.data(this, key));
        }).focus(function() {
            if ($.trim($(this).val()) === $.data(this, key)) 
                $(this).removeClass(className).val(value)
                if ($.fn.setCursorPosition) {
                  $(this).setCursorPosition(position);
                }
        }).blur(function() {
            if ($.trim($(this).val()) === value)
                $(this).addClass(className).val($.data(this, key));
        }).each(function(index, elem) {
            if (block)
                new function(e) {
                    $(e.form).submit(function() {
                        return $.trim($(e).val()) != $.data(e, key)
                    });
                }(elem);
            else if (blank)
                new function(e) {
                    $(e.form).submit(function() {
                        if ($.trim($(e).val()) == $.data(e, key)) 
                            $(e).removeClass(className).val("");
                        return true;
                    });
                }(elem);
            else if (submit)
                new function(e) { $(e.form).submit(submit); }(elem);
        });
    };
    var setTextareaState = function(ev) {
		var $this = $(this), val = $this.val(), placeholder = $this.attr('placeholder');
		if (ev.type == 'mousedown' && val == placeholder ) {
			$this.val('');
		} else if (ev.type == 'mouseout' && val == '' && !!placeholder) {
			$this.val(plcaeholder);
		}
	};
}(jQuery);

$(function () {
	var setTextareaState = function(ev) {
		var $this = $(this), val = $this.val(), placeholder = $this.attr('placeholder');
		if (ev.type == 'mousedown' && val == placeholder ) {
			$this.val('');
		} else if (ev.type == 'mouseout' && val == '' && !!placeholder) {
			$this.val(placeholder);
		}
	};
	
	$('form textarea').live('mousedown', setTextareaState).live('mouseout', setTextareaState);
	
	$('textarea').each(function(){
		var placeholder = $(this).attr('placeholder');
		if (placeholder && $(this).val() == '') {
			$(this).val(placeholder);
		}
	});
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				
			});
		  	return false;
		})
	})
}

