	/**
	 * 
	 * Javascript CommonSite
	 * 
	 * @name CommonSite
	 * @author cjoudrey
	 * @since 2008-01-11
	 * @version 1.0.0
	 * @package reptileframework
	 * 
	 */
	
	var CommonSite = Class.create
	({
		alertPage : null,
		
		log : function (content)
		{
			if (window.console) 
			{
				console.log(content);					
			}
		},
		sendError : function (error)
		{
			this.log('error :' + error);
		},
		
		closeAlert : function ()
		{
			$j('#div_dialog').fadeOut(10);
		},
		
		popAlert : function (message, hash)
		{					
			$j('#div_dialog')
				.html(message)
				.center()
				.draggable()
				.fadeIn(10);					
		},

		alertFlashNotActivated : function(maxFlashAlert)
		{
			var linkFlash				= '<a href=http://www.adobe.com/go/getflash/>Adobe Flash</a>';
			var newContainer 			= new Element('div').setStyle('width:700px,height:400px');
			var newContainerTitle 		= new Element('div').update(PHPVars.get('common.download_flash_title')).setStyle('font-size:14px;');
			var newContainerDescription = new Element('div').update(PHPVars.get('common.download_flash_description') + linkFlash).setStyle('font-size:11px;margin-top:10px;');
				
			newContainer.insert(newContainerTitle);
			newContainer.insert(newContainerDescription);
			
			var nbFlashAlert 	= parseInt(Cookie.get('nb_flash_alert'));
			nbFlashAlert		= (nbFlashAlert > 0) ? nbFlashAlert : 0;				
			maxFlashAlert 		= (maxFlashAlert === null) ? 3 : maxFlashAlert;
			
			if(true || nbFlashAlert < maxFlashAlert)
			{
				Site.popAlert(newContainer);
				Cookie.set('nb_flash_alert', ++nbFlashAlert);
			}	
		},

		isFlashActivated : function(requiredMajorVersion)
		{
			var requiredMinorVersion 	= 0;
			var requiredRevision 		= 0;
			
			return DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);										
		},

		popRefresh : function ()
		{
			this.alertPage.center().adapt();		
		},

		popShippingMessage : function()
		{
			this.popAlert(PHPVars.get('common.pop_shipping_message'));
		},
		
		handleErr : function(msg,url,l)
	    {
			var txt	="";
			txt	="	There was an error on this page.\n\n";
			txt	+=	"Error: " + msg + "\n";
			txt	+=	"URL: " + url + "\n";
			txt	+=	"Line: " + l + "\n\n";
			txt	+=	"Click OK to continue.\n\n";
				
			new Ajax.Request
			(
				JS_ERROR_URL, 
				{   
					parameters:{'message': msg,'url' : url,'l' : l},
					onSuccess: 
					function(transport) 
					{     
						transport.headerJSON   
					} 
				}
			); 
			
			return true;
	    }							
	});
	
	CommonSite 	= new CommonSite();	

	//onerror		= CommonSite.handleErr;	

