function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });

 	// Credits: Robert Penners easing equations (http://www.robertpenner.com/easing/).
    jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
    	if ((t/=d) < (1/2.75)) {
    		return c*(7.5625*t*t) + b;
    	} else if (t < (2/2.75)) {
    		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
    	} else if (t < (2.5/2.75)) {
    		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
    	} else {
    		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
    	}
    };

    jQuery.easing['QuintEaseInOut'] = function(p, t, b, c, d) {
    	if ((t/=d*0.5) < 1) 
    		return c*0.5*t*t*t*t*t + b;
    	return c*0.5*((t-=2)*t*t*t*t + 2) + b;
    };
};

function initSmallPiriBox() {
	
	$(document).ready(function() {
		$().piroBox({
				my_speed: 400, //animation speed
				bg_alpha: 0.3, //background opacity
				slideShow : true, // true == slideshow on, false == slideshow off
				slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
				close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox
		});
	});
}

function initPreatyBox() {
	
	$(document).ready(function(){
		$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_square',slideshow:2000, autoplay_slideshow: false});
		$(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',theme:'light_square',slideshow:10000});
		
		$("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
			custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
			changepicturecallback: function(){ initialize(); }
		});

		$("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
			custom_markup: '<div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
			changepicturecallback: function(){ _bsap.exec(); }
		});
	});
}

function initPrettyBox(){

	$(document).ready(function(){
		$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_square',slideshow:2000, autoplay_slideshow: true});
		$(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',slideshow:10000});
		
		$("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
			custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
			changepicturecallback: function(){ initialize(); }
		});

		$("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
			custom_markup: '<div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
			changepicturecallback: function(){ _bsap.exec(); }
		});
	});
}

function initJQuery(start_var) {
	jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
        start: start_var, 
    	easing: 'QuintEaseInOut',
            animation: 1000,
    		initCallback: mycarousel_initCallback
    		 
        });
    });
}

function initJQueryRefernece() {
	$(document).ready(function() {	
	  //Get all the LI from the #tabMenu UL
	  $('#tabMenu > li').click(function()
	  {      
	    //remove the selected class from all LI    
	    $('#tabMenu > li').removeClass('selected');
	    
	    //Reassign the LI
	    $(this).addClass('selected');
	    
	    //Hide all the DIV in .boxBody
	    $('.boxBody div').slideUp('1500');
	    
	    //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
	    $('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');
	    
	  }).mouseover(function() {

	    //Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
	    $(this).addClass('mouseover');
	    $(this).removeClass('mouseout');   
	    
	  }).mouseout(function() {
	    //Add and remove class
	    $(this).addClass('mouseout');
	    $(this).removeClass('mouseover');    
	    
	  });

	  //Mouseover with animate Effect for Category menu list
	  $('.boxBody #category li').mouseover(function() {

	    //Change background color and animate the padding
	    $(this).css('backgroundColor','#FFFFFF');
	    $(this).children().animate({paddingLeft:"20px"}, {queue:false, duration:300});
	  }).mouseout(function() {
	    
	    //Change background color and animate the padding
	    $(this).css('backgroundColor','');
	    $(this).children().animate({paddingLeft:"0"}, {queue:false, duration:300});
	  });  
		
	  //Mouseover effect for Posts, Comments, Famous Posts and Random Posts menu list.
	  $('.boxBody li').click(function(){
	    window.location = $(this).find("a").attr("href");
	  }).mouseover(function() {
	    $(this).css('backgroundColor','#FFFFFF');
		$(this).css('color','#FFFFFF');
	  }).mouseout(function() {
	    $(this).css('backgroundColor','');
		$(this).css('color','');
	  });  	
		
	});
}

function initPartnersJQuery() {

	//$(window).load(function() {
	$(document).ready(function() {
		//for each description div...
		$('div.description').each(function() {
			//...set the opacity to 0...
			$(this).css('opacity', 0);
			//..set width same as the image...
			$(this).css('width', $(this).siblings('img').width());
			//...get the parent (the wrapper) and set it's width same as the image width... '
			$(this).parent().css('width', $(this).siblings('img').width());
			//...set the display to block
			$(this).css('display', 'block');
		});
		
		$('div.wrapper').hover(function() {
			//when mouse hover over the wrapper div
			//get it's children elements with class descriptio
			//and show it using fadeTo
			$(this).children('.description').stop().fadeTo(500, 0.9);
		}, function() {
			//when mouse out of the wrapper div
			//use fadeTo to hide the div
			$(this).children('.description').stop().fadeTo(500, 0);
		});
	});
}

function initFlash() {
	var flashvars = {};
	var params1 = {};
	params1.menu = "false";	
	params1.allowFullScreen = "true";
	var attributes1 = {};
	attributes1.id = "FSFlash";
	swfobject.embedSWF("Main.swf", "altContent", "100%", "100%", "9.0.0", false, flashvars, params1, attributes1);
}

function initIntoFlash() {
	var flashvars = {};
	var params = {};
	params.allowFullScreen = "true";
	params.menu = "false";		
	var attributes = {};
	attributes.id = "FSFlash";
	swfobject.embedSWF("Intro.swf", "flashAlternativeContent", "700", "400", "9.0.0", false, flashvars, params, attributes);
}

function initMusicFlash() {
	var flashvars = {};
	var params2 = {};
	params2.allowFullScreen = "true";
	params2.menu = "false";		
	var attributes2 = {};
	attributes2.id = "FSFlash";
	swfobject.embedSWF("MusicPlayer.swf", "musicplayer", "300", "18", "9.0.0", false, flashvars, params2, attributes2);
}

function initPiroBox() {
	
	$(document).ready(function() {
		$().piroBox({
				my_speed: 400, //animation speed
				bg_alpha: 0.3, //background opacity
				slideShow : true, // true == slideshow on, false == slideshow off
				slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
				close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox
		});
	});
}
