(function($){
	//document ready
	$(function(){
		$('#navigation li.new-window > a, #menu-footer-menu li.new-window > a').attr('target', '_blank');
		
		
		$("#navigation .dd").hide();
		//navigation dropdown
		$('.widget-socials a:last').css('margin-right', '0');
		$('#navigation .sub-menu li a span').remove();
		$('#navigation .sub-menu').wrap('<div class="dd"><div class="m"></div></div>');
		$('#navigation .dd').append('<div class="b"></div>');
		$('#footer .cols > li:first').addClass('col-1');
		$('#footer .cols > li').addClass('col left');
		$('#footer .cols > .col > a').css({'color' : '#ff9900', 'font-size' : '14px;', 'font-weight' : 'bold', 'font-size' : '14px'});
		$('.home #sidebar').addClass('home-sidebar');
		$('#sidebar .quotescollection_widget .quotescollection_randomquote p:first').wrap('<div class="box"><div class="box-b"><div class="box-t"></div></div></div>');
		
		$("#navigation > ul > li").hover(function(){
			$(this).find('.dd').show();
			$(this).addClass('active');
		}, function(){
			$(this).find('.dd').hide();
			$(this).removeClass('active');
		});
		
		
		// Blinking Fields
		$('.blink')
			.focus(function() { if(this.title==this.value) { this.value = ''; } })
			.blur(function(){ if(this.value=='') {this.value = this.title; } });
			
			
		//png fix
		if ($.browser.msie && $.browser.version == 6) {
			DD_belatedPNG.fix('.middle-strip, #navigation, .arrow span, .m, .b');
		}

		//bg fix
		var height = $('#wrapper').height();
	
		$('#wrapper-bg').css('width', $(window).width());	
		if(height - 267 > 1600){
			$('#wrapper-bg').css('height', 1600 - 267 - 97);	
		}else{
			$('#wrapper-bg').css('height', $(window).height());	
		}
		
		foterColumns();
		
		
			
	});

	$(window).resize(function(){
		var height = $('#wrapper').height();
		
		$('#wrapper-bg').css('width', $(window).width());	
		if(height - 267 > 1600){
			$('#wrapper-bg').css('height', 1600 - 267 - 97);	
		}else{
			$('#wrapper-bg').css('height', $(window).height());	
		}
	});
})(jQuery)

function foterColumns() {
	var $ = jQuery;
	var maxCount = 10;
	var cols = $("#footer .col");
	
	cols.each(function() {
		if( $("li", this).size() + $(this).next().find("li").size() <= maxCount )
		{
			$(this).html( $(this).html() + $(this).next().html() );
			$(this).next().remove();
		}
	});
}
