$(document).ready(function() {


  // Debug
  if (!window.console) console = {};
  console.log = console.log || function(){};
  console.warn = console.warn || function(){};
  console.error = console.error || function(){};
  console.info = console.info || function(){};  
 
	//console.log("log test");
  //console.error("error test");
  //console.info("info test");
  //console.warn("warn test");
  
  /* Gallery */
  $(".galleryListImage img").hover(  
    function () {
      var srcCropped = $(this).attr('src');
      var srcOriginal = $(this).parent().attr('href');

      $('.galleryBigImage a').attr('href', srcOriginal);
      $('.galleryBigImage img').attr('src', srcCropped.substring(0, srcCropped.length - 10) );
      //$(this).addClass("hover");
    },
    function () {
      //$(this).removeClass("hover");
    }
  );
  $("a[rel=galleryList]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">' + title + '</span>';
		}
	});

  /* Toogle title into text fields */
  $('input[type="text"]').toggleField();
  
  /* Embed Rolex flash */
  $('.contentHomeFooterBox3 .tk_contentHomeFooterBoxInner .flashContent').flash(
      { src: '/media/12201/tomkristensen_262x88.swf',
        width: 262,
        height: 88 }
  );


    



          

	
});



$(window).load(function() {

  /* Styling */ 
    
    
    if ($('body.tk_home').length == 0) {
      // Resize content area to make sticky footer
      var fixedElementsHeight = $(".headerWrapper").height() + $(".footerWrapper").height();
      if( $(".contentWrapper").height() < ($(window).height() - fixedElementsHeight) ) {
        $(".contentWrapper").height( ($(window).height() - fixedElementsHeight) );
        //console.info("$(\".contentWrapper\").height( ($(window).height()="+$(window).height()+" - fixedElementsHeight="+fixedElementsHeight+") );");
      }
      $(window).resize(function() { 
        var fixedElementsHeight = $(".headerWrapper").height() + $(".footerWrapper").height();
         if( $(".contentWrapper").height() < ($(window).height() - fixedElementsHeight) ) $(".contentWrapper").height( ($(window).height() - fixedElementsHeight ) );  
         //console.info("$(\".contentWrapper\").height( ($(window).height()="+$(window).height()+" - fixedElementsHeight="+fixedElementsHeight+") );");   
      }); 
      
    } else {
      $(".lightBubbleContainer").height( $(window).height() );
    }  
    

  
});


(function($){

 





 



})(this.jQuery);




window.log = function(){
  log.history = log.history || [];   
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);




