


$(function () {
        if ($.browser.msie && $.browser.version < 7) return;
        $('.logo').removeClass('highlight')
		.find('a').append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
			$(this).hover(function () {
					//on hover
					$span.stop().fadeTo(250, 1);
					}, function () { 
						//of Hover 
						$span.stop().fadeTo(400,0)
							
						});
			      
		});
    });
	
function m_menu()
{
	// k_menu controlls the dropdown menus and improves them with javascript
	
	$(".navm a").removeAttr('title');
	$(" .navm ul ").css({display: "none"}); // Opera Fix

	
	//smooth drop downs
	$(".navm li").each(function()
	{	
		
		var $sublist = $(this).find('ul:first');
		
		$(this).hover(function()
		{	
			$sublist.stop().css({overflow:"hidden", height:"auto", display:"none", paddingTop:0}).slideDown(250, function()
			{
				$(this).css({overflow:"visible", height:"auto"});
			});	
		},
		function()
		{	
			$sublist.stop().slideUp(250, function()
			{	
				$(this).css({overflow:"hidden", display:"none"});
			});
		});	
	});
}



$.fn.equalHeights = function() {
    return this.height(Math.max.apply(null,
        this.map(function() {
           return $(this).height()
        }).get()
    ));
};


/*$.fn.center = function () {
    this.css("position","absolute");
    this.css("left", ( $('.slide-foot').width() - this.width() ) / 2+$('.slide-foot').scrollLeft() + "px");
    return this;
}*/


$(document).ready(function () {
$('.sameH').equalHeights();
$('.sup_column:last').css('border','none');
$('.news-widget ul li:last-child').css('border','none');
	
	$('#nav ul li:first').addClass('round_topright');
	$('ul.Fi li:first').addClass('current-cat');
	//$('.free_lec li:last-child').css('background', 'none');
	$('.tab_control li:eq(2)').addClass('greentx');
	$('.tab_control li:eq(3)').addClass('bluetx');
	$('.tab_control li:eq(4)').addClass('blacktx');
	$('.tab_control li:eq(0)').addClass('blacktx');
	
/*Sliders*/
$('.slider').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});
$('.slider2').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});
$('.slider3').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});
$('.slider4').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});
$('.slider5').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});

$('.courseS').nivoSlider({
	        directionNavHide:false, 
		directionNav:false
	});

//$('.nivo-controlNav').wrap('<div class="controls" />');

/* End Sliders */
	$('.tab_control li:first').addClass('current');
	$('.tab2_control li:first').addClass('current');
	$('.tab3_control li:first').addClass('current');
	$('.info_control li:first').addClass('current');

/*main Tabs*/
$('.tab_control li a').click(function () {
	
	//reset all the items
	$('.tab_control li').removeClass('current');
	$(this).parent().addClass('current');
    $('.mask').scrollTo($(this).attr('rel'), 1);  
	return false ;
});
/*End Main Tabs*/

/*recent Tabs*/
$('.tab2_control li a').click(function () {
	
	//reset all the items
	$('.tab2_control li').removeClass('current');
	$(this).parent().addClass('current');
    $('.mask2').scrollTo($(this).attr('rel'), 400);  
	return false ;
	
});

	
/*End recent Tabs*/

/*Mag Tabs*/
$('.tab3_control li a').click(function () {
	
	//reset all the items
	$('.tab3_control li').removeClass('current');
	$(this).parent().addClass('current');
    $('.mask3').scrollTo($(this).attr('rel'), 400);  
	return false ;
	
});	
/*End Mag Tabs*/

/*Widget Tabs*/
$('.wtab_content').hide();
	$('.wtab_content:first').show();
	$('.wtab_control li:first').addClass('current');
	
	$('.wtab_control li a').click(function(){
	$('.wtab_control li').removeClass('current');
	
	$(this).parent().addClass('current');
	var currentTab = $(this).attr('href');
	$('.wtab_content').hide();
	$(currentTab).show();
		return false;

	});
	
/*End widget Tabs*/

