function highlightLinks(obj) {
   var linkList = document.getElementById("navigation_search").getElementsByTagName("label");
   for (i = 0; i < linkList.length; i++) {
      linkList[i].className = "";
   }
   obj.className = "active";
}

function search_from_site() {
document.this_form.action = "/haku";
}

function search_from_forum() {
document.this_form.action = "/keskustelu/haku";
}

function search_from_products() {
document.this_form.action = "/tuotteet/haku";
}

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {

    $('#mycarousel').cycle({
        fx:     'fade',
        speed: 800,		// transition speed
        timeout: 4000,	// wait
        //after: onAfter,
        //before: onBefore,
        slideExpr: 'li',
        prev:    '#cycle-prev', 
        next:    '#cycle-next'
    });
    $('div#banner_carousel').cycle({
        speed: 2000,		
        timeout: 10000
    });
    $('#product_carousel_big').cycle({
        fx:     'fade',
        speed: 800,		// transition speed
        timeout: 4000,	// wait
        //after: onAfter,
        //before: onBefore,
        slideExpr: '.cycle-group ul',
        prev:    '#cycle-prev', 
        next:    '#cycle-next'
    });
    function onBefore() {
        //$(this).fadeIn();
    }
    function onAfter() {
        //$(this).fadeOut();
    }
    
	$('a#back_to_up').click(function(){
		$.scrollTo( 0, 400, {queue:true} );
		return false;
	});
	
	
	$('[class^=col_]').hide();
	
	$('a[class^=trigger]').click(function() {
		var $this = $(this);
		var x = $this.attr("className");
		$('.col_' + x).slideToggle(400);
		$(this).text($(this).text() == 'Piilota' ? 'Näytä' : 'Piilota');
		return false;
	});
	
  $("#ezcoa-711_marketing").click(function () {
    if($("#ezcoa-711_marketing").attr('checked')){
      $("#ezcoa-850_testgroup").attr('checked', false).attr('disabled', true);
    } else {
      $("#ezcoa-850_testgroup").attr('disabled', false);
    }
  });
  // Alussa tarkistetaan mikä on marketing kohdan value ja siten muutetaan testiryhmän statusta
  if($("#ezcoa-711_marketing").attr('checked')){
    $("#ezcoa-850_testgroup").attr('checked', false).attr('disabled', true);
  }
});

$(function() {
		$("#tabs").tabs();
});

function captureOnclick(actionnumber, name) 
{
	var YWATracker = YWA.getTracker("10001758215368");
	YWATracker.setDocumentName(name);
	YWATracker.setAction(actionnumber);
	YWATracker.submit_action();

}
