function objetoAjax(){
var xmlhttp=false;
try {

xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}

}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
  }
  
function ajaxFunction(divRes,fileRes,vars)
{
	
	varsText = '';
	arrayVars = vars.split('-');
	//alert(arrayVars.length);
	varsNum = (arrayVars.length);
	for (i=0;i<varsNum;i++)
		{
			varsText = varsText + arrayVars[i];
		}
	
	
	divResultado = document.getElementById(divRes);
  	
	ajax=objetoAjax();
 	ajax.open("POST", fileRes,true);
  	ajax.onreadystatechange=function() 
	{
		
		if (ajax.readyState==4) 
		{
	 		divResultado.innerHTML = ajax.responseText
		}
     }
  	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//ajax.send("name="+name)
	ajax.send(varsText)
	//setTimeout('document.form.reset()',10);
}

function option_other()
{
	if ( document.getElementById('ETS1').value == 'other' )
	{
		document.getElementById('other').style.display = 'block';
	}
	else
	{
		document.getElementById('other').style.display = 'none';	
	}
	
}

var timerID = 0;

var cur_op = 1;
var cur_alpha = 100;
var target_op = 0;
var target_alpha = 0;

var num_pics = 5;
var cur_pic = 5;
var target_pic = 1;
var cont = 0;

function UpdateTimer() {
	
	cur_op = cur_op - 0.08;
	cur_alpha = cur_alpha - 8;
	target_op = target_op + 0.08;
	target_alpha = target_alpha + 8;
	
	current = document.getElementById('photo_fade_' + cur_pic);
	target = document.getElementById('photo_fade_' + target_pic);
	
   current.style.visibility = 'visible';
   target.style.visibility = 'visible';
   current.style.opacity = cur_op;
   current.style.filter = "alpha(opacity=" + cur_alpha + ")";
   target.style.opacity = target_op;
   target.style.filter = "alpha(opacity=" + target_alpha + ")";
   
  
   if (cur_op > 0)
   {
   timerID = setTimeout("UpdateTimer()", 70);
   }
   else
   {
	cur_op = 1;
	cur_alpha = 100;
	target_op = 0;
	target_alpha = 0;
	current.style.visibility = 'hidden';
	
	if (target_pic == num_pics)
		{ target_pic = 1;

		  cont = cont + 1;
		 
		}
	else
		{ target_pic = target_pic + 1; }
	if (cur_pic == num_pics)
		{ cur_pic = 1; }
	else
		{ cur_pic = cur_pic + 1; }
	
	if (cont != 2 )
		timerID = setTimeout("UpdateTimer()", 4000);
	}
}