function getXMLHTTP()
{
    var xhr = null;
    if(window.XMLHttpRequest)
    { // Firefox et autres
        xhr = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    { // Internet Explorer
        try
        {
            xhr = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e1)
            {
                xhr = null;
            }
        }
    }
    else
    { // XMLHttpRequest non support par le navigateur
        alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
    }

    return xhr;
}


var XHR=null;
function envoieRequete(url,id)
{
	XHR = getXMLHTTP();
	var position = id;
	//POUR VIDER LE CACHE DE IE
XHR.open("GET", url+"&nocache=" + Math.random(), true); 
	XHR.onreadystatechange = function(){
	if ( XHR.readyState == 4 )
	{		
	// j'affiche dans la DIV spcifies le contenu retourn par le fichier
	document.getElementById(position).innerHTML = XHR.responseText;
	//MM_showHideLayers('chargement','','hide');
	}
	}
	// dans le cas du get
	XHR.send(null);

}
function ajoutquestion(){
	var question=document.getElementById('question').value;
	var pseudo=document.getElementById('pseudo').value;
	type = document.getElementsByName("type");
	var notFound = true;
	var typequestion = false;
	var i=0;
	while(i<2 && notFound){
		if(type[i].checked){
			notFound = false;
		typequestion=type[i].value;
		}
		i++;
	}
	
		pseudo= encodeURI(pseudo);
	question=encodeURI(question);
		envoieRequete('affiche.php?pseudo='+pseudo+'&typequestion='+typequestion+'&question='+question+'&ajout=ok','questionreponse');
document.getElementById('question').value="";
}

function actualiser(){
  envoieRequete('affiche.php?actualiser=ok','questionreponse');
}
function newwindow(ville){
     
       switch(ville){
     
     case 'pekin' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0008/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
      case 'shanghai' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0116/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'canton' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0037/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'shenzhen' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0120/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'wuhan' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0138/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'nanjing' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0099/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'xian' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0141/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'hangzhou' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0044/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'chengdu' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0016/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'lhassa' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0080/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'dalian' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0019/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'xiamen' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0140/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
      case 'huangshan' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0453/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'guilin' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0434/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'dali' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0371/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'hongkong' : window.open("http://fr.weather.yahoo.com/CHXX/CHXX0049/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'taipei' : window.open("http://fr.weather.yahoo.com/TWXX/TWXX0021/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;       
       case 'paris' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0076/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
       case 'lyon' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0055/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
       case 'marseille' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0059/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'nantes' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0072/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
       case 'strasbourg' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0095/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
       case 'montpellier' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0068/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'clermont' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0120/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'grenoble' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0153/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'lille' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0052/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'bordeaux' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0016/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'toulouse' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0099/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'aix' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0001/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break; 
       case 'avignon' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0270/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'dijon' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0036/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'nice' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0073/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'cannes' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0023/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
       case 'angers' : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0137/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
  
  
      case 'londres' : window.open("http://fr.weather.yahoo.com/UKXX/UKXX0085/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'washington' : window.open("http://fr.weather.yahoo.com/USDC/USDC0001/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'berlin' : window.open("http://fr.weather.yahoo.com/GMXX/GMXX0007/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'amsterdam' : window.open("http://fr.weather.yahoo.com/NLXX/NLXX0002/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'berne' : window.open("http://fr.weather.yahoo.com/SZXX/SZXX0006/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'dublin' : window.open("http://fr.weather.yahoo.com/EIXX/EIXX0014/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'rome' : window.open("http://fr.weather.yahoo.com/ITXX/ITXX0067/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'madrid' : window.open("http://fr.weather.yahoo.com/SPXX/SPXX0050/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'tokyo' : window.open("http://fr.weather.yahoo.com/JAXX/JAXX0085/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'athenes' : window.open("http://fr.weather.yahoo.com/GRXX/GRXX0004/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'moscou' : window.open("http://fr.weather.yahoo.com/RSXX/RSXX0063/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'bruxelles' : window.open("http://fr.weather.yahoo.com/BEXX/BEXX0005/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'budapest' : window.open("http://fr.weather.yahoo.com/HUXX/HUXX0002/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'prague' : window.open("http://fr.weather.yahoo.com/EZXX/EZXX0012/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'oslo' : window.open("http://fr.weather.yahoo.com/NOXX/NOXX0029/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'helsinki' : window.open("http://fr.weather.yahoo.com/FIXX/FIXX0002/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;  
      case 'copenhague' : window.open("http://fr.weather.yahoo.com/DAXX/DAXX0009/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'brasilia' : window.open("http://fr.weather.yahoo.com/BRXX/BRXX0696/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
        case 'luxembourg' : window.open("http://fr.weather.yahoo.com/LUXX/LUXX0003/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
        case 'buenosaires' : window.open("http://fr.weather.yahoo.com/ARBA/ARBA0009/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
      case 'canberra' : window.open("http://fr.weather.yahoo.com/ASXX/ASXX0023/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
        case 'mexico' : window.open("http://fr.weather.yahoo.com/MXDF/MXDF0132/index_c.html","","status=no, menubar=no, width=800, height=600" );
       break;
   default : window.open("http://fr.weather.yahoo.com/FRXX/FRXX0076/index_c.html","","status=no, menubar=no, width=800, height=600" );
  }
      
}
