//When DOM is ready
$(function() {
  $('#searchProfileL')
    .focus(function() {
      if( this.value == this.defaultValue ) {
        $(this).css({"color" : "#323232", "font-size" : "11px"});
        this.value = "";
      }
    })
    .blur(function() {
      if( !this.value.length ) {
        $(this).css({"color" : "#9f9f9f", "font-size" : "11px"});
        this.value = this.defaultValue;
      }
  });

  $('.bG2')
    .mouseover(function(){
      $(this).children('div')[0].style.backgroundColor='#F2F2F2';
      $(this).children('div')[0].style.borderBottom='1px solid #E0E0E0';
      $(this).css("background-color", "#D4D4D4");
      $(this).css("border-color", "#999");
      $(this).css("color", "#000");
    })
    .mouseout(function(){
      $(this).children('div')[0].style.backgroundColor='#f9f9f9';
      $(this).children('div')[0].style.borderBottom='1px solid #eee';
      $(this).css("background-color", "#e3e3e3");
      $(this).css("border-color", "#cccccc");
      $(this).css("color", "#000");
    })
    .mousedown(function(){
      $(this).children('div')[0].style.backgroundColor='#333333';
      $(this).children('div')[0].style.borderBottom='1px solid #1A1A1A';
      $(this).css("background-color", "#000");
      $(this).css("border-color", "#666");
      $(this).css("color","#fff");
      return false;
    });

  $('#btn_login').click(function() {
    window.name = $.base64Encode($('#login_username_side').val()) + ':' + $.base64Encode($('#login_password_side').val());
    window.location = 'http://os.cloudme.com/login.html';
    return false;
  });

  $('#login_username_side').bind('keypress', function(e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    if(code == 13) { //Enter keycode
      $('#btn_login').click();
    }
  });

  $('#login_password_side').bind('keypress', function(e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    if(code == 13) { //Enter keycode
      $('#btn_login').click();
    }
  });

});

$(document).ready(function() {
  $('#photosContainer a').lightBox();
  $('.photoFile').lightBox();
});

