jQuery(document).ready(function(){
	//jQuery('ul li:first-child').addClass("first");
	jQuery('.footerLinks p:last-child').addClass("last");
	var config = {   
		sensitivity: 3, 
		interval: 0,  
		over: doOpen, 
		timeout: 100, 
		out: doClose  
		};
		function doOpen() {
		jQuery('ul:first',this).stop(true, true).slideDown('fast');
		$(this).addClass('hover');
		}
		function doClose() {
		jQuery('ul:first',this).stop(true, true).slideUp('fast');
		$(this).removeClass('hover');
		}
	jQuery('#nav li').hoverIntent(config);	
	jQuery('.footerLogos li a').each(function(i, cl) {
		jQuery(cl).find('img').clone().appendTo(cl).addClass('color').css('opacity', 0);
	});
	jQuery('#generic .post h2:first').addClass('postTitle');
	jQuery('.clsWrap img').parent('p').addClass('no_cls');
	jQuery('#footer-nav li a').attr('rel','external');
	jQuery('.footerLogos li a').live('mouseenter', function(e) {
		jQuery(this).find('img.color').show().animate({'opacity': 1}, {queue: false});
	});
	jQuery('.footerLogos li a').live('mouseleave', function(e) {
		jQuery(this).find('img.color').animate({'opacity': 0}, {queue: false});
	});
	//Combo Box
	$('.select select').each(function(){
		var sName = $(this).attr("name");
		if(sName=='')
		 sName='cjSelect';
		var defVal = $(this).find("option:selected").text();
		$(this).wrap("<div class='combobox' id='combo"+sName+"' />");
		$(this).before("<span class='comboVal'>"+defVal+"</span>");
		$(this).change(function(){
		 var newVal = $(this).find("option:selected").text();
		 $(this).prev().text(newVal);
		});
	});
	
	jQuery('.multi-column-taxonomy-list li').each(function(){
		var _mctxt = $(this).html();
		$(_mctxt).split(" ");
		var _mcVal = _mctxt[0].toLowerCase();		
		$(this).addClass(_mcVal);
	});
	$(".ancDiv").click(function(){
    	window.location=$(this).find("a:first").attr("href");
		return false;
	});
	jQuery('a[rel="external"]').click(function(){
	    this.target = "_blank";
	});
});
(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var h = $(this).height();
	var oh = $(this).outerHeight();
	var mt = (h + (oh - h)) / 2;
	$(this).css("margin-top", "-" + mt + "px");	
	$(this).css("top", "50%");
	$(this).css("position", "absolute");
	});	
};
})(jQuery);
(function ($) {

$.fn.hAlign = function() {
	return this.each(function(i){
	var w = $(this).width();
	var ow = $(this).outerWidth();	
	var ml = (w + (ow - w)) / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	});
};
})(jQuery);

function url_redirect(url)
{
	window.location.href = url;
}

function add_classes(main_id,sub_id)
{
	jQuery('ul#menu-top-menu').find('li#menu-item-'+main_id).addClass('current-menu-item current_page_item');
	jQuery('ul#menu-item-'+main_id).find('li#menu-item-'+sub_id).addClass('current-menu-item current_page_item');
}
