function viewLogo(num)
{
  $('#logopreview').fadeOut('normal', changePic);
  function changePic() {
    $('#logopreview').attr({
      src: 'logos/logo-'+num+'.gif'
    });
  };
  $('#logopreview').fadeIn('normal');
}

function sendMessage()
{
  var message = $('#contactmessage').val();

  message = jQuery.trim(message);

  if(message.length > 0)
  {
    var data = 'action=sendThought&message='+encodeURIComponent(message);

    $.ajax({
      type: 'POST',
      url: './php/ajaxactions.php',
      data: data,
      success: function(Request){
        document.getElementById('contactmessage').value = "";
        document.getElementById('charcounter').innerHTML = "200";
        closePopup('bsbubble_contact', 'bubblebg', true, false);
      }
    });
  }
  else
  {
    $("#contactmessage").effect("highlight", { 
      color: '#ffc7c7'
    }, 1000);
  }
}

function openMenu()
{
  $("#menuaccessor").animate({
    width: "600px"
  }, 500, "swing");
  $("#mainmenu").animate({
    width: "600px",
    height: "142px",
    top: "0px",
    left: getHCenter(600)
  }, 500, "swing", function() {
    $("#menuitems").fadeIn(500, function() {
      changeLink();
    } );
  } );
}

function changeLink()
{
  href = $("#menuaccessor > *").attr("href");
  if(href == 'javascript:openMenu();')
  {
    $("#menuaccessor > *").attr( {
      href: "javascript:closeMenu();"
    });
    $("#menuaccessor > *").fadeOut(100, function() {
      $("#menuaccessor > *").html('<img src="images/btn_menu_up.gif" border="0" alt="close the mainmenu" title="close the mainmenu" />');
    });
    $("#menuaccessor > *").fadeIn(100);
  }
  else
  {
    $("#menuaccessor > *").attr( {
      href: "javascript:openMenu();"
    });
    $("#menuaccessor > *").fadeOut(100, function() {
      $("#menuaccessor > *").html('<img src="images/btn_menu_down.gif" border="0" alt="open the mainmenu" title="open the mainmenu" />');
    });
    $("#menuaccessor > *").fadeIn(100);
  }
}

function hoverOverItem(el)
{
  $(el).css('opacity', '1.0');
}

function hoverOutItem(el)
{
  $(el).css('opacity', '0.8');
}

function closeMenu()
{
  $("#menuitems").fadeOut(500, function() {
    $("#mainmenu").animate({
      width: "70px",
      height: "20px",
      left: getHCenter(70)
    }, 500, "swing" );
    $("#menuaccessor").animate({
      width: "70px",
      height: "20px"
    }, 500, "swing", function() {
      changeLink();
    } );
  });
}

