$(document).ready(function(){

  var params = {wmode: 'transparent'};
  
  swfobject.embedSWF("images/content/heart-animation.swf", "heartanimation", "840", "550", "9");
  swfobject.embedSWF("images/content/heart-animation-cycle.swf", "heartanimation-cycle", "450", "300", "9");
  swfobject.embedSWF("images/content/cardiovascular-fitness-slide_rebuild.swf", "cardiovascular-fitness-slide", "900", "540", "9");
  swfobject.embedSWF("images/content/vo2max-demonstration.swf", "vo2max", "900", "680", "9");
  swfobject.embedSWF("images/content/training-increase-diagram.swf", "training-increase", "900", "400", "9");
  swfobject.embedSWF("images/content/de-training-diagram.swf", "de-train", "900", "400", "9");
  swfobject.embedSWF("images/content/hr-variability-demonstration.swf", "hr-variability", "900", "520", "9");
  swfobject.embedSWF("images/content/hr-variability-comparison.swf", "hr-variability-compare", "900", "520", "9");
  swfobject.embedSWF("images/content/resting-ecg.swf", "resting-ecg", "550px", "200px", "9");
  swfobject.embedSWF("images/content/exercise-ecg.swf", "exercise-ecg", "550px", "200px", "9");
  swfobject.embedSWF("images/content/overtraining-curve.swf", "overtraining-graph", "450px", "350px", "9", "expressInstall.swf", "", params, "");
  swfobject.embedSWF("images/content/super-compensation-curve.swf", "super-compensation-curve", "450px", "250px", "9");
  
  $('#slideshow').cycle();
  
	//tooltip
	$("a[rel]").overlay({

		mask: 'darkred',
		effect: 'apple',

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}

	});
	
	$("#login").validationEngine();
	$("#form").validationEngine();
	$("#form_internal").validationEngine();
	
	$("#login").hide();
	$("#form").hide();
	$(".course").click(function() {
		$("#login").show(); $("#form").hide(); $.validationEngine.closePrompt('.formError',true); return false
	});
	$(".login_switch").click(function() {
		$("#form").show(); $("#login").hide(); $.validationEngine.closePrompt('.formError',true); return false 
	});

});

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}
		
		// JUST AN EXAMPLE OF CUSTOM VALIDATI0N FUNCTIONS : funcCall[validate2fields]
	function validate2fields(){
		if($("#firstname").val() =="" ||  $("#lastname").val() == ""){
			return false;
		}else{
			return true;
		}
	}

