<!--

function transitionImage(oldImage,newImage) //{{{
{
	var fadeOut = function()
	{
		var div = $(oldImage).setStyles({
			opacity: 1
		});
		
		new Fx.Style(div, 'opacity', {duration: 700}).start(0);
		
		fadeIn();
		
	};
	
	var fadeIn = function()
	{
		
		var div2 = $(newImage).setStyles({
			display:'block',
			opacity: 0
		});
			
		new Fx.Style(div2, 'opacity', {duration: 700}).start(1);
		
	};
	
	if(newImage != activeImage)
	{
		fadeOut();
		activeImage = newImage;		
	}
}
//}}}

var Site = {
	
  start: function(){
	  
	  if ($('navigation')){
	    Site.appearText();
	    }
	  if ($('special')){
	    Site.appearSpecial();
	    }
	  if ($('contact_en')){
	    Site.wFormsSettingsEN();
	    }
	  if ($('contact_fr')){
	    Site.wFormsSettingsFR();
	    }
	  if ($('vScFrameWrap')){
	    Site.showcaseMorph();
	    }


  },
  appearText: function(){
	  
    var sideblocks = $$('#navigation li');
		    
    sideblocks.each(function(el, i){
	var first = el.getFirst();
	if (!first || first.getTag() != 'a') return;
	var overfxs = new Fx.Styles(first, {'duration': 200, 'wait': false});
	
	var tocolor, fromcolor;
	tocolor = 'faec8f';
	fromcolor = '8FBC8F';
	el.mouseouted = true;
	
	el.addEvent('mouseenter', function(e){
	    overfxs.start({
	      'color': tocolor
	    });
	});
	
	el.addEvent('mouseleave', function(e){
	    overfxs.start({
	      'color': fromcolor
	    });
	});
    });
  },
  appearSpecial: function(){

    var myTransition = new Fx.Transition(Fx.Transitions.Bounce, 10);
    var apearFx = new Fx.Style('special', 'left', {
      'wait': false,
      'duration': 2000,
      'transition': myTransition.easeOut
    });
    
    apearFx.start(-1350,350);

  },
  wFormsSettingsEN: function(){
     
    wFORMS.showAlertOnError = true; /* or true */
    wFORMS.behaviors['validation'].errMsg_date 		= "Invalid Date. (mm/dd/yyyy)",
    wFORMS.behaviors['validation'].errMsg_custom	= 'Please enter a valid phone number ex.555-555-5555';
    wFORMS.behaviors['validation'].errMsg_notification	= "%% error(s) detected. Your form has not been submitted yet.<br />Please check the information you provided.";
    
    // custom notification area
    wFORMS.behaviors['validation'].showAlert = function (nbTotalErrors) {
	var placeHolder = document.getElementById('alertMessagePlaceHolder');
	placeHolder.innerHTML = wFORMS.behaviors['validation'].errMsg_notification.replace('%%',nbTotalErrors); 
	placeHolder.style.display = 'block';
    } 

  },
  wFormsSettingsFR: function(){
     
    wFORMS.showAlertOnError = true; /* or true */

    wFORMS.behaviors['validation'].errMsg_required	= "Champs requis. ",
    wFORMS.behaviors['validation'].errMsg_alpha	     	= "Caract&egrave;res alphab&eacute;tiques uniquement (a-z).",
    wFORMS.behaviors['validation'].errMsg_email 	= "Adresse email invalide.",
    wFORMS.behaviors['validation'].errMsg_integer 	= "Entrez un nombre entier.",
    wFORMS.behaviors['validation'].errMsg_float 	= "Entrez un nombre.",
    wFORMS.behaviors['validation'].errMsg_password 	= "",
    wFORMS.behaviors['validation'].errMsg_alphanum 	= "Caract&egrave;res alpha-numeriques uniquement (a-z 0-9).",
    wFORMS.behaviors['validation'].errMsg_date 		= "Date invalide. (jj/mm/aaaa)",
    wFORMS.behaviors['validation'].errMsg_notification  = "Il y a %% erreur(s). Votre formulaire n'a pas &eacute;t&eacute; envoy&eacute;.<br />V&eacute;rifiez les informations saisies.",  // %% will be replaced by the actual number of errors.
    wFORMS.behaviors['validation'].errMsg_custom	= "Telephone invalide. (555-555-5555).",
    
    // custom notification area
    wFORMS.behaviors['validation'].showAlert = function (nbTotalErrors) {
	var placeHolder = document.getElementById('alertMessagePlaceHolder');
	placeHolder.innerHTML = wFORMS.behaviors['validation'].errMsg_notification.replace('%%',nbTotalErrors); 
	placeHolder.style.display = 'block';
    } 

  },
  showcaseMorph: function(){

      //set the default image
      activeImage = 'sc0';
      activeLink  = '0';

      //initialise the default image
      var initialise = $(activeImage).setStyles({display:'block',opacity: 0});	
      new Fx.Style(initialise, 'opacity', {duration: 1} ).set(1);

      //event listener
      $('vScNav').getElements('a').addEvent('click', function(e) 
      {	
	  new Event(e).stop();
	  activeLink = this.id;
	  var newImage = 'sc'+this.id;
	  transitionImage(activeImage,newImage);
      });

  //END Function
  }
    
};

window.addEvent('load', Site.start);


// -->
