$(document).ready(function(){

	$('#koodoz a a').each(function(){ $(this).replaceWith($(this).html()); });

	$('a[rel*=external]').attr('target','_blank');
	$('a[rel*=print]').click(function() { window.print(); return false; }).css({'cursor':'pointer'});

	$('li.listItem:nth-child(4n)').css({'padding-right':'0'});
	$('li.listItem:first, li.listItem:nth-child(4n+1)').css({'padding-left':'0'});

	$('.common .promoSqr:last').addClass('last');

	$('input[type=text], input[type=password], textarea').not('.noLin').labelsInInputs({ color: '#444', blur_color: '#CCC', top: '13px', left: '8px', font_size: '1em' });
	$('#keyword').labelsInInputs({ color: '#444', blur_color: '#CCC', top: '11px', left: '43px', font_size: '1em' });
	
	$('select:not(#country_id, #shipping_country_id)').labelsInSelects();
	$('label[for=country_id], label[for=shipping_country_id]').hide();
	
	$('html:not(.ie7) select').makeNiceSelects();
	$('input[type*=text]').addClass('inputText');
/*	
	// fix webkit image resizing by using da'SVGs.
	if ($.browser.webkit) {
		$('#mainNav img').each(function(i) {
			$(this).attr('src', $(this).attr('src').replace('png','svg'));
		});
	}
*/
	// cart checkout slidey element
	$('#cartInfo, #extraCart').hover(
		function() {
			$('#extraCart').stop(true, true).slideDown();
		},
		function() {
			$('#extraCart').stop(true, true).delay(1500).slideUp();
		}
	);

	//animate menu items
	$('html:not(.ie7) #mainNav a').hover(function() {
	  $(this).find('img').animate({'height':'100%'},'fast');
	}, function() {
	  $(this).find('img').animate({'height':'40px'},'fast');
	});
	$('html.ie7 #mainNav img').css({'height':'100%'});


	// slide stuff around
	$(".slider").slides({
		generatePagination:false, //plugin chokes without this option --daniel
		play: 5500,
		fadeSpeed: 350,
		effect: 'fade'
	});
	$('.man-slider').scrollElement();

	//modal box wherever it's needed
	$('.box').colorbox();
	
	//nice animations for error and warning messages
	$('.warning, .error').css({'display':'none'}).slideDown('slow');
	$('span.error').parent('p').addClass('error');
	
	// bring left column down to same height as pagination
	the_height = $('#listContent').outerHeight(true) - ( parseInt($('#listPromo').css('margin-top')) + parseInt($('#listPromo').css('padding-top')) + parseInt($('#listPromo').css('padding-bottom')) );
	$('#listPromo').css({'min-height': the_height + 'px' });	
	
	//take whatever is in the .full div and place it outside columns in information pages
	$('#contentWrap .full').insertBefore('#contentWrap').wrap('<div class="wrapper" />');
	
});
