// JavaScript Document
$j=jQuery.noConflict();

$j(document).ready(function(){
        //When page loads...
	     $j(".tab_content").hide(); //Hide all content
	     $j("ul.tabs li:first").addClass("active").show(); //Activate first tab
	     $j(".tab_content:first").show(); //Show first tab content

	      //On Click Event
	      $j("ul.tabs li").click(function() {

		   $j("ul.tabs li").removeClass("active"); //Remove any "active" class
		   $j(this).addClass("active"); //Add "active" class to selected tab
		   $j(".tab_content").hide(); //Hide all tab content

		    var activeTab = $j(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		     $j(activeTab).fadeIn(); //Fade in the active ID content
		    return false;
	       });
		$j(".tweet").tweet({
            username: "sfsynergy",
            join_text: "auto",
            count: 1,
            auto_join_text_default: "we said,", 
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were checking out",
            loading_text: "loading tweets..."
        });
		$j('#sponsors') 
				.cycle({ 
					speed:  700,  
					pager:  '#sponsor_nav',
					next:'#next',
					prev:'#prev',
					cleartype: false,
					timeout: 9000
		});
		$j(".scroll").click(function(event){
			//prevent the default action for the click event
			event.preventDefault();
	
			//get the full url - like mysitecom/index.htm#home
			var full_url = this.href;
	
			//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
			var parts = full_url.split("#");
			var trgt = parts[1];
	
			//get the top offset of the target anchor
			var target_offset = $j("#"+trgt).offset();
			var target_top = target_offset.top;
	
			//goto that anchor by setting the body scroll top to anchor top
			$j('html, body').animate({scrollTop:target_top}, 500);
		});
		$j('.accord').accordion({active: false,header: 'div.acctitle',alwaysOpen: false, autoheight: false});
		
    });
	// Form Functions ------------------------------------------------------------------------------------------------------------------------------
	function clear_focus(e,o){
		if(o.firstTime){return}
			o.firstTime=true
			o.value=""
	}