// JavaScript Document

function hover(id){
	document.getElementById(id).className='bg_videos_hov'
}
function out(id){
	document.getElementById(id).className='bg_videos'
}
function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}
function carga(id){
			ajax=nuevoAjax();
			
			// Envio al servidor el valor seleccionado y el combo al cual se le deben poner los datos
			ajax.open("GET","carga_team.php?video="+id, true);
			ajax.onreadystatechange=function() 
			{ 
				if (ajax.readyState==1)
				{
					document.getElementById("video").innerHTML="CARGANDO IMAGEN...ESPERE POR FAVOR";
				}
				if (ajax.readyState==4)
				{	
					// Coloco en la fila contenedora los datos que recivo del servidor
					document.getElementById("video").innerHTML=ajax.responseText;
					//alert(ajax.responseText);
				} 
			}
			ajax.send(null);
}//end function
function carga_video(id){
			ajax=nuevoAjax();
			
			// Envio al servidor el valor seleccionado y el combo al cual se le deben poner los datos
			ajax.open("GET","carga_video.php?video="+id, true);
			ajax.onreadystatechange=function() 
			{ 
				if (ajax.readyState==1)
				{
					document.getElementById("video").innerHTML="CARGANDO VIDEO...ESPERE POR FAVOR";
				}
				if (ajax.readyState==4)
				{	
					// Coloco en la fila contenedora los datos que recivo del servidor
					document.getElementById("video").innerHTML=ajax.responseText;
					//alert(ajax.responseText);
				} 
			}
			ajax.send(null);
}//end function

function fadepic(){
	if (curpos<100){
		curpos+=10
		if (tempobj.filters)
			tempobj.filters.alpha.opacity=curpos
		else if (tempobj.style.MozOpacity)
			tempobj.style.MozOpacity=curpos/100
	}
	else{
		clearInterval(dropslide)
		nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
		tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
		tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
		nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
		setTimeout("rotateimage()",pause)
	}
}

function rotateimage(){
	if (ie4||dom){
		resetit(curcanvas)
		var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		crossobj.style.zIndex++
		var temp='setInterval("fadepic()",50)'
		dropslide=eval(temp)
		curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
	}
	else
		document.images.defaultslide.src=fadeimages[curimageindex]
		curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
	curpos=10
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	if (crossobj.filters)
		crossobj.filters.alpha.opacity=curpos
	else if (crossobj.style.MozOpacity)
		crossobj.style.MozOpacity=curpos/100
}

function startit(){

	var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'" >'
	rotateimage()
}

/////////////////////



function fadepic2(){
	if (curpos2<100){
		curpos2+=10
		if (tempobj2.filters)
			tempobj2.filters.alpha.opacity=curpos
		else if (tempobj2.style.MozOpacity)
			tempobj2.style.MozOpacity=curpos2/100
	}
	else{
		clearInterval(dropslide2)
		nextcanvas2=(curcanvas2=="canvas01")? "canvas01" : "canvas11"
		tempobj2=ie4? eval("document.all."+nextcanvas2) : document.getElementById(nextcanvas2)
		tempobj2.innerHTML='<img src="'+fadeimages2[nextimageindex2]+'">'
		nextimageindex2=(nextimageindex2<fadeimages2.length-1)? nextimageindex2+1 : 0
		setTimeout("rotateimage2()",pause)
	}
}

function rotateimage2(){
	if (ie42||dom2){
		resetit2(curcanvas2)
		var crossobj2=tempobj2=ie4? eval("document.all."+curcanvas2) : document.getElementById(curcanvas2)
		crossobj2.style.zIndex++
		var temp2='setInterval("fadepic2()",50)'
		dropslide2=eval(temp2)
		curcanvas2=(curcanvas2=="canvas01")? "canvas11" : "canvas01"
	}
	else
		document.images.defaultslide2.src=fadeimages2[curimageindex2]
		curimageindex2=(curimageindex2<fadeimages2.length-1)? curimageindex2+1 : 0
}

function resetit2(what){
	curpos2=10
	var crossobj2=ie4? eval("document.all."+what) : document.getElementById(what)
	if (crossobj2.filters)
		crossobj2.filters.alpha.opacity=curpos2
	else if (crossobj2.style.MozOpacity)
		crossobj2.style.MozOpacity=curpos2/100
}

function inicio(){
	var crossobj2=ie42? eval("document.all."+curcanvas2) : document.getElementById(curcanvas2)
	crossobj2.innerHTML='<img src="'+fadeimages2[curimageindex2]+'" >'

	rotateimage2()
}


