/*
 * Require jQuery JavaScript Library v1.3.2+
 * http://jquery.com/
 *
 * Copyright © 2010 MBA Multimédia (www.mba-multimedia.com)
 * 
 *
 */

$(document).ready( function(){
		//
		/*jQuery.each(jQuery.browser, function(i, val) {
			if(i=="mozilla" && jQuery.browser.version.substr(0,3)< 1.9) {
				$('head').append ('<link rel="stylesheet" type="text/css" href="/styles/ie7-fix.css"></link>');
			}
		});*/
		if ($('#recherche').length) { 
			$('#recherche input').focus (function() { $(this).addClass ("focus"); });
			$('#recherche input').blur (function() { $(this).removeClass ("focus"); });
		}
		
		if ($("#actualites").length) {
			$("#actualites .ctn .scroll").jHeadline ({intervalTime:4000});
		}
		
		if($("#tags").length){
			//tagCloud();
		}
		$("a[rel=tooltip]").tooltip({ 
			effect:'slide', 
			position:'bottom center',
			offset:[23, 47],
			onBeforeShow:function(event, position){
				console.log ("tooltip");
				this.getTip().appendTo(document.body);
				return true;
			}
		});
});

function tagCloud()
{
	var xhrTagCloud = getXMLHttpRequest();
 
	if(xhrTagCloud && xhrTagCloud.readyState != 0) {
			xhrTagCloud.abort(); 
	}

	xhrTagCloud.onreadystatechange = function() { 
		if(xhrTagCloud.readyState == 4 && (xhrTagCloud.status == 200 || xhrTagCloud.status == 0)) {
				document.getElementById("tags").innerHTML = xhrTagCloud.responseText;
		} else if(xhrTagCloud.readyState == 2 || xhrTagCloud.readyState == 3) {
				//document.getElementById("loading").innerHTML = "<p>Chargement en cours</p>";
		}
	}

	xhrTagCloud.open("GET", "/"+code_langue+"/rechercher/tag_cloud.php", true);
    xhrTagCloud.send(null);
}



