/*!
 * Copyright (c) 2010 Liberty Concepts
 * http://www.libertyconcepts.com
 * All right reserved *
 * @version 1.5
 * @description Put all jQuery code into engine.structure.allBrowsers
 * engine.structure.ie is reserved only for IE lte 8.0 browsers
 */

var engine = {
    structure: {
        init : function(){
            if (!jQuery.support.opacity) {
                this.ie();
                this.allBrowsers();
            }
            else {
                this.allBrowsers();
            }
        },
        ie : function(){
        //HERE GOES jQUERY FOR IE BROWSERS ONLY!
        },
        allBrowsers : function(){
            if ($j("ul.sf-menu").length) {
                $j("ul.sf-menu").supersubs({
                    minWidth:15,
                    maxWidth:30,
                    extraWidth:1
                }).superfish({delay:0}).find('ul').bgIframe({
                    opacity:false
                });
            }
			//limit number of chrs textarea
			$j("#event_name").attr("maxlength","75")
			$j("#event_name").after("&nbsp;<span class='description'>please limit names to 75 characters or less</span>")
			// Check to see if content is more than allowed, and send an alert
			$j('#event_name').keyup(function(){
				if(isLength(this, 75)){
				alert('You have exceeded the 75 character limit. Please shorten your message.');
				};
			});
        }
    }
}

function isLength(input, length){
       if($j(input).val().length > 700){
           return true;
       }
           return false;
};

$j(function(){
    $j.fn.formLabels() //optional: {excludeElts: 'elts to exclude'}
	$j("#fellows, .fellows").fadingSiblings();
    engine.structure.init();
    plugins.pageTools.init("#contentHere");
    plugins.externalLinks();
    
}); 

//added from header 

// cycle slide show
$j("#slides").cycle({
	fx : 'fade',
	timeout: 7000,
	pager: "#slCount",
	pause: 1,
	cleartypeNoBg: true,
	pagerAnchorBuilder:function(idx,slide){
		return '<li><a href="#">'+ parseFloat(idx+1) +'</a></li>';
	}
});

$j(function() {
	$j("#contribute_state").attr("maxlength","2"); // Set Max Length of the State field on the contribute form
	$j(".footermenu ul").children().hover(function () {
            $j(this).siblings().stop().fadeTo(400, 0.4);
        },
        function () {
            $j(this).siblings().stop().fadeTo(500, 1);
        });
		
    $j(".rollover_menu_menu").css({"position":"relative", "left":"-3px"});
	$j(".socialLinks img, .homepageSidebarButtonContainer img, .sidebarBodyContainer img").hover(function(){
		$j(this).stop().animate({opacity: 0.6}, 300);
		},
                function(){
		$j(this).stop().animate({opacity: 1}, 300);
	        }
        );
});

