$(document).ready(function() {

 
    jQuery('#car1').jcarousel({
    	scroll: 1
    });

 jQuery('#car3').jcarousel({
     scroll: 1
 });
 jQuery('#car4').jcarousel({
     scroll: 1
 });    
    jQuery('#car2').jcarousel({
    	auto: 3,
    	scroll: 1,
    	wrap: 'last',
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
	
	
//** Background Image Slider

	$("#slider :first-child").appendTo("#slider");
	setInterval(function() {
		$("#slider :first-child").hide().appendTo("#slider").fadeIn(500);
	}, 20000);	

//** Dropdown Menu

	//On Hover Over
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in	
		}
	//On Hover Out
	function megaHoverOut(){
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
		  $(this).hide();  //after fading, hide it
	  });
	}
	
	var config = {
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		 interval: 50, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 500, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};	
	
	$("ul#Menu1 li").hoverIntent(config); //Trigger Hover intent with custom configurations
	
	

//** TABS + Carousel - Partners Page

	//When page loads...
	$(".tab").hide(); //Hide all content
	$(".Carousel2 li:first").addClass("active").show(); //Activate first tab
	$(".tab:first").show(); //Show first tab content

	/*Click function changed - Sep 21 2010 by kumar*/

	//On Click Event
	$("#Carousel2 li").click(function() {
		var href = $("a",this).attr("href");
		if(href.indexOf("#")!=-1){
			$(".Carousel2 li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab").hide(); //Hide all tab content

			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active ID content
			return false;
		}
		
	});


//** Rounded corners for images

	$("#SideCol img").load(function() {
		$(this).wrap(function(){
		  return '<span class="' + $(this).attr('class') + '" style="background:url(' + $(this).attr('src') + ') no-repeat center center; width: ' + $(this).width() + 'px; height: ' + $(this).height() + 'px;" />';
		});
		$(this).css("opacity","0");
	});

//** add to bookmark
//** Author: http://calisza.wordpress.com/2008/11/03/javascript-jquery-bookmark-script/

	// add a "rel" attrib if Opera 7+
	if(window.opera) {
		if ($("a.jqbookmark").attr("rel") != ""){ // don't overwrite the rel attrib if already set
			$("a.jqbookmark").attr("rel","sidebar");
		}
	}

	$("a.jqbookmark").click(function(event){
		event.preventDefault(); // prevent the anchor tag from sending the user off to the link
		var url = this.href;
		var title = this.title;

		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, url,"");
		} else if( window.external ) { // IE Favorite
			window.external.AddFavorite( url, title);
		} else if(window.opera) { // Opera 7+
			return false; // do nothing - the rel="sidebar" should do the trick
		} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
			 alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
		}

	});

  
		  
});








