var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

$(document).ready
(		
	function()
	{
		// Chargement des polices lissées (avec Cufon)
		initCufon();
		
		// SuperSleight (PNG FIX pour IE6)
		$('body').supersleight();
		
		// Chargement des images avec fondu
		initImageCasaques();
		
		// Init. des champs date avec le calendrier
		initDateInputs();
		
		// Init. la recherche d'hippodrome dans la barre de chemin
		initCheminHippodrome();
		
		// Init. le champ adresse de départ de la fiche hippodrome
		initAdresseDepart();
		
		// Init. la recherche d'hippodrome sur la gauche
		initRechercheHippodrome();

		// Init. la recherche de cheval sur la gauche
		initRechercheCheval();
		
		// Init. le popup des participation (fiche du cheval / performances)
		initPopupParticipation();
		
		// TODO : Init. du menu / sous menus
		initMenu();
		
		// Init. du défilements des arrivées en pied de page
		initFooter();
		
		// Chargement en Ajax de la Phototèque
		loadPhototeque();
		
		// Chargement en Ajax de la Vidéothèque
		loadVideotheque();
		
		// Chargement des Acutalités
		loadFlashInfos();
		
		// Relations entre les liens de courses
		initLiensCourses();
		
		// Fonction extra. au chargement de la page
		if (typeof initEvents == "function")
			initEvents();
	}
);


/**
 * Initialisation du menu / sous-menus
 */
var aMenus = new Array();

function initMenu()
{
	$(".menu_element").hover(
		function () {
			aMenus[this.id] = true;
			aMenus[this.id + "_sub"] = false;
			
			$(this).addClass("menu_element_hover");
			
			id = this.id + "_sub";
			aOffset = $("#" + this.id).offset();
			$("#" + id).css("left", aOffset.left + "px");
			$("#" + id).css("top", aOffset.top + $("#" + this.id).height() + "px");
			if ($("#" + id).width() < $("#" + this.id).width())
				$("#" + id).css("width", $("#" + this.id).width());
			hideAllMenuExcept(this.id);
			$("#" + id).css({opacity: 0.9});
			$("#" + id).show();
			
		},
		function () {		
			
			if ($(this).hasClass("menu_element_hover"))
				$(this).removeClass("menu_element_hover");
			
			aMenus[this.id] = false;
			aMenus[this.id + "_sub"] = false;
			if ($("#" + this.id).attr('class').indexOf('sel') == (-1))
				$("#" + this.id).css("background-color", "#5d5d5d");
			else
				$("#" + this.id).css("background-color", "#888888");
			setTimeout("hideMenu('" + this.id + "');", 500);
		}		
	);
	
	$(".menu_sub").hover(
		function () {
			aMenus[this.id] = true;
			parent_id = this.id.replace("_sub", "");				
			$("#" + parent_id).addClass("menu_element_hover");
		},
		function (eventObject) {
			aMenus[this.id] = false;
			parent_id = this.id.replace("_sub", "");
			if ($("#" + parent_id).attr('class').indexOf('sel') == (-1))
				$("#" + parent_id).css("background-color", "#5d5d5d");
			else
				$("#" + parent_id).css("background-color", "#888888");
			
			$("#" + parent_id).removeClass("menu_element_hover");
			
			setTimeout("hideMenu('" + parent_id + "');", 500);			
		}
	);
}

function hideAllMenuExcept(id)
{
	$(".menu_sub:not(#" + id + "_sub)").fadeOut("fast");
}

function hideMenu(id)
{
	if (!aMenus[id] && !aMenus[id + "_sub"])
		$("#" + id + "_sub").fadeOut("normal");
}

/**
 * Lissage  des polices avec Cufon
 */
function initCufon()
{
	//$(".cufon").load('/feed', Cufon.refresh);
	Cufon.replace("h1");
	Cufon.replace(".cufon");
}

/**
 * Chargement des images des casaques avec fondu
 */
