// 
//  global.js
//  harry-potter
//  
//  Created by VM on 2010-01-17.
//  Copyright 2010 Konspire Design. All rights reserved.
// 

$(document).ready(function() {
  
  // dealing with mailing list subscription form
  var emailMsg = 'Enter email';
  
  $('#email').val(emailMsg)
  .focus(function() {
    if($(this).val() === emailMsg) {
      $(this).addClass('focused').val('');
    } else {
      $(this).addClass('focused');
    }
  })
  .blur(function() {
    $(this).removeClass('focused');
    if($(this).val() === '') $(this).val(emailMsg);
  })
  
  // quick and dirty fix of WP auto-formatting. targeting the sign-up form
//  $('form.phplist').unwrap('p');
//  $('.signupBox').find('p:nth-child(4)').remove();

  // rounded corners for captioned images
  $('.wp-caption').prepend('<div class="boxtop"><div></div></div>');
  
  // rounded corners of wp-latestphotos
  $('.wp-latestphotos li a').prepend('<div class="boxtop"><div></div></div>').append('<div class="boxbottom"><div></div></div>')

  // ToolTip settings
  $('#twitterIcon').qtip({
     content: '<strong>Follow us on Twitter:</strong><br /> <a href="http://twitter.com/hpotterworld">twitter.com/hpotterworld</a>',
     show: 'mouseover',
     hide: 'mouseout',
     style: {
       name: 'blue',
       textAlign: 'center',
       tip: 'bottomMiddle',
       background: '#50c7e9',
       color: '#053d4d',
       border: {
        width: 0,
        radius: 15,
        color: '#50c7e9'
       }
     },
     position: {
       corner: {
         target: 'topMiddle',
         tooltip: 'bottomMiddle'
       }
     },
     hide: { when: 'inactive', delay: 2300 }
  });
  $('#rssIcon').qtip({
     content: '<strong>RSS 2.0:</strong> Get Updates in Your Feed Reader!',
     show: 'mouseover',
     hide: 'mouseout',
     style: {
       name: 'blue',
       textAlign: 'center',
       tip: 'bottomMiddle',
       background: '#d97103',
       color: '#703b0c',
       border: {
        width: 0,
        radius: 15,
        color: '#d97103'
       }
     },
     position: {
       corner: {
         target: 'topMiddle',
         tooltip: 'bottomMiddle'
       }
     },
     hide: { when: 'inactive', delay: 2300 }
  });
  
})