$(document).ready(function(){

	// preload swap images
    $('.swap').each(function(){
        $('<img/>')[0].src = $(this).attr('src').replace("-off.","-on.");
    });

	// hover over swap
	$('.swap').hover(
		function(){
			$(this).attr('src', $(this).attr('src').replace("-off.","-on."));
		},
		function(){
			if(!$(this).hasClass('selected'))
				$(this).attr('src', $(this).attr('src').replace("-on.","-off."));
		}
	);	

if (jQuery.browser.msie && jQuery.browser.version < 9) {
	$('#Button1').bind('click', function() {
		WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Button1", "", false, "", "https://www.thebloodalliance.com/index.cfm?group=home&action=checklogin", false, false));
	});
}else{
	$('.login-form').prepend('<input type="hidden" name="action" value="checklogin" />');
}

if ( $('.form-submit').text().trim() == "Thank you for your submission!"){
	setTimeout ('window.location = "http://www.igiveblood.com/"', 3000);
}



$(".mobile-apps").html( $(".mobile-apps-content").html() );

$('<div  class="donor-bottom clearfix" />').appendTo( $(".mobile-apps").parent() ).html( $(".donor-bottom-content").html() );


jQuery.jQueryRandom = 0;
  jQuery.extend(jQuery.expr[":"], {
    random: function(a, i, m, r) {
      if (i == 0) {
        jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
      };
      return i == jQuery.jQueryRandom;
    }
});

//$(".thanks").html( $(".thanks-content p:random").html() );
// console.info( $(".thanks-content").find("p:random").html() );

$(".thanks").html( $(".thanks-content").find("p:random").html() );
$(".facts").find(".subbox:first").html("Everyone is busy today. We understand hectic schedules. But, did you know it only takes one hour to donate one pint of blood. One hour to make a difference." );


});

	
