//--------------------Native Functions---------------------
function $d(id) {
	return document.getElementById(id);
}
//-------------------Browsers Functions--------------------
function Browser() {
	if (navigator.userAgent.indexOf("Opera") !=-1)
	this.opera = true;
	if (navigator.userAgent.indexOf("Konqueror") !=-1)
	this.konqueror = true;
	if (navigator.userAgent.indexOf("Safari") !=-1)
	this.safari = true;
	if (navigator.userAgent.indexOf("Firefox/1.0") !=-1)
	this.ff10 = true;
	if (navigator.userAgent.indexOf("Firefox/1.5") !=-1)
	this.ff15 = true;
	if (navigator.userAgent.indexOf("Netscape/7.0") !=-1)
	this.netscape = true;
	if (navigator.userAgent.indexOf("MSIE 7") !=-1)
	this.ie7 = true;
	if (navigator.userAgent.indexOf("MSIE 6") !=-1)
	this.ie6 = true;
	if (this.ie6 || this.ie7)
	ieBrowser.call(this);
		else
	ffBrowser.call(this);
}
function ieBrowser() {
	BrowserFamily = "IE";
	//AjaxRequest = function() { return new ActiveXObject("Microsoft.XMLHTTP"); }	
	this.setOpacity = function(el, value) {
	var oppc = parseInt(value*100);
	el.style.filter = "alpha(opacity="+oppc+")";
	}
}
function ffBrowser() {
	BrowserFamily = "NO-IE";
	//AjaxRequest = function() { return new XMLHttpRequest; }	
	this.setOpacity = function(el, value) {
	el.style.opacity = value;
	}
}
var browser = new Browser();
browser.getHttpObject = function() {
if(this.ie6 || this.ie7)
	return new ActiveXObject("Microsoft.XMLHTTP");
else
	return new XMLHttpRequest;
}
//-------------------Init Functions--------------------
$(function() {
    $('#toss1').cycle({
       fx:     'toss',
       easing: 'easeOutExpo',
       speed:    2400,
       timeout:	 4500,
       animOut: { top: -240, left: 0 }
    });
});
//-------------------App&Nav Functions--------------------
function doRating(SelCit,SelRating,OldStars)	{
Citation = SelCit;
Stars = OldStars;
document.getElementById("stars-box-"+SelCit).innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src=images/loading2.gif border=0>";
http = browser.getHttpObject();
http.open('GET', 'rating.php?mode=ajax&citation='+SelCit+'&rate='+SelRating, true);
http.onreadystatechange = handleRating;
http.send(null);
}
function handleRating()
{
    if(http.readyState == 4)
    {
        if(http.status == 200)
        {
            if(http.responseText == "RATING-APPROVED")
            	{
            	$("#stars-cmt-"+Citation).hide("slow");
            	setTimeout('$d("stars-box-'+Citation+'").innerHTML = "<div class=\'rating "+Stars+"\'></div>";$d("stars-cmt-'+Citation+'").innerHTML = "<img src=images/success2.gif border=0> Merci pour votre contribution !";$("#stars-cmt-'+Citation+'").animate({height:200}, {queue:false, duration: 1000, easing: "swing"});', 1000);             	
            	}
            	else
            	{ alert(http.responseText); }
        }
        else
        {
            alert("Service unavailable.\n------------------------------------------\nYour system administrator was alerted about the problem.\n\nWe're sorry for the inconvenience. Feel free to contact us for more information.");
        }
    }
}