/*board Tabs*/
$('.bord_content').hide();
	$('.bord_content:first').show();
	$('.board_control li:first').addClass('current');
	
	$('.board_control li a').click(function(){
	$('.board_control li').removeClass('current');
	
	$(this).parent().addClass('current');
	var currentTab = $(this).attr('href');
	$('.bord_content').hide();
	$(currentTab).show();
		return false;

	});
	
/*End board Tabs*/
$('.footer_links .column:last').css('border-left', 'none');


/*new Scroll System*/
/*  $(".L-series").jCarouselLite({
        btnNext: ".left_scroll a",
        btnPrev: ".right_scroll a",
		scroll: 1,
		//auto: 3000,
		speed:300
    });


  $(".recent").jCarouselLite({
        btnNext: ".rnext a",
        btnPrev: ".rprev a",
		scroll:1,
        visible: 4,
		speed:300
    });

  $(".tutorials").jCarouselLite({
        btnNext: ".tnext a",
        btnPrev: ".tprev a",
		scroll:1,
        visible: 4,
		speed:300
    });

  $(".free_tuts").jCarouselLite({
        btnNext: ".ftnext a",
        btnPrev: ".ftprev a",
		scroll:1,
        visible: 4,
		speed:300
    });
	
	  $(".translate_tuts").jCarouselLite({
        btnNext: ".ttnext a",
        btnPrev: ".ttprev a",
		scroll:1,
        visible: 4,
		speed:300
    });

	  $(".workshop").jCarouselLite({
        btnNext: ".wnext a",
        btnPrev: ".wprev a",
		scroll:1,
        visible: 4,
		speed:300
    });

	  $(".mag_slide").jCarouselLite({
        btnNext: ".rnext2 a",
        btnPrev: ".rprev2 a",
		scroll:1,
		speed:300
    }); 
	  $(".models_slide").jCarouselLite({
        btnNext: ".model_next a",
        btnPrev: ".model_prev a",
        visible: 6,
		scroll:1,
		speed:300
    });
	  $(".mat_slide").jCarouselLite({
        btnNext: ".mat_next a",
        btnPrev: ".mat_prev a",
		scroll:1,
        visible: 6,
		speed:300
    });
	  $(".script_slide").jCarouselLite({
        btnNext: ".script_next a",
        btnPrev: ".script_prev a",
		scroll:1,
        visible: 6,
		speed:300
    });
*/

//$('ul.free_lec').makeacolumnlists({cols:2,colWidth:0,equalHeight:false,startN:1});
 	$("#mem_work").scrollable({
		items:'.member_works',
		next:'.next_works',
		prev:'.prev_works',
		speed:500,
		easing:'linear',
		keyboard:false
		});
	
var divs = $("#mem_work div.single_work");
for(var i = 0; i < divs.length; i+=6) {
  divs.slice(i, i+6).wrapAll('<div class="six" />');
}

/*Widget Scroll*/
$(".free_lec").scrollable({
		items:'.w_scroll',
		next:'.flnext',
		prev:'.flprev',
		speed:400,
		easing:'linear',
		keyboard:false
		});

$(".widgetcur").scrollable({
		items:'.curr_cou',
		next:'.curr_next',
		prev:'.curr_prev',
		speed:400,
		easing:'linear',
		keyboard:false
		});

var wids = $("#lec div.single_lec");
for(var i = 0; i < wids.length; i+=3) {
  wids.slice(i, i+3).wrapAll('<div class="three" />');
}
var wids = $("#gnews div.single_lec");
for(var i = 0; i < wids.length; i+=3) {
  wids.slice(i, i+3).wrapAll('<div class="three" />');
}
var wids = $("#misc div.single_lec");
for(var i = 0; i < wids.length; i+=3) {
  wids.slice(i, i+3).wrapAll('<div class="three" />');
}
var wids = $("#jobs div.single_lec");
for(var i = 0; i < wids.length; i+=3) {
  wids.slice(i, i+3).wrapAll('<div class="three" />');
}



