var qwcurrentPhoto = 0;
var qwsecondPhoto = 1;
var qwtempPhoto = 1;
var qwebcamimg = "http://prowl.org/images/workcam.jpg?";
var qwcurrentOpacity = new Array();
var qpausew = false;
var qloadCount = 1;
var qwebInterval;
var qwcit = 100;
var qmwInterval;
var qi = 0;
var qwebcInterval;

function qinit_webcamThumb() {
      qwebcInterval = setInterval("qinit_webcamThumbDelayed()",9000);
}

function qinit_webcamThumbDelayed() {
   if (qwebcInterval) { clearInterval(qwebcInterval); }
   qwcurrentOpacity[0]=100;
	for(qi=1;qi<2;qi++)qwcurrentOpacity[qi]=0;

   var mHTML="";
	mHTML+="<a href=\"/workcam.php\"><div style=\"top: 0px; z-index: 2;\" id=\"qwphoto0\" name=\"qwphoto\" class=\"qwPhoto\"><img src=\""+qwebcamimg+"\" id=\"qwimage1\" style=\"padding: 0; margin: 0 0 0 0; height:87px;width:107px;\"/></div>";
	mHTML+="<div style=\"top: -120px; z-index: 2;\" id=\"qwphoto1\" name=\"qwphoto\" class=\"qwPhoto\"><img src=\""+qwebcamimg+"\" id=\"qwimage2\" style=\"padding: 0; margin: 0 0 0 0;height:87px;width:107px;\"/></div></a>";
	document.getElementById("qwebcamImage").innerHTML = mHTML;

	if(document.all) {
		document.getElementById("qwphoto"+qwcurrentPhoto).style.filter="alpha(opacity=100)";
	} else {
		document.getElementById("qwphoto"+qwcurrentPhoto).style.MozOpacity = "100%";
	}

	mwInterval = setInterval("qcrossFadeW()",250);
}

function qcrossFadeW() {
	if(qpausew)return;

	qwcurrentOpacity[qwcurrentPhoto]-=25;
	qwcurrentOpacity[qwsecondPhoto] +=25;


	if(document.all) {
		document.getElementById("qwphoto"+qwcurrentPhoto).style.filter = "alpha(opacity=" + qwcurrentOpacity[qwcurrentPhoto] + ")";
		document.getElementById("qwphoto"+qwsecondPhoto).style.filter = "alpha(opacity=" + qwcurrentOpacity[qwsecondPhoto] + ")";
	} else {
      // Moz
		document.getElementById("qwphoto"+qwcurrentPhoto).style.MozOpacity = qwcurrentOpacity[qwcurrentPhoto]/100;
		document.getElementById("qwphoto"+qwsecondPhoto).style.MozOpacity =  qwcurrentOpacity[qwsecondPhoto]/100;
      // Konq
      document.getElementById("qwphoto"+qwcurrentPhoto).style.KHTMLOpacity = qwcurrentOpacity[qwcurrentPhoto]/100;
      document.getElementById("qwphoto"+qwsecondPhoto).style.KHTMLOpacity = qwcurrentOpacity[qwsecondPhoto]/100;
      // Generic
      document.getElementById("qwphoto"+qwcurrentPhoto).style.opacity = qwcurrentOpacity[qwcurrentPhoto]/100;
      document.getElementById("qwphoto"+qwsecondPhoto).style.opacity = qwcurrentOpacity[qwsecondPhoto]/100;
	}
	
   if(qwcurrentOpacity[qwcurrentPhoto]<=0) {
      qwcit--;
      if (qwcit < 1) return;
		qwtempPhoto = qwcurrentPhoto;
      if (qwcurrentPhoto == 0) {
        document.getElementById('qwimage1').src= qwebcamimg + Math.random() * 10000;
      } else {
        document.getElementById('qwimage2').src= qwebcamimg + Math.random() * 10000;
      }
      qwcurrentPhoto = qwsecondPhoto;
		qwsecondPhoto = qwtempPhoto;
		qpausew = true;
		qwebInterval = setTimeout("qpausew=false",17200);
	}

}
