 var urlAddress = "http://www.ratemydick.org/";
 var pageName = "RateMyDick.org";

 function addToFavorites()
 {
  if (window.external)
  {
   window.external.AddFavorite(urlAddress,pageName)
  }
  else
  { 
   alert("Sorry, your browser doesn't support this function.");
  }
 }

  function confirm_comment_delete(id) {
 
   if (confirm("Are you sure you want to permanently delete this message?")) {
      location.href="/delete_comment.php?id=" + id;
   }
 }

  function confirm_public_comment_delete(id) {
 
   if (confirm("Are you sure you want to permanently delete this message?")) {
      location.href="/delete_public_comment.php?id=" + id;
   }
 }
 
  function confirm_fav_delete(id) {
 
   if (confirm("Are you sure you want to remove this favourite?")) {
      location.href="/delete_favourite.php?id=" + id;
   }
 }
 
 function swapPic(name, url) {
        if (document.getElementById(name).filters) {
          document.getElementById(name).filters[0].Apply();
        }
        document.getElementById(name).src=url;
        if (document.getElementById(name).filters) {        
          document.getElementById(name).filters[0].Play();
        }
 }
 
 function swapHTML(name, html) {
   document.getElementById(name).innerHTML=html;
 }
 
 function swapLink(name, link) {
    document.getElementById(name).href=link;
 }
 
 function displayRating(rating) {
       
    for (i = 1; i <= rating; i++) {
    
      var item = document.getElementById('rating-' + i);
    
      if (item.filters) {
        item.filters[0].Apply();
      }
      
      item.src = '/images/rating/' + i + '.gif';
      
      if (item.filters) {
        item.filters[0].Play();
      }      
      
    }
    
    for (i = rating + 1; i <= 10; i++) {
      document.getElementById('rating-' + i).src = '/images/rating/faded-' + i + '.gif';   
    }
    
    document.getElementById('rating-text').innerHTML = rating;
    document.getElementById('rating').value = rating;
 }