﻿/*
    ======================================
    Created by Plamen Nikolov
    http://www.nikolov.biz
    plamen@nikolov.biz
    BULGARIA
    ======================================
*/

jQuery(function(){        
    iTabs.init()
})

var iTabs = {
	
	init: function() {
	//	iTabs.attach()
		iTabs.calculate()
		iTabs.activate()
	},
	
	/*
	attach: function() {
		jQuery("#tabs li a").each(function() {
			jQuery(this).toggle(
				function() {
					jQuery(this).siblings("span").hide("slow")
					jQuery(this).siblings("ul").show("slow")
					jQuery(this).text("Назад")
				},
				function() {
					jQuery(this).siblings("ul").hide("slow")
					jQuery(this).siblings("span").show("slow")
					jQuery(this).text("Read more")
				}
				)
		})
	}, */
	
	activate: function(){
		jQuery("#tabs li").not(".active").each(function(){
			jQuery(this).hover(function(){
				jQuery(this).addClass("on")
				jQuery(this).children("span").hide("fast")
				jQuery(this).children("ul").show("slow")
			}, function(){
					jQuery(this).removeClass("on")
					jQuery(this).children("ul").hide("slow")
					jQuery(this).children("span").show("slow")
			})
		})
	},
	
	calculate: function()
	{
		jQuery("#tabs li ul").each(function() {
			if(jQuery(this).children("<li>").size() > 4)
				jQuery(this).addClass("floated")
		})
		
	}
}
