

$(function() {
  $('span.productprice').each(function() {
    // convert 1000000 to POA
    if (parseInt($(this).html()) == '100000') {
      $(this).html('POA');
    }    
  });  
  
  $('span.pricelink').each(function() {
    var h = $(this).html();
    if (h.indexOf('Login') != -1) {
      // convert logins to links
      h = '<a class="loginlink" href="javascript:showLogin();">' + h + '</h>';
      $(this).html(h);
    }    
  });
  
  
  $('#left a').each(function() {
    if ($(this).parent().find('a').length > 1) {
      $(this).attr('href','#');
      $(this).css('cursor','default');
    }    
  })
})

function showLogin() {
  $('#loginforminner').dialog({
    modal: true,
    height: 300,
    width: 350,
    buttons: {
      "Login": function() {
         document.homelogin.onsubmit();
         $(this).dialog('close');
      },
      "Cancel": function() {
          $(this).dialog('close');
          $('#login_error').hide();
          $('#awaiting_confirmation').hide();
          $('#suspended').hide();
      }
    }
  });
}
