var colour_hash = new Array();
    colour_hash['bla'] = 'black.jpg';
    colour_hash['whi'] = 'white.jpg';
    colour_hash['red'] = 'red.jpg';
    colour_hash['blu'] = 'blue.jpg';
    colour_hash['yel'] = 'yellow.jpg';
    colour_hash['gre'] = 'green.jpg';

function chooseColour(filename, image_id) {
  this_colour = colour_hash[filename.substring( filename.length-3, filename.length )];
  thumbnail = "/static/images/gallery/"+filename.substring(0, 16)+'tn_'+filename.substring(16, filename.length-8)+'_'+this_colour;
  primary = "/static/images/gallery/"+filename.substring(0, 16)+filename.substring(16, filename.length-8)+'_'+this_colour;
  document.getElementById(image_id).src=thumbnail;
  document.getElementById(image_id).width=170;
  document.getElementById(image_id).height=170;
  document.getElementById(image_id).setAttribute('pbSrcNL',primary);
  return 1;
}


function dgainHighlight(id) {
  root_id = id.substring(0, id.length-2)
  position = id.substring(id.length-1)
  for (var i=1; i<=position; i++) {
    document.getElementById(root_id+'_'+i).src="/static/images/widgets/gold.gif";
  }
  return 1;
}

function dloseHighlight(id) {
  root_id = id.substring(0, id.length-2)
  for (var i=1; i<=5; i++) {
    document.getElementById(root_id+'_'+i).src="/static/images/widgets/white.gif";
  }
  return 1;
}

function dsubmitVote(id, user_id) {
  root_id = id.substring(0, id.length-2)
  position = id.substring(id.length-1)
  //alert('Submitting one vote of '+position+' for user: '+user_id+' for '+root_id)
  document.tshirt_contest.vote_id.value = root_id;
  document.tshirt_contest.vote_stars.value = position;
  document.tshirt_contest.submit();
  return 1;
}