function initImageCasaques()
{
	$('.image_casaque').load( function (e) {		
		$(e.target).fadeIn();
	});
	
	$('.image_casaque').each( function () {	
		if ($(this).attr('complete') == true)
			$(this).fadeIn();
	});	
}

/**
 * Tableau des arrivées en cours d'affichage (Ajax)
 */
var aArrivees = new Array();

/**
 * IPhone ?
 */
var isIPhone = (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i));

/**
 * IPad ?
 */
var isIPad = navigator.userAgent.match(/iPad/i)  != null;


function initFooter()
{
	if (isIPhone || isIPad)
	{
		$("#ffooter").hide();	
	}
	else
	{
		// Chargement des arrivées (màj. tout les 2 minutes (120 secondes))
		loadFooterArrivees();
		setInterval(loadFooterArrivees, 2 * 60 * 1000);
	}
}

/**
 * Chargement des arrivées à afficher en pied de page (Ajax)
 */
function loadFooterArrivees()
{
	// Requête AJAX
    $.ajax({
    	// Fichier cible php :
    	url : "ajax/ajax.footer_arrivees.php",
    	// Type de requête
    	type : "GET",
    	// Type de données renvoyées : JSON
    	dataType : "json",
    	// Callback :    	
    	success : load_footer_arrivees_callback
    });
}

/**
 * Retour du chargement des arrivées à afficher en pied de page (Ajax)
 * @param oJson
 */
function load_footer_arrivees_callback(oJson)
{			
	// Ventilation des données dans le tableau des arrivées
	aArrivees = new Array();
	
	for (i in oJson)
		aArrivees.push(oJson[i]);
	
	var html = "";
	
	// Création des paragraphes defilants via innerfade en jQuery
	for (arrivees_cursor in aArrivees)
	{
		html += "<p>";
		html += aArrivees[arrivees_cursor].course_date_evenement + " - " + aArrivees[arrivees_cursor].course_heure_depart + " : " + aArrivees[arrivees_cursor].hippodrome_nom;
		html += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;";
		html += aArrivees[arrivees_cursor].prix_nom;
		html += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;";
		html += aArrivees[arrivees_cursor].arrivees;
		html += "</p>\n";		
	}
	
	$("#footer_arrivees").html(html);
	
	// Fondu entre les paragraphes des arrivées
	$('#footer_arrivees').innerfade({
		animationtype: 'fade',
		speed: 1000,
		timeout: 5000,
		containerheight: '20px',
		type: 'random'
	}); 
}

/**
 * Evènement appelé lors de la mise à jour du calendrier en popup
 */
function updateCalendarEvent()
{
	var date = $('#chemin_date').val();
	date = date.replace('/', '-');
	date = date.replace('/', '-');
	location.href = date + '.html';
}

/**
 * Initialisation des champs de type date
 */
function initDateInputs()
{
	$(".date_input").focus(function () {
		if (this.value == this.defaultValue)
			this.value = "";
	});

	$(".date_input").blur(function () {
		if (this.value == "")
			this.value = this.defaultValue;
	});
	
	$(".date_input").each(function (i) {
		
	});
}

/**
 * Initialisation de la recherche d'hippodrome dans le chemin
 */
function initCheminHippodrome()
{
	if ($("#form_chemin") && $("#chemin_hippodrome") && $("#chemin_ok"))
	{
		$("#chemin_hippodrome").focus(function () {
			if (this.value == this.defaultValue)
				this.value = "";
		});

		$("#chemin_hippodrome").blur(function () {
			if (this.value == "")
				this.value = this.defaultValue;
		});

		$("#chemin_hippodrome").autocomplete('ajax/ajax.recherche_hippodromes.php', {
			minChars: 1,
			max: 50,
			width: 190,
			dataType: "json",
			parse: function(data) {
		        var parsed = [];

		        for (var i = 0; i < data.length; i++) {
		            parsed[parsed.length] = {
		                data: data[i],
		                value: data[i].hippodrome_nom2,
		                result: data[i].hippodrome_nom2
		            };
		        }
		 
		        return parsed;
			},
			formatItem: function(item) {
				if (item.hippodrome_nom != '' && item.hippodrome_nom != item.hippodrome_nom2)
					return item.hippodrome_nom2 + ' (' + item.hippodrome_nom + ')';
				else
					return item.hippodrome_nom2;
			}
		});
		
		$("#chemin_ok").click(function () {
			$("#form_chemin").submit();
		});
		
		$("#chemin_hippodrome").keyup(function (e) {
			// Touche 'Entrer'
			if(e.keyCode == 13)
				$("#form_chemin").submit();
		});
	}
}

