var ql = 0;
var ss = 0;
var active = 0;

$(document).ready(function(){  
$('#innerContent .wrapper .rightCol ul > li > a').not('.rightCol ul > li ul li a').addClass("menuTitle");						   
searchFlag = null
$("#query").focus(function(){
	if(searchFlag == null) {
		searchFlag = 1;
		$(this).val('');
	}
})		   
//Cufon
Cufon.replace('h1, h2, h3, h4, h5, h6, .header, .fakeh1', {hover: true});

$("li.current-page").parents("li").addClass("current-page");

$("li.current-page > a").addClass("curr-page-a");

$("#topMenu li").hoverClass("sfhover");

$("#topMenu li").hover(function() {
	if($(this).hasClass("sfhover")) {
		$(this).addClass("current-page");
	}
	}, function() {
		$(this).removeClass("current-page");
	})

$("#topMenu .menu .menu").not("#topMenu .menu .menu .menu").each(function() {
	W = 0;
	$("a", this).each(function() {
		txt = $(this).html();
		txt = txt.substr(0, txt.length-7);
		txt = txt.replace(/ /g, "&nbsp;");
		$(this).html(txt);
		
		if(W < $(this).width())
			W = $(this).width(); //Plus padding
			
	})
	
	if(W < $(this).parent("li").width())
		W = $(this).parent("li").width() - 35; //Minus the padding
	
	//Set UL width
	$(this).width(W);
	//Set the position of the third level
	$("ul", this).css({"margin-left" : W+40});
	//Set the width of the a
	$("a", this).not("#topMenu .menu .menu .menu a").width(W);
})
	
$("#topMenu .menu .menu .menu").each(function() {
	W = 0;
	$("a", this).each(function() {
		if(W < $(this).width())
			W = $(this).width();
	})
	$(this).width(W); $('a', this).width(W);
})

$("#search").focus(function() {
	$(this).val("");	
});

$("ul.menu li ul.menu li").each(function() {
	if($(this).children().size() > 1) {
		$(this).append("<b></b>");
		$("b",this).not("ul.menu ul.menu ul.menu b").addClass("more");
	}
});

})


$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};

OH_slider = {
	
	Current : 0,
	Count : 0,
	
	go : function() {
		pos = -(OH_slider.Current * 960);
		$("#list").fadeOut(250, function() {
			$("#list").fadeIn(250);
			OH_slider.active = 0;
			$("#list").css({marginLeft: pos});
		});
	},
	
	moveLeft : function() {
		if(OH_slider.active != 1) {
			OH_slider.active = 1;
			if(OH_slider.Current-1<0)
				OH_slider.Current = OH_slider.Count
			else
				OH_slider.Current--;
			
			OH_slider.go();
		}

	},
	
	moveRight : function() {
		
		if(OH_slider.active != 1) {
			OH_slider.active = 1;
			if(OH_slider.Current>=OH_slider.Count)
				OH_slider.Current = 0;
			else
				OH_slider.Current++;
				
			OH_slider.go();
				
		}
		
	}

}
