jQuery(document).ready(function() {
    bindEvents();
	
});


function bindEvents(){
	 function addMega() {
        jQuery(this).addClass("hovering");
        var btn = jQuery(this).find("a.main");
        btn.addClass("megaactive");
    }
    function removeMega() {
        jQuery(this).removeClass("hovering");
        var btn = jQuery(this).find("a.main");
        btn.removeClass("megaactive");
    }


	var megaConfig = {
        interval: 10,
        sensitivity: 4,
        over: addMega,
        timeout: 0,
        out: removeMega
     };
    jQuery("li.mega").hoverIntent(megaConfig);	

	jQuery('a.btn_sitemap').click(function(){
		var o = jQuery('a.btn_sitemap span.middle');	
		var active = jQuery('a.btn_sitemap span.arrow');	
		var activeborder = jQuery('.sitemap_bg');	
		var div = jQuery('.sitemap');	
		
		if(div.is(':visible')){
			div.slideUp('normal',function(){
				//activeborder.removeClass('sitemap_bg_active');
				//o.html('Show Sitemap');
				active.removeClass('arrow_active');
			 });
		}else{
			div.slideDown('normal',function(){
				//activeborder.addClass('sitemap_bg_active');
				//o.html('Hide Sitemap');
				active.addClass('arrow_active');				
			});
		}
	});

   	jQuery('div.tabbox_tabs ul li a').click(function(){
		li = jQuery(this).parent();
		ul = li.parent();
		ul.find('li.active').removeClass('active');
		li.addClass('active');
		
		// show the new tab
		
		current = jQuery('div#tab_load div.tab_content');
		newTab = jQuery(''+jQuery(this).attr('href'));
		
		current.hide();
		newTab.show();
		
		return false;
	});
 
 

 	jQuery('blockquote').append('<span class="rightquote"><span>&#8221;</span></span>');
	
	jQuery('.megalist a').each(function(){
		jQuery(this).hover(function(){
			var o = jQuery(this);
			var ipath = o.attr('rel');
			var f = o.parent().parent().parent().parent().find('.end');
			var fi = f.find('.img_wrapper img');
			if(ipath != ''){
				fi.attr('src' ,ipath )
			}
		},function(){});
	});	
	
	
	
	jQuery('.faq a.question').showHide({
		slide: true,
		show: false,
		speed:150
	})
	

	jQuery('#pg_rss_newsletter')
		.find('a.sh').showHide({slide:false,show:true,speed:200});
} // end bind events

function loadMedia( path ){
	jQuery.colorbox({
		open:true,
		href:'/assets/content/video_test.htm'
		,opacity:0.8
		,initialHeight:50
		,title:''
		,previous:''
		,next:''
		,height:400
	},callBack );
	
	function callBack(){
		var flashvars = {src:"http://"+location.hostname+path,width:640,height:360};
		var params = {bgcolor:'#000',allowFullScreen: 'true', allowScriptAccess: 'always', wmode: 'transparent'};
		var attributes = {};

		swfobject.embedSWF("/assets/flash/GenericVideoPlayer.swf","flash_container","640","360","9",false,flashvars, params, attributes);
	}
}