/**
 * Init. le champ adresse de départ de la fiche hippodrome
 */
function initAdresseDepart()
{
	if ($(".adresse_depart"))
	{
		$(".adresse_depart").focus(function () {
			if (this.value == this.defaultValue)
				this.value = "";
		});

		$(".adresse_depart").blur(function () {
			if (this.value == "")
				this.value = this.defaultValue;
		});
	}
}

/**
 * Initialisation de la recherche d'hippodrome sur la gauche
 */
function initRechercheHippodrome()
{
	if ($("#form_recherche_hippodrome") && $("#recherche_hippodrome_nom") && $("#recherche_hippodrome_ok"))
	{
		$("#recherche_hippodrome_nom").focus(function () {
			if (this.value == this.defaultValue)
				this.value = "";
		});

		$("#recherche_hippodrome_nom").blur(function () {
			if (this.value == "")
				this.value = this.defaultValue;
		});
	
		$("#recherche_hippodrome_nom").autocomplete('ajax/ajax.recherche_hippodromes.php', {
			minChars: 1,
			max: 50,
			width: 162,
			dataType: "json",
			parse: function(data) {
		        var parsed = [];

		        for (var i = 0; i < data.length; i++) {
		            parsed[parsed.length] = {
		                data: data[i],
		                value: data[i].hippodrome_nom2,
		                result: data[i].hippodrome_nom2
		            };
		        }
		 
		        return parsed;
			},
			formatItem: function(item) {
				if (item.hippodrome_nom != '' && item.hippodrome_nom != item.hippodrome_nom2)
					return item.hippodrome_nom2 + ' (' + item.hippodrome_nom + ')';
				else
					return item.hippodrome_nom2;
			}
		});
		
		$("#recherche_hippodrome_ok").click(function () {
			$("#form_recherche_hippodrome").submit();
		});
		
		$("#recherche_hippodrome_ok").keyup(function (e) {
			// Touche 'Entrer'
			if(e.keyCode == 13)
				$("#form_recherche_hippodrome").submit();
		});
	}
}

/** 
 * Initialisation de la recherche de chevaux sur la gauche
 */
function initRechercheCheval()
{
	if ($("#form_recherche_cheval") && $("#recherche_cheval_nom") && $("#recherche_cheval_ok"))
	{
		$("#recherche_cheval_nom").focus(function () {
			if (this.value == this.defaultValue)
				this.value = "";
		});

		$("#recherche_cheval_nom").blur(function () {
			if (this.value == "")
				this.value = this.defaultValue;
		});
		
		$("#recherche_cheval_nom").autocomplete('ajax/ajax.recherche_chevals.php', {
			minChars: 1,
			max: 50,
			width: 162,
			dataType: "json",
			parse: function(data) {
		        var parsed = [];

		        for (var i = 0; i < data.length; i++) {
		            parsed[parsed.length] = {
		                data: data[i],
		                value: data[i].cheval_nom,
		                result: data[i].cheval_nom
		            };
		        }
		 
		        return parsed;
			},
			formatItem: function(item) {
				if (item.cheval_suffixe != '' && item.cheval_suffixe != item.cheval_nom)
					return item.cheval_nom + ' (' + item.cheval_suffixe + ')';
				else
					return item.cheval_nom;
			}
		});
		
		$("#recherche_cheval_ok").click(function () {
			$("#form_recherche_cheval").submit();
		});
		
		$("#recherche_cheval_ok").keyup(function (e) {
			// Touche 'Entrer'
			if(e.keyCode == 13)
				$("#form_recherche_cheval").submit();
		});
	}
}

