var wxtext = ''
$(function(){
$('table th').hover(
	function(){
		$(this).css({color:'red'});
	},
	function(){
		$(this).css({color:'blue'});
	}
);
$('table th')
  .css({cursor:'pointer'})
  .click(function(event){
  var colx = $(this).attr('cellIndex');
    var seektext = $(this).parent().parent().find('tr:eq(1) td:eq('+colx+') img').attr('alt');
    var idtext = $(this).attr('id');
    if (idtext && !idtext=='')
       {seektext=idtext;}
    wxtext=seektext;
  })
.bind('click',function(event){
window.top.location.href="http://www.bleken.no/beas/webshop.wcs?sok_tekst="+wxtext;
})

$('table tr:nth-child(3n-1) td')
  .css({cursor:'pointer'})
  .click(function(event){
  var colx = $(this).attr('cellIndex');
    var seektext = $('img',this).attr('alt');
    var idtext = $(this).parent().parent().find('tr:eq(0) th:eq('+colx+')').attr('id');
    if (idtext && !idtext=='')
       {seektext=idtext;}
    wxtext=seektext;
  })
.bind('click',function(event){
window.top.location.href="http://www.bleken.no/beas/webshop.wcs?sok_tekst="+wxtext;
})

});
