﻿/*
* Prospek base Javascript Class
*
* @author		Frédéric Trudeau <ftrudeau@prospek.ca>
* @copyright	Copyright (c) 2009 Prospek Inc. All rights reserved.
* @uses			jQuery 1.3.2
* @version		1.1
*/

var date = new Date();

var Prospek = {


	// Reset object
	cfg					: {},

	/*
	* Initialize ze thing.
	*
	* @author		Frédéric Trudeau <ftrudeau@prospek.ca>
	* @copyright	Copyright (c) 2009 Prospek Inc. All rights reserved.
	*/
	init: function(c)
	{
	
		this.cfg = c;
		
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// Cufon initialization
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		$('h2').addClass('auuxProThin');
		$('h2 small').addClass('auuxPro');
		$('.cc_blc_frontieres h4').addClass('auuxProThin');
		$('.cc_blc_right h3').addClass('auuxProThin');
		$('.cc_blc_right h3').addClass('auuxProThin');
		$('.hc_main_menu a span').addClass('auuxPro');
		$('.cc_blc_left > h4').addClass('auuxProBold');
		$('.cc_archives > h1').addClass('auuxProThin');
		
		$('.subscribe h2').removeClass('auuxProThin');
		$('.subscribe h2').addClass('auuxPro');
		$('.subscribe h3').addClass('auuxPro');
		
		$('h4.rss_title').addClass('auuxPro');
		if ( typeof this.cfg.cufon != 'undefined' )
		{
			var a = $(this.cfg.cufon).length;

			for ( var i = 0, l = a; i < l; ++i )
			{
				Cufon.replace(this.cfg.cufon[i][0], this.cfg.cufon[i][1]);
			}

			Cufon.now();

		}
		
		// Search input init
		$('#s').blur(Prospek._input_search_event);
		$('#s').click(Prospek._input_search_event)
		
		$('.subscribe').click(function(){
			location.href = '/admission/processus-dadmission/';
		});
				
		////////////////////////
		// INITIALIZE METHOD //
		//////////////////////

		if ( typeof this.cfg.initMethod != 'undefined' )
		{
			this[this.cfg.initMethod]();
		}
	
	},
	
	home: function() 
	{
		var flashHome =  this.cfg.flashHome;

		// Insert Flash
		swfobject.embedSWF(flashHome.path, flashHome.flashTarget, flashHome.width, flashHome.height, "9", false, flashHome.flashvars, flashHome.params, flashHome.attributes);
	},
	
	_input_search_event: function()
	{
		if($(this).val() == 'Recherche') $(this).val('');
		else if($(this).val() =='') $(this).val('Recherche');	
	}
}

/*
* Initialize Prospek Class on document ready
*
* @author		Frédéric Trudeau <ftrudeau@prospek.ca>
* @copyright	Copyright (c) 2009 Prospek Inc. All rights reserved.
* @see	http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx#tip25
*/

$(
	function ()
	{
		if(typeof(ProspekCfg) == 'undefined') ProspekCfg = {};
		Prospek.init(ProspekCfg);
	}
);