	/**
	 * 
	 * Javascript functions for all the website.
	 * 
	 * @name module_movies
	 * @author Vincent Cantin Bellemare
	 * @since 2006-07-06
	 * @version 1.0.0
	 * @package reptileframework
	 * 
	 * 
	 */
	
	function select_lang(selectBox,defaultLang)
	{
	
		var currentpage = document.location.href;
		var position = currentpage.indexOf('lang=');
		if (position == -1)
		{
			lang = defaultLang;
		}
		else
		{
			var lang = currentpage.substr(position + 5, 2);	
		}
		for(var i=0;i<selectBox.options.length;i++)
		{
			var position2 = selectBox.options[i].value.indexOf('lang=');
			var lang2 = selectBox.options[i].value.substr(position2 + 5, 2);	
			if(lang2 == lang)
			{
				selectBox.options[i].selected = true;
			}
		}
		
	}
	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
}
	
	
	
	function is_phones(phone1,phone2)
	{
		if(is_phone(phone1))
		{
			return true;	
		}
		
		if(is_phone(phone2))
		{
			return true;	
		}
		
		return false;
		
	}
	
	
	
	function is_credit_card(creditCard)
	{
		
		if(creditCard > 1000000000000000 && creditCard < 10000000000000000)
			return true;
		else
			return false;
			
		
	}
	
	
	
	function is_int(theInt)
	{
		
		if(isNaN(theInt))
		{
			return false;			
		}

		if(theInt > 0)
		{
			return true;
		}
	
		return false;
	
	}
	
	
	function is_expiration(expiration)
	{
			expirationArray = Array
			expirationArray = expiration.split('/');
			
			if(expirationArray.length != 2)
			{
				return false;	
			}
			/*
			The year is harcoded because we can't be shure to get the good year by javascript
			*/
			return (expirationArray[0] > 0 && expirationArray[0] < 13 &&  expirationArray[1] >= 07 && expirationArray[1] < 99  );	
	
	}
	
	
	function is_phone(phone)
	{
			
			if(phone.length<3)
			{
				return false;				 
			}

	
			 if(phone.match(/[\<\>\,\;\:\\\"\[\]]/) || phone.match(/[a-zA-Z]/))
			 {
				return false;				 
			 }

			 
			return true;
			
			
	}
	
	function is_empty(theField)
	{
			if(theField.length > 0)
			{
				return true;				 
			}		
			
			return false;
	}
	
	function is_priceFormat(price){
		var reg = /^\d+[.]{1}\d{2}$/;
		return reg.test(price);
	}
	
	function is_timeFormat(time){
		var reg = /^(\d{1}|\d{2})[:]{1}\d{2}$/;
		return reg.test(time);
	}
	
	function is_email (strng) 
	{
	
		if (strng == "") {
		 return false;
		}
		
			var emailFilter=/^.+@.+\..{2,3}$/;
			if (!(emailFilter.test(strng))) { 
			   return false;
			}
			else {
		
			   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
				 if (strng.match(illegalChars)) {
				  return false;
			   }
			}
		return true;    
	}
	
	


	function is_year(theYear)
	{
		if(theYear > 1968 && theYear < 2500 )
		{
			return true
		}
		
		return false
		
	}

	
	function is_positive_int(theNumber)
	{

		if(theNumber > 0 )
		{
			return true
		}
		
		return false
		
	}

	
	function trace(logprint)
	{
		if( window.console ) 
		{
			window.console.log( logprint ) ;
		}
			
		
	}


	function trace(logprint)
	{
		if( window.console ) 
		{
			window.console.log( logprint ) ;
		}
			
		
	}


	
	function is_explorer()
	{
		return (typeof document.body.style.maxHeight != "undefined") ? 0 : 1 ;	
		
	}



	function _displayNoneTimer(divToHide)
	{

		$(divToHide).style.display = 'none';
	}
	
	
	function displayNoneTimer(divToHide, timer)
	{

		if( $(divToHide) )
		{	
			RRRtimer = window.setTimeout("_displayNoneTimer('"+ divToHide +"')",timer);
		}
		else
		{
			trace('Errreur de id sur : ' + divToHide );	
		}

	}
	
	
	
	function onOffDiv(theDiv)
	{
		displayDiv = $(theDiv).style.display	
		if(displayDiv == 'none')
		{
			$(theDiv).style.display = 'block'
		}
		else
		{
			$(theDiv).style.display = 'none'			
		}
		
		
	}
	
	
	function priceFomat(num) 
	{
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		{
			num = "0";		
		}
	
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
	
		if(cents<10)
		{
			cents = "0" + cents;			
		}

		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		{
			num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));		
		}

		return (((sign)?'':'-') + '' + num + '.' + cents + ' $');
	}
	
	/* Transparency */
	function light_up()
	{	
		if(!document.getElementById(obj_id))
		{
			return false;
		}
		
		if ( navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5)
		{  
			document.getElementById(obj_id).style.MozOpacity=opacity/100
		}
		else if (navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4)
		{ 
			if(document.getElementById(obj_id).filters.alpha)
			{
				document.getElementById(obj_id).filters.alpha.opacity=opacity
			}
		}
	
	}

	
	function light_up_time()
	{		
			if(up_transition == true)
			{
				opacity += 7;
			}
			else
			{
				opacity -= 7;
			}
	
			light_up( opacity )
			max_timout ++;

			if(max_timout < 150)
			{
				setTimeout("light_up_time()",10);		
			}		
	
	}

	/* Global variables for the timer */
	opacity = 0;
	obj_id = '';
	max_timout = 0
	up_transition = true;

	function light(element_id,up)
	{
		obj_id = element_id
		up_transition = up
		
		if(up == true)
		{
			opacity = 0;
		}
		else
		{
			opacity = 100;	
		}
		
		max_timout = 0;		
		light_up_time(element_id,up);

	}



 
