$(document).ready(function() {

  // forms
  $.fn.search = function() {
  	return this.focus(function() {
  		if( this.value == this.defaultValue ) {
  			this.value = "";
  		}
  	}).blur(function() {
  		if( !this.value.length ) {
  			this.value = this.defaultValue;
  		}
  	});
  };
  $("#s").search();  
    
  // fancybox
	/* This is basic - uses default settings */
	$("a.fb").fancybox();
	$("a#watch").fancybox();	
	$("a.group").fancybox({
		'zoomSpeedIn':		200, 
		'zoomSpeedOut':	  200, 
    'transitionIn': 'elastic',
		'transitionOut': 'elastic',
		'overlayShow':		true
	});
  $("a.fbiframe").fancybox({
    'width': '75%',
    'height': '75%',
    'autoScale': true,
    'transitionIn': 'fade',
    'transitionOut': 'fade',
    'type': 'iframe',
    'hideOnContentClick': false
  }); 
  
  // popup
  $('a.pop').each(function(link) {
    link.onclick = function(){
      window.open(this.href,'name','options');
      return false;
    };
  });  
  
	/* konami */
  (function() {
  $.fn.extend({
    showMe: $.fn.addClass
    });
    var a = 0;
    var kkeys = '';
    var konami = '38,38,40,40,37,39,37,39,66,65';
    $(window).keydown(function(e) {
    kkeys += ',' + e.keyCode;
    if(kkeys.indexOf(konami)>=0 && a<=1) {
    a += 1;
    // DO KONAMI THING
    if(a==1) {
    $('#page-wrapper').showMe('unicorns');
    kkeys = '';
    }
    else {
    $('#page-wrapper').showMe('evil');
    }
    }
    });
  })();	
    
});
