/************************************************************

Profit - main.js

June 2010

************************************************************/

/**
 *
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */

(function($) {
	/**
	 * equalizes the heights of all elements in a jQuery collection
	 * thanks to John Resig for optimizing this!
	 * usage: $("#col1, #col2, #col3").equalizeCols();
	 */

	$.fn.equalizeCols = function(){
		var height = 0,
			reset = $.browser.msie && $.browser.version < 7 ? "1%" : "auto";

		return this
			.css("height", reset)
			.each(function() {
				height = Math.max(height, this.offsetHeight);
			})
			.css("height", height)
			.each(function() {
				var h = this.offsetHeight;
				if (h > height) {
					$(this).css("height", height - (h - height));
				};
			});

	};

})(jQuery);

$(document).ready(function() {

	//
	$('a[rel=_blank]').click(function(){
		this.target = "_blank";
	});

	//
	$('.td_tops_twitter .td_mod_bd .tweet').jScrollPane({animateTo:true, animateInterval:50, animateStep:3, scrollbarWidth:17, showArrows: true});

	if( $.browser.opera ){

		//
		$('html').addClass('opera');

	}


	//
	if (($.browser.msie)){

		//
		$('.td_footer_nav li:last-child').css({'padding':'0 0 0 13px', 'background':'none'});
		$('.td_footer_links li:last-child').css({'border':'none'});
		$('.td_footer .td_footer_top .td_ribbon dl:last-child').css({'margin-right':'0'});
		$('.td_ribbon_small dl:last-child').css({'margin-right':'0'});
		$('.td_comments .td_comments_links li:last-child').css({'background':'none'});

	}

	//
	if (($.browser.msie) && ($.browser.version == "8.0")){

		//
		$('html').addClass('ie8');

	}

	//
	if (($.browser.msie) && ($.browser.version == "7.0")){

		//
		$('html').addClass('ie7');

		//
		$('input[type="text"]').focus(function() {
			$(this).addClass('focus');
		});
		$('input[type="text"]').blur(function() {
			$(this).removeClass('focus');
		});

	}


	if (($.browser.msie) && ($.browser.version == "6.0")){

		//
		$('html').addClass('ie6');

		//
		$('input[type="text"]').focus(function() {
			$(this).addClass('focus');
		});
		$('input[type="text"]').blur(function() {
			$(this).removeClass('focus');
		});

		//
		$(".td_nav_main ul li, .td_nav_sub dl dd ul li").hover(
			function () {
				$(this).addClass("td_hover");
			},
			function () {
				$(this).removeClass("td_hover");
			}
		);

		//
		$(".td_nav_main ul li.td_last ul li:first-child a").css({'border-top':'none'});
		$(".td_tabs_menu ul li:first-child a").css({'border-top':'solid 5px #db2c20'});
		$(".td_tops_mostpopular .td_list_vertical li:first-child").css({'border-top':'none'});
		$('.td_ranking ul li:first-child').css({'padding-left':'0'});
		$('.td_comments .td_comments_links li:first-child').css({'padding':'0 0 0 6px'});
		$('.td_tops_twitter .td_mod_bd .tweet dl:first-child').css({'padding-top':'0', 'border-top':'none'});
		$('.td_tops_twitter .td_mod_bd .tweet dl:first-child dt img').css({'top':'4px'});

		//
		/*
		$('input[type=text]').addClass("text");
		$('input[type=password]').addClass("text");
		$('input[type=button]').addClass("button");
		$('input[type=reset]').addClass("reset");
		$('input[type=submit]').addClass("submit");
		$('input[type=radio]').addClass("radio");
		$('input[type=checkbox]').addClass("checkbox");
		$('input[type=file]').addClass("file");
		$('input[type=image]').addClass("image");
		*/

		//
		$('.td_footer_nav').addClass("fixPNG");
		$('.td_list_vertical li').addClass("fixPNG");
		$('.td_searchbar').addClass("fixPNG");
		$('.td_topads .td_ctwrap .td_topads_logo').addClass("fixPNG");
		$('.td_tabs_menu ul li a img').addClass("fixPNG");
		$('.td_logo').addClass("fixPNG");
		DD_belatedPNG.fix('.fixPNG');

	}

});

$(window).load(function() {

	$('.td_footer .td_footer_middle dl.td_col1, .td_footer .td_footer_middle dl.td_col2, .td_footer .td_footer_middle dl.td_col3').equalizeCols();
	//$('.td_ribbon_small dl dt').equalizeCols();



});
