jQuery(function(){
	
	//Intiating Priobox
	$().piroBox({
				my_speed: 600, //animation speed
				bg_alpha: 0.5, //background opacity
				radius: 4, //caption rounded corner
				scrollImage : true, // true == image follows the page, false == image remains in the same open position
				pirobox_next : 'piro_next', // Nav buttons -> piro_next == inside piroBox , piro_next_out == outside piroBox
				pirobox_prev : 'piro_prev',// Nav buttons -> piro_prev == inside piroBox , piro_prev_out == outside piroBox
				close_all : '.piro_close',// add class .piro_overlay(with comma)if you want overlay click close piroBox
				slideShow : 'slideshow', // just delete slideshow between '' if you don't want it.
				slideSpeed : 4 //slideshow duration in seconds(3 to 6 Recommended)
	});
	
	
	// Dropdown
	$(".navi > li").hover(function(){
		$(".drop", this).animate({opacity : "toggle"}, 200);
		$(this).toggleClass("tactive");
	});
	
	$(".drop").flyDrop();
	
	
	//QuickTab
	$("#mbody").quickTab({
		tab : ".side_nav a", 
		content : ".mcontent"
	});
	
	
	fixpng();	
});

function fixpng(){
	if($.browser.msie && jQuery.browser.version == '6.0'){
		DD_belatedPNG.fix('div, img');
	}
}

//flyDrop plugin
(function($){
	
	$.fn.flyDrop = function(opt){
		
		var defaults = {
			fly : "li",
			flyCurrentClass : "current",
			drop : ".tab",
			init : 0
		}
		var o = $.extend(defaults, opt);
		
		return this.each(function(){
			
			var $fly = $(o.fly, this);
			var $drop = $(o.drop, this);
			
			//initialize
			$drop.not(":eq("+o.init+")").hide();
			$fly.eq(o.init).addClass(o.flyCurrentClass);
			
			
			$fly.mouseover(function(){
				var index = $(this).index();
				$fly.removeClass(o.flyCurrentClass);
				$(this).addClass(o.flyCurrentClass);
				$drop.hide();
				$drop.eq(index).show();
			});		
			
		});
	}	
	
})(jQuery);


//quicktab plugin

(function($){
	
	$.fn.quickTab = function(opt){
		
		var defaults = {
			tab : ".tab a",
			content : ".content",
			currentClass : "active",
			initTab : 0 //0 indexed
		};
		var o = $.extend(defaults, opt);
		
		return this.each(function(){			
			var $tab = $(o.tab, this);
			var $content = $(o.content, this);
			
			// intialization
			$tab.eq(o.initTab).addClass(o.currentClass);
			$content.not(":eq("+o.initTab+")").hide();
				
			$tab.click(function(){
				var id = $(this).attr("href");
				$tab.filter("."+o.currentClass).removeClass("active");
				$(this).addClass("active");
				$content.filter(":visible").hide();
				$(id).show();
				return false;				
			});
			
		});
		
		
	};

})(jQuery);
