$(document).ready(function(){
  $("a.gmap").fancybox({
    'hideOnContentClick': false,
    'width': 800,
    'height': 486
  });
  
  $("label").inFieldLabels();
  	$("#antispamFooter").val("antispam");

  
  var side = true;
  
  $("#flipbox").bind("click", function(){
  	if (side == true)
	{
		$("#flipbox").flip({
  			direction: 'lr',
			content: photoBack
  		})
		side = false;
	}
	else{
		$("#flipbox").revertFlip();
		side = true;
	}
  })
    var background = Math.floor(Math.random()*2);
  if (background == 0){
  	$('body').addClass('BackgroundOne');
  }
  else if(background == 1){
  	$('body').addClass('BackgroundTwo');
  }
  else{}
  
  var origWrapHeight = $('#wrap').height();
  var origFooterHeight = $('#footer').height();
  $('.reveal a').click(function(e){
    e.preventDefault();
    
    if ($('#wrap').height() != 0) {
        $('html').css({height:'100%'});
        $('body').css({height:'101%', padding:0});
        $('#wrap').css({overflow:'hidden'});
        $('#footer').css({'margin-top':0, overflow:'hidden', top:0, height:'20px'});
        $('.reveal a span').text('Click to restore website');
        $('.reveal a').attr('title','Click to restore website');
        $('#footer').animate({width:'100%'},'slow');
        $('#wrap').animate({opacity:0,height:0}, 'slow');
        window.scrollTo(0,0);
    } else {
        $('#footer').css({height:origFooterHeight, width:'1005px', overflow:'visible', 'margin-top':'20px'});
        $('#wrap').animate({height:origWrapHeight, opacity:1}, 'slow');
        $('#wrap').css({overflow:'visible'});
        $('body').css({padding:'50px 0', height:'auto'});
        $('html').css({height:'auto'});
        $('.reveal a span').text('Click to view background');
        $('.reveal a').attr('title','Click to view background');
    }
  });

});
