/* @section: document ready */
$(document).ready(function() {
	
	/* open external links in new window */
	$("a").filter(function() {
	return this.hostname && this.hostname !== location.hostname;
	}).attr('target', '_blank');
	
	/* homepage banner rotator */
	var homepageBanner = $('#banner-slides');
	if(homepageBanner.length > 0){
		$(homepageBanner).cycle({ 
			fx:				'fade', 
			speed:			200,
			timeout:		8000,
			//timeout:		0,
			pager: 			'#banner-slider',
			cleartypeNoBg:	true
		});
	}
	
	/* form selectors (mostly for ie6) */
	$('input[type=text]').addClass("type-text");
	$('input[type=password]').addClass("type-password");
	
	/* control the home columns heights */
	if ($('.home-col').length) {
	
		var minHeight = 0;
		$('.home-col').each(function(index, element) {
			if($(element).outerHeight() > minHeight) {
				minHeight = $(element).outerHeight();
			}
			//console.log('min height ' + minHeight);
		});
		$('.home-col').each(function(index, element) {
			$(element).height(minHeight);
			//console.log('applying to ' + element);
		});
	}
	
	/* Sub menu has children? */
	$('#sub li').has('ul').addClass('parent');
	
	/* Giving the sub nav a full height of the #main */
	//var main_height = $('#main').height();
	//$("#sub").css("height",main_height);
	
	/* browser conditionals */
	if ($.browser.msie && $.browser.version <= 6) {
		//$('#banner #slide-menu').after('<div id="banner-after"><img src="/template-assets/toys_boy.png" alt=""/></div>');
		$("#content-home").children(':first').css("margin-left",0);
	}
	
});
