/**************************************************
 * $IdV. 2.0 | BS - using.js
 * Copyright (c) 2001-2008 Sbastien Brmond (Tocra Web Medias - www.tocra.org)
 * 31/12/2008 - Importateur de fragment web par Ajax.
 * Permet de loader une url via ajax en utilisant le systme TocraAjaxFragment.
 */
	
	
	// Ajax bridge - PrototypeJs - Tocra Web Medias
	//
	//forceAjaxBridge = (getCookie && getCookie('use_ajax_version')=='1')? true:false;
	forceAjaxBridge = true;
	var TAF_Configuration = {
		
		useAjaxBridge: forceAjaxBridge,
		hoster: 'www.poleentreprise.com',
		connector: '/inc/catch-content.php',
		doAjaxScriptEval: true,
		
		exeptedAjaxPages: ['', 'index.html', 'sitemap_fr.html', 'sitemap_en.html', 'sitemap.php', 'sitemap_fr.php', 'sitemap_en.php']
		
	};
	

	function getData(sUri,options){
		sUri = (!sUri)? '/blank.html':sUri;

		// Check if this page is not an Ajax process denied. (some pages must be loaded entierly with the HTTP protocol as is)
		isAjaxPage = true;
		pageName = sUri.substring(1+sUri.lastIndexOf("/"));
		source = window.location + '?';
		sourceName = source.substring(1+source.lastIndexOf("/"));
		sourceName = sourceName.substring(0, sourceName.lastIndexOf("?"));
		
		TAF_Configuration.exeptedAjaxPages.each(function(item) {
			if( item == pageName || item == sourceName){ isAjaxPage = false; }
		});
		
		
		// Site navigation handler (JS only)
		if( TAF_Configuration.useAjaxBridge && isAjaxPage )
		{
			new Ajax.Updater(options.container, TAF_Configuration.connector, {
				parameters: { DOCUMENT_URI: (sUri) , DOCUMENT_TAG:(options.tag || 'TocraAjaxFragment')/*$F('text')/**/ },
				evalScripts: true,
				method: 'get',
				onSuccess : (options.afterFinish || null),
				onFailure : (options.errorLoading || null)
			});
		}
		else{ window.location = sUri; }		

	}
	
	
