jQuery(function( $ ){

	/*
	 *  GLOBAL SETTINGS
	 */

	// NAVI STUFF
	$(".subdd-parent").hover(function() {
		$("ul" ,this).show();
	}, function() {
		$("ul", this).fadeOut(200);
	});

	// PRODUCT ENLARGER	
	$(".enlarge").fancybox({
		'zoomSpeedIn'		:	500,
		'zoomSpeedOut'		:	500
	});
	
	// PRODUCT PICTURE SWAPPER
	$(".picture-navi a").click(function(){
	
		var largePath = $(this).attr("href");
		var urlPath = $(this).attr("class");
		//var largeAlt = $(this).children().attr("alt");
		
		$(".bigpic").attr({ src: largePath });
		$(".bigpicurl").attr({ href: urlPath });
		 
		return false;
	});

	// PRODUCT TAB SETTING
	$("#product-bottom").tabs();

	// FOOTER TOOLTIP
	$(".footer-banners li a").tooltip({
		track: true, 
		delay: 0,
		opacity: 1,
		extraClass: "footertip",
		showURL: false, 
		fixPNG: true,  
		left: -25,
		top: -120
	
	});
	
	// FRONTPAGE SCROLLER
    $('.frontpage-scroller').cycle({
		fx: 		'scrollHorz',
        speed:       500,
        timeout:     5000,
		prev:   	 '#frontpage-prev', 
		next:   	 '#frontpage-next', 		
        pager:       '#frontpage-pager',
		pause:		 1,
		cleartype: 0
    });	
	
	/*
	 *  COMPETITION SETTINGS
	 */	
	
	// KISA - CUSTOM INPUT
	$(".kilpailu input").customInput();
	
	// KISA - TOOLTIP
	$(".kilpailu-vastaukset li, .kilpailu-radio").tooltip({
		track: true, 
		delay: 0,
		opacity: 1,
		extraClass: "kisatip",		
		bodyHandler: function() { 
			 return $($(this).children(".tt-hidden")).html(); 
		}, 
		showURL: false, 
		fixPNG: true,  
		left: 10,
		top: 10
	
	});
	
	
	// IE FIX FOR LABEL SELECT 
    if($.browser.msie) {

		$img = $("label img");

		$img.click(function() {
      			$("#" + $(this).parent().attr("for"))
					.change()
      				.click()
					.addClass("checked")
					.click();					

      	});

    }

	
});