/*info Control Tabs*/
$('.info_control li a').click(function () {
	
	//reset all the items
	$('.info_control li').removeClass('current');
	$(this).parent().addClass('current');
    $('.info-mask').scrollTo($(this).attr('rel'), 300);  
	return false ;
	
});	

//External link in new tab
 $("a[href^=http]").each(function(){
      if(this.href.indexOf(location.hostname) == -1) {
         $(this).attr({
            target: "_blank",
            title: ""
         });
      }
   })
   

$('.serv_post').css('display','none');
$('.serv_post:first').css('display','block');

//Search Page Tabs ...

	$(".search_tab_content").hide(); //Hide all content
	$(".search_head ul.stabs li:first").addClass("current").show(); //Activate first tab
	$(".search_tab_content:first").show(); //Show first tab content

	//On Click Event
	$(".search_head ul.stabs li").click(function() {

		$(".search_head ul.stabs li").removeClass("current"); //Remove any "active" class
		$(this).addClass("current"); //Add "active" class to selected tab
		$(".search_tab_content").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;
	});


/*$(".social li a[title]").tooltip({

   // tweak the position
   offset: [4, 0],

   // use the "slide" effect
   effect: 'slide',
   tipClass:'social_tip',
       //layout: '<div><span></span></div>'

// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });

*/$("span.after[title]").tooltip({

   // tweak the position
   offset: [4, 0],

   // use the "slide" effect
   effect: 'slide',
   tipClass:'social_tip2',
       //layout: '<div><span></span></div>'

// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });

$(".course_student li a[title]").tooltip({

   // tweak the position
   offset: [4, 0],

   // use the "slide" effect
   effect: 'slide',
   tipClass:'social_tip',
       //layout: '<div><span></span></div>'

// add dynamic plugin with optional configuration for bottom edge
}).dynamic({ bottom: { direction: 'down', bounce: true } });

$(".related_courses li a[rel='student_work']").colorbox({
	maxWidth:1280,
	maxHeight:1024,
	});
$("a.img_sc[rel='gth']").colorbox({
	maxWidth:1280,
	maxHeight:1024,
	});
$("a.vid_sc[rel='gth']").colorbox({iframe:true, innerWidth:550, innerHeight:400});

$(".related_courses ul li a").append("<span></span>");
    $(".related_courses ul li a").hover(function(){
        $(this).children("span").fadeIn(700);
    },function(){
        $(this).children("span").fadeOut(100);
    }); 
m_menu();


var $div = $('.srch_wrap');
var height = $div.height();
$div.hide().css({ height : 0 });

$('.serch_button a').click(function () {
  if ( $div.is(':visible') ) {
    $div.animate({ height: 0 }, { duration: 150, complete: function () {
        $div.hide();	  
	$('.serch_button').removeClass('current-spage');

      } 
    });
  } else {
    $div.show().animate({ height : height }, { duration: 300 }, {easing: 'easein'});
	$('.serch_button').addClass('current-spage');

  }
    
  return false;
});

$('.lesson-single .single_content a img').parent().attr('class', 'lightbox_img');
$('.info_content a img').parent().attr('class', 'lightbox_img');
$('.news-single a img').parent().attr('class', 'lightbox_img');

$('.lesson-single .single_content a.lightbox_img').colorbox({
	maxWidth:1280,
	maxHeight:1024,
	});
$('.info_content a.lightbox_img').colorbox({
	maxWidth:1280,
	maxHeight:1024,
	});

$('.news-single a.lightbox_img').colorbox({
	maxWidth:1280,
	maxHeight:1024,
	});

$('.lesson-single .single_content img').wrap('<div class="image_wrap_all"></div>');
$('.info_content img').wrap('<div class="image_wrap_all"></div>');

$('ul.navin li a').removeAttr("title")

//('.footer_links div:first').removeClass('one_fifth')
//$('.footer_links div:first').addClass('two_fifth')
$('.footer_links .one_fifth:last').css('margin-left', '0')


$('.eStore_cart_fancy1 table tr:first').css('display', 'none')
 

});
	



