	/**
	 * 
	 * Javascript functions for all the website.
	 * 
	 * @name module_movies
	 * @author Vincent Cantin Bellemare
	 * @since 2006-07-06
	 * @version 1.0.0
	 * @package reptileframework
	 * 
	 * 
	 */
	
	
	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 required(theField)
	{
		return is_empty(theField);		
	}
	
	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 generateValidator(string_validators , field , form  )
	{
		var function_generated = '';
		
		array_string_validators = string_validators.split(',')

		for( i in array_string_validators)
		{
			function_generated += array_string_validators[i] + '($("' + form + '").' + field + '.value ) '  
		}
		
		return function_generated;		
	}

	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 + ' $');
	}


	 function implode(symb,array)
	 {
		var len = array.length;
		var fin = '';
		
		for(i = 0; i < len;i++)
		{
			if(i)
			{
			fin += symb;
			}
		 fin +=array[i];
		}
		
		return fin;
	 }



	 function explode(symb,string,size)
	 {
		 if(symb == '')
		 {
			return false;
		 }
		 
		 var texte = string;
		 var tru = true; //Variable drapeau
		 var flag = false; //Variable drapeau
		 var plast = 0;
		 var num = 0;
		 var last;
		 var llast = texte.lastIndexOf(symb);// Dernière occurence de symb dans string
		 var ordr = new Array();
		 var len = texte.length;
	
		 while(tru == true)
		 {
			 last = texte.indexOf(":",plast);
	
			if(flag == true)
			 {
				 tru = false;
				 last = len;
			 }
			ordr[num] = texte.substring( plast , last );
		
			 if(size)
			 {
				 if(ordr.length == size)
				 {
					 ordr[num] += texte.substring( last , len );
					 tru = false;
				 }
			 }
	
			 num++;
			 plast = last+1;
			 
			 if(last == llast)
			 {
				flag = true
			 }
		 }
		 
		 return ordr;
	 } 

	function lostpassword(error_msg)
	{
		if ($('home_zone_password').style.display == "none" && $('home_zone_confirm').style.display == "none")
		{
			$('home_zone').style.display = "none";
			$('home_zone_password').style.display = "block";
		}
		else if ($('home_zone_password').style.display == "block")
		{
			
			var req = new AJAX.Request("members.php",
				{
					method: 'GET',
					parameters: ['action=lostpassword', 'email=' + $('username').value],
					onComplete : function(e) {eval(e.responseText)}
				}
			);
			
			$('home_zone_password').style.display = "none";
			$('home_zone_confirm').style.display = "block";
			
		}
		else if ($('home_zone_confirm').style.display == "block")
		{
			$('home_zone_password').style.display = "none";
			$('home_zone_confirm').style.display = "none";
			$('home_zone').style.display = "block";
		}
	}

	function newsdetails(news_id) {
		if ($('clearsite').style.display == "none")
		{
			$('clearsite').style.display = "block";
			$('order_by_form').style.display = "none";
			$('news_details_'+news_id).style.display = "block";
			$('clearsite').style.width = document.documentElement.scrollWidth + "px";
			$('clearsite').style.height = document.documentElement.scrollHeight + "px";
		}
		else
		{
			$('clearsite').style.display = "none";
			$('order_by_form').style.display = "block";
			$('news_details_'+news_id).style.display = "none";
			$('clearsite').style.width = "0px";
			$('clearsite').style.height = "0px";
		}
	}

