var xmlhttp=false; 
/*@cc_on @*/ 
/*@if (@_jscript_version >= 5) 
// JScript gives us Conditional compilation, we can cope with old IE versions. 
// and security blocked creation of the objects. 
  try { 
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
   try { 
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
   } catch (E) { 
    xmlhttp = false; 
   } 
  } 
@end @ 
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
  xmlhttp = new XMLHttpRequest(); 
} 

function loadFragmentInToElement(fragment_url, element_id) { 
    var element = document.getElementById(element_id); 
    element.innerHTML = '&nbsp;'; 
    xmlhttp.open("GET", fragment_url); 
    xmlhttp.onreadystatechange = function() { 
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 
      element.innerHTML = xmlhttp.responseText; 
      } 
    } 
    xmlhttp.send(null); 
} 
*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function boucle_temps(id_cadran,time,appel)
{
time = parseInt(time);
	appel = parseInt(appel);

	// on en fait une date
    	var d = new Date(time * 1000);

	// on récupère les différentes composantes
	var heure = d.getHours();
	var min = d.getMinutes();
	var sec = d.getSeconds();

	// gestion des 0 pour qu'il y ait toujours un chiffre de la forme xx
	if (heure < 10)
	{
		heure = "0" + heure;
	}
	if (min < 10)
	{
		min = "0" + min;
	}
	if (sec < 10)
	{
		sec="0"+sec;
	}
	
   document.getElementById(id_cadran).innerHTML=heure +':' + min + ':' + sec;

	// temps unix + 1
	time = time + 1;

	// incrémentation de appel
	appel = appel + 1;

	// on rappelle la fonction aprés une seconde
	setTimeout("boucle_temps('" + id_cadran + "','" + time + "','appel')",1000);
	
//loadFragmentInToElement('../server1.php', 'currentdate');
//setTimeout(boucle_temps,1000)
}

var errorimg1= 0;

function LoadImage1() {
 uniq1 = Math.random();
 document.images.webcam1.src ="http://217.128.212.121:8080/cam_1.jpg?uniq="+uniq1;
 window.status = "[powered by webcamXP]";
}


function ErrorImage1() {
 errorimg1++;
 if (errorimg1>0)
    {
     document.images.webcam1.onload = "";
     document.images.webcam1.src ="../images/webcam.jpg";
    }
	else
	{
     uniq1 = Math.random();
     document.images.webcam1.src ="http://217.128.212.121:8080/cam_1.jpg?uniq="+uniq1;
    }
}

function ErrorImage2() {
 errorimg1++;
 if (errorimg1>1)
    {
     document.images.webcam1.onload = "";
     document.images.webcam1.src ="../../images/webcam.jpg";
    }
	else
	{
     uniq1 = Math.random();
     document.images.webcam1.src ="http://217.128.212.121:8080/cam_1.jpg?uniq="+uniq1;
    }
}



function DoIt1() {
  errorimg1=0;
  window.setTimeout("LoadImage1();", 5);
}