/**
 * Initialisation le popup des participation (fiche du cheval / performances)
 */
function initPopupParticipation()
{
	// Roll-over des puces
	$(".popup_participation_link").hover(
		function ()
		{
			// over
			this.src = "images/common/puce_participation_on.png";
		},
		function ()
		{
			// out
			this.src = "images/common/puce_participation.png";
		}
	);		
	
	$(".popup_participation_link").click(function () {
		oRegExp = new RegExp("[0-9]+","g");
		var participation_id = oRegExp.exec($(this).attr("id"));
		
		loadPopupParticipationFicheCheval(participation_id);
	});
	
	$(".popup_participation_link2").click(function () {
		oRegExp = new RegExp("[0-9]+","g");
		var participation_id = oRegExp.exec($(this).attr("id"));
		
		loadPopupParticipationFicheCheval(participation_id);
	});
	
	$("#participation_popup_close").click(function () {
		// Cache le popup pendant le chargement
		
		// Hack Internet Explorer (PNG)
		if ($.browser.msie)
		{
			$("#participation_popup").hide();
			$("#participation_popup_close").hide();
		}
		else
		{
			$("#participation_popup").fadeOut("def");
			$("#participation_popup_close").fadeOut("def");
		}
	});
}

/**
 * Chargement Ajax de la fiche du cheval
 */
function loadPopupParticipationFicheCheval(participation_id)
{
	// Requête AJAX
    $.ajax({
    	// Fichier cible php :
    	url : "ajax/ajax.participation_popup.php",
    	// Type de requête
    	type : "GET",
    	// Type de données renvoyées : JSON
    	dataType : "json",
    	// Paramètres :
    	data : {participation_id: participation_id, type: 'fiche-cheval'},
    	// Callback :    	
    	success : popup_participation_callback
    });
}

/**
 * Chargement Ajax des performances
 */
function loadPopupParticipationPerformances(participation_id)
{
	// Requête AJAX
    $.ajax({
    	// Fichier cible php :
    	url : "ajax/ajax.participation_popup.php",
    	// Type de requête
    	type : "GET",
    	// Type de données renvoyées : JSON
    	dataType : "json",
    	// Paramètres :
    	data : {participation_id: participation_id, type: 'performances'},
    	// Callback :    	
    	success : popup_participation_callback
    });
}

/**
 * Retour Ajax du popup de la fiche du cheval / des performances
 */
function popup_participation_callback(oJson)
{			
	// Cache le popup pendant le chargement
	$("#participation_popup").css('display', 'none');
	$("#participation_popup_close").css('display', 'none');
	
	if (oJson.type == "fiche-cheval")
	{
		buildPopupParticipationFicheCheval();
		populatePopupParticipationFicheCheval(oJson);
	}

	if (oJson.type == "performances")
	{
		buildAndPopulatePopupParticipationPerformances(oJson);
	}
	
	// Position et dimension du lien appelant
	var oLink = $("#participation_" + oJson.participation_id);
	var aLinkPosition = oLink.offset();

	// Positionement du popup
	$("#participation_popup").css('left', (aLinkPosition.left - 5) + 'px');
	$("#participation_popup").css('top', (aLinkPosition.top - 46) + 'px');
	
	// Positionement du bouton de fermeture du popup
	$("#participation_popup_close").css('left', (aLinkPosition.left - 5 + $("#participation_popup").width() - 42) + 'px');
	$("#participation_popup_close").css('top', (aLinkPosition.top - 46 + 21) + 'px');
	
	// Affichage du popup
	//$("#participation_popup").css('display', 'table');
	//$("#participation_popup_close").css('display', 'block');
	
	
	// Hack Internet Explorer (PNG)
	if ($.browser.msie)
	{
		$("#participation_popup").show();
		$("#participation_popup_close").show();
	}
	else
	{
		$("#participation_popup").fadeIn("def");
		$("#participation_popup_close").fadeIn("def");
	}
}

