// 
//  script.js
//  glitterfly.com
//  
//  Created by Loic Bistuer on 2008-07-11.
//  Copyright 2008 Six Media Co., Ltd.. All rights reserved.
// 

$(document).ready(function() {

  $('.bookmark').click(function() {
    var title = 'GlitterFly.com'
    var url = 'http://fr.glitterfly.com'
  
    if (jQuery.browser.msie) {
      window.external.AddFavorite(url, title);
    }
    else if (jQuery.browser.mozilla) {
      window.sidebar.addPanel(title, url, '');
      alert('By default this bookmark will open in a sidebar, to change that right-click on the bookmark and select "Properties" then uncheck "Load this bookmark in the sidebar"');
    }
    else if (jQuery.browser.opera) {
      var elem = document.createElement('a');
      elem.setAttribute('href',url);
      elem.setAttribute('title',title);
      elem.setAttribute('rel','sidebar');
      elem.click();
    }
    else {
      alert('In order to bookmark this site you need to do so manually using the interface of your browser.');
    }
  });
  
  $('#index-upload #upload-box #upload-tabs li')
    .hover(function() { $(this).css('cursor', 'pointer'); }, function() { $(this).css('cursor', 'default'); })
    .click(function() {
      var index = $('#upload-tabs li').index(this);
      $('#upload-tabs li').removeClass('active');
      $($('#upload-tabs li')[index]).addClass('active');
  
      $('#upload-forms fieldset').removeClass('active');
      $($('#upload-forms fieldset')[index]).addClass('active');
    });
  
  $('#index-index #intro').add('#index-index #start-now')
    .corner({
      tl: { radius: 15 },
      tr: { radius: 15 },
      bl: { radius: 15 },
      br: { radius: 15 },
      antiAlias: true,
      autoPad: true
    })
    .css('margin-top', '15px')
    .css('margin-bottom', '15px');

  $('#index-view p.copy input').click(function(){
    $(this).select();
  });

  if (typeof($.clipboardReady) != 'undefined') {
    $.clipboardReady(function(){
      $('#index-view p.copy button').add('#index-view p.copy input').click(function(){
        $.clipboard($(this).prev().attr('value'));
        $(this).parent().prev().hide().fadeIn('slow');
      });
    }, { swfpath: 'http://loics.local:8888/glitterfly.com/htdocs/scripts/jquery.clipboard.swf' }); 
  }

});
