
(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var h = $(this).height();
	var oh = $(this).outerHeight();
	var mt = (h + (oh - h)) / 2;	
	$(this).css("margin-top", "-" + mt + "px");	
	$(this).css("top", "30%");
	$(this).css("position", "absolute");	
	});	
};
})(jQuery);

(function ($) {
$.fn.hAlign = function() {
	return this.each(function(i){
	var w = $(this).width();
	var ow = $(this).outerWidth();	
	var ml = (w + (ow - w)) / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	});
};
})(jQuery);




function startPage(){

$("#hold").hide();

 $('#hold').fadeIn(200);
 $('#hold').fadeOut(300);
 $('#hold').fadeIn(20);
 $('#hold').fadeOut(50);
 $('#hold').fadeIn(300);

}


function thankyou(){

$("h1").hide();

 $("h1")
   .fadeOut( function() 
   {
      setTimeout( function()
      {
         $("h1").fadeIn(500);
      }, 1000);
      
   });
}


function startSlideshow(){
  $('#FadeIt').fadeOut(700, function(){
    setTimeout(function(){
      $('#FadeIt').fadeIn(700, startSlideshow)
    },10);
  });
}

function buttons() {

$('#submit').hover(
            function(){ // RollOver
                $(this).attr({ src : 'img/submitHover.jpg'});
            },
            function(){ // RollOff
                $(this).attr({ src : 'img/submit.jpg'});    
                
               }
        );

}



$(document).ready(function() {

	startPage();
	thankyou();
	startSlideshow();
	buttons();
	
	$("#hold").vAlign();
	$("#hold").hAlign();	
	
});