/**
 * Construction du HTML du popup avant affichage (Fiche du cheval)
 */
function buildPopupParticipationFicheCheval()
{
	// Vide le contenu du popup
	$("#participation_popup_content").empty();
	
	// Strucutre HTML
	var inner_html = "";
	inner_html += "<strong id=\"participation_popup_cheval_nom\">-</strong>";
	inner_html += "<table>";
	inner_html += "	<tr valign=\"top\">";
	inner_html += "		<td align=\"left\" id=\"participation_popup_p\">-</td>";
	inner_html += "		<td align=\"right\"><img id=\"participation_popup_casaque_img\" src=\"#\" alt=\"\"></img></td>";
	inner_html += "	</tr>";
	inner_html += "</table>";
	inner_html += "<table>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Sexe</td>";
	inner_html += "		<td id=\"participation_popup_cheval_sexe\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Robe</td>";
	inner_html += "		<td id=\"participation_popup_cheval_robe\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">P&egrave;re</td>";
	inner_html += "		<td id=\"participation_popup_cheval_pere\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">M&egrave;re</td>";
	inner_html += "		<td id=\"participation_popup_cheval_mere\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Propri&eacute;taire</td>";
	inner_html += "		<td id=\"participation_popup_proprietaire_nom\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Eleveur</td>";
	inner_html += "		<td id=\"participation_popup_eleveur_nom\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Entraineur</td>";
	inner_html += "		<td id=\"participation_popup_entraineur_nom\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	inner_html += "	<tr valign=\"middle\">";
	inner_html += "		<td class=\"titres\" align=\"right\">Performances</td>";
	inner_html += "		<td id=\"participation_popup_performances\" align=\"left\">-</td>";
	inner_html += "	</tr>";
	
	/*
	inner_html += "	<tr class=\"perfs\" valign=\"top\">";
	inner_html += "		<td class=\"titres\" align=\"right\"><img src=\"images/participation_popup/performances.png\" alt=\"\" /></td>";
	inner_html += "		<td align=\"left\"><a id=\"participation_popup_performances_a\" href=\"\">Les performances</a></td>";
	inner_html += "	</tr>";
	*/
	
	inner_html += "</table>";
	
	$("#participation_popup_content").append(inner_html);
}

/**
 * Ventilation des données dans le HTML du popup
 * @param oJson
 */
function populatePopupParticipationFicheCheval(oJson)
{
	// Ventilation des informations
	$("#participation_popup_cheval_nom").html("<img src=\"images/participation_popup/performances.png\" alt=\"\" />FICHE DU CHEVAL <span>" + oJson.cheval_nom + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span><img src=\"images/participation_popup/performances.png\" alt=\"\" /><a id=\"participation_popup_performances_a\" href=\"\">Les performances</a></span>&nbsp;&nbsp;<img src=\"images/common/print.gif\" onclick=\"javascript:window.print();\"/>");
	$("#participation_popup_p").html(oJson.cheval_age);
	$("#participation_popup_cheval_sexe").html(oJson.cheval_sexe);
	$("#participation_popup_cheval_robe").html(oJson.cheval_robe);
	$("#participation_popup_cheval_pere").html(oJson.cheval_pere);
	$("#participation_popup_cheval_mere").html(oJson.cheval_mere);
	$("#participation_popup_proprietaire_nom").html(oJson.proprietaire_nom);
	$("#participation_popup_eleveur_nom").html(oJson.eleveur_nom);
	$("#participation_popup_entraineur_nom").html(oJson.entraineur_nom);
	$("#participation_popup_performances").html(oJson.performances);	
		
	$("#participation_popup_casaque_img").attr("src", oJson.url_image);
		
	$("#participation_popup_performances_a").attr("href", "javascript: loadPopupParticipationPerformances(" + oJson.participation_id + ")");
}

/**
 * Construction et ventilation des données dans le HTML du popup (Performances)
 * @param oJson
 */
