jQuery(document).ready(function(){
	jQuery.preloadImages("http://bloghelpr.us/wp-content/themes/bloghelpr/images/redguard2.png","http://bloghelpr.us/wp-content/themes/bloghelpr/images/redguard.png");
	jQuery.preloadImages("http://bloghelpr.us/wp-content/themes/bloghelpr/images/blueguard2.png","http://bloghelpr.us/wp-content/themes/bloghelpr/images/blueguard.png");
	jQuery.preloadImages("http://bloghelpr.us/wp-content/themes/bloghelpr/images/greenguard2.png","http://bloghelpr.us/wp-content/themes/bloghelpr/images/greenguard.png");
	jQuery("body").append("<div class='cloud1'></div><div class='cloud2'></div><div class='cloud3'></div><div class='cloud4'></div><div class='cloud5'></div>");
	jQuery("#homeContent .mainlifeguards").hover(
		function(){},
		function() {
			jQuery("#customdesign").hide();
			jQuery("#customideas").hide();
			jQuery("#lifeguard").hide();
			jQuery("#homePhrase").fadeIn("fast");
		}
	);
	jQuery(".lifeguard").hover(
      function () {
        jQuery("#lifeguard").fadeIn("fast");
        jQuery("#customdesign").hide();
		jQuery("#customideas").hide();
		jQuery("#homePhrase").hide();
      }, 
      function () {
      }
    );
	jQuery(".customdesign").hover(
      function () {
        jQuery("#lifeguard").hide();
        jQuery("#customdesign").fadeIn("fast");
		jQuery("#customideas").hide();
		jQuery("#homePhrase").hide();
      }, 
      function () {
      }
    );
	jQuery(".customideas").hover(
      function () {
        jQuery("#lifeguard").hide();
        jQuery("#customdesign").hide();
		jQuery("#customideas").fadeIn("fast");
		jQuery("#homePhrase").hide();
      }, 
      function () {
      }
    );
	jQuery("#container").css("z-index","100");
	jQuery(".cloud5").css("z-index","98");
	animateClouds();
});
var winW, curX;
function animateClouds(){
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth;
	 }
	 else
	 {
	  winW = window.innerWidth;
	 }
	}
	jQuery(".cloud1").css({left: winW + "px"});
	curX1= winW;
	curX2 = 10;
	curX3 = 400;
	curX4 = 800;
	curX5 = 600;
	moveCloud1();
	moveCloud2();
	moveCloud3();
	moveCloud4();
	moveCloud5();
}

function moveCloud1(){
	curX1--;
	if (curX1 < -175) curX1 = winW;
	jQuery(".cloud1" ).css("left", curX1 + "px");
	setTimeout(moveCloud1, 50);
}

function moveCloud2(){
	curX2--;
	if (curX2 < -88) curX2 = winW;
	jQuery(".cloud2" ).css("left", curX2 + "px");
	setTimeout(moveCloud2, 70);
}

function moveCloud3(){
	curX3--;
	if (curX3 < -58) curX3 = winW;
	jQuery(".cloud3" ).css("left", curX3 + "px");
	setTimeout(moveCloud3, 90);
}

function moveCloud4(){
	curX4--;
	if (curX4 < -88) curX4 = winW;
	jQuery(".cloud4" ).css("left", curX4 + "px");
	setTimeout(moveCloud4, 100);
}

function moveCloud5(){
	curX5--;
	if (curX5 < -117) curX5 = winW;
	jQuery(".cloud5" ).css("left", curX5 + "px");
	setTimeout(moveCloud5, 80);
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}