var gobackurl = '';
function getHTTPObject()
{
  var xmlhttp = false;

  /* Compilation conditionnelle d'IE */
  /*@cc_on
  @if (@_jscript_version >= 5)
     try
     {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch (e)
     {
        try
        {
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
           xmlhttp = false;
        }
     }
  @else
     xmlhttp = false;
  @end @*/

  /* on essaie de créer l'objet si ce n'est pas déjà fait */
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
  {
     try
     {
        xmlhttp = new XMLHttpRequest();
     }
     catch (e)
     {
        xmlhttp = false;
     }
  }

  if (xmlhttp)
  {
     /* on définit ce qui doit se passer quand la page répondra */
     xmlhttp.onreadystatechange=function()
     {
        if (xmlhttp.readyState == 4) /* 4 : état "complete" */
        {
           if (xmlhttp.status == 200) /* 200 : code HTTP pour OK */
           {
              /*
              Traitement de la réponse.
              Ici on affiche la réponse dans une boîte de dialogue.
              */
              //alert(xmlhttp.responseText);
			  /*if(gobackurl=='noaction')
			  {
			  }
			  else
			  {
  			 window.location.href = gobackurl;
			  }*/
           }
        }
     }
  }
  return xmlhttp;
}

function geturl(myurl)
{
	var xmlhttp = getHTTPObject(); 
	xmlhttp.open("GET", ""+myurl+"",true); 
	xmlhttp.send(null); 
}

function vote(myvote,myid,myredirect)
{
	var curr_nb = 0;
	geturl('ajax.asp?a=vote&v='+myvote+'&i='+myid);
	if(myvote==0)
	{
		document.getElementById('vote_0_'+myid+'').style.color = '#666666';
		document.getElementById('vote_0_'+myid+'').href = 'javascript:';
		curr_nb = document.getElementById('votecnt_0_'+myid+'').innerHTML;
		document.getElementById('votecnt_0_'+myid+'').innerHTML = curr_nb*1+1;
	}
	else
	{
		document.getElementById('vote_1_'+myid+'').style.color = '#666666';
		document.getElementById('vote_1_'+myid+'').href = 'javascript:';
		curr_nb = document.getElementById('votecnt_1_'+myid+'').innerHTML;
		document.getElementById('votecnt_1_'+myid+'').innerHTML = curr_nb*1+1;
	}
	if(myredirect!='')
	{
	window.location.href = myredirect;
	}
}

function dispdiv(mydiv)
{
	// afficher
	if(document.getElementById(mydiv).style.display=='none')
	{
		document.getElementById(mydiv).style.display = '';
	}
	// cacher
	else
	{
		document.getElementById(mydiv).style.display = 'none';
	}
}

function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}

function popup(myurl,myname,mywidth,myheight,myoptions) {
    var window_top = (screen.height-myheight)/2;
    var window_left = (screen.width-mywidth)/2;
   	var mywindow = window.open(''+ myurl + '',''+ myname + '','width=' + mywidth + ',height=' + myheight + ',top=' + window_top + ',left=' + window_left + ',' + myoptions + '');
    mywindow.focus();
}

function exit()
{
document.location.href = '/?exit=1';
}