function buildAndPopulatePopupParticipationPerformances(oJson)
{
	// Vide le contenu du popup
	$("#participation_popup_content").empty();
	
	// Strucutre HTML
	var inner_html = "";
	inner_html += "<strong><img src=\"images/participation_popup/performances.png\" alt=\"\" />PERFORMANCES <span>" + oJson.cheval_nom + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span><img src=\"images/participation_popup/performances.png\" alt=\"\" /><a id=\"participation_popup_performances_a\" href=\"javascript: loadPopupParticipationFicheCheval(" + oJson.participation_id + ")\">Fiche du cheval</a></span>&nbsp;&nbsp;<img src=\"images/common/print.gif\" onclick=\"javascript:window.print();\"/></strong>";
	inner_html += "<table class=\"performances\">";
	
	for (i in oJson.performancecourses)
	{	
		inner_html += "	<tr class=\"th\" valign=\"top\">";
		inner_html += "		<td align=\"left\" colspan=\"5\">";
		inner_html += oJson.performancecourses[i].hippodrome_nom + " | ";
		//inner_html += oJson.performancecourses[i].prix_nom + " | ";
		inner_html += oJson.performancecourses[i].date_evenement + " | ";
		inner_html += oJson.performancecourses[i].nominal + " | ";
		inner_html += oJson.performancecourses[i].distance + " | ";
		inner_html += oJson.performancecourses[i].evenement + " | ";
		inner_html += oJson.performancecourses[i].nombre_partants + " | ";
		inner_html += oJson.performancecourses[i].piste_sable;		
		inner_html += "		</td>";
		inner_html += "	</tr>";
		
		// Couleur de fond
		var grey = true;
		
		for (j in oJson.performancecourses[i].performancecourseparticipations)
		{	
			var css_class = (grey ? "grey " : "");
			if (oJson.performancecourses[i].performancecourseparticipations[j].concerne == 1)
				css_class = "sel";
				
			inner_html += "	<tr class=\"" + css_class + "\" valign=\"top\">";
			inner_html += "		<td align=\"left\">" + oJson.performancecourses[i].performancecourseparticipations[j].place + "</td>";
			inner_html += "		<td align=\"left\">" + oJson.performancecourses[i].performancecourseparticipations[j].cheval_nom + "</td>";
			inner_html += "		<td align=\"left\">" + oJson.performancecourses[i].performancecourseparticipations[j].distance + "</td>";
			inner_html += "		<td align=\"left\">" + oJson.performancecourses[i].performancecourseparticipations[j].reduction + "</td>";
			inner_html += "		<td align=\"left\">" + oJson.performancecourses[i].performancecourseparticipations[j].jockey_nom + "</td>";
			inner_html += "	</tr>";	
			
			grey = !grey;
		}		
	}
		
	inner_html += "</table>";
	
	/*
	inner_html += "<table style=\"width: 100%\">";
	inner_html += "	<tr valign=\"top\">";
	inner_html += "		<td class=\"titres\" align=\"right\"><img src=\"images/participation_popup/performances.png\" alt=\"\" /></td>";
	inner_html += "		<td align=\"left\"><a id=\"participation_popup_performances_a\" href=\"\">Les performances</a></td>";
	inner_html += "	</tr>";
	inner_html += "</table>";
	*/
	
	$("#participation_popup_content").append(inner_html);
}

/**
 * Relations entre les liens de courses
 */
function initLiensCourses()
{
	$("a.course").hover(
		function (eventObject) {
			course_numero = $(this).html();
			$("a.course").each( function () {
				if ($(this).html() == course_numero)
				{
					if (!$(this).hasClass('hover'))
						$(this).addClass('hover');
				}
			});
		},
		function (eventObject) {
			course_numero = $(this).html();
			$("a.course").each( function () {
				if ($(this).html() == course_numero)
				{
					if ($(this).hasClass('hover'))
						$(this).removeClass('hover');
				}
			});
		}
	);
}