var effect_1 = null;

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 ver_contenido(id,pagina){
//	alert(id+" "+pagina);
//	document.getElementById(id).style.dislpay="";
	var Resultado = "";
	Resultado = document.getElementById(id);
	Resultado.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", pagina,true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			//alert(ajax.responseText);
			Resultado.innerHTML = ajax.responseText	
		}
		
	}

	ajax.send(null);
}

function opacity_completo(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
	if(opacStart == 100 ){
		document.getElementById(id).style.display="none";
		}
	if(opacStart == 0){
		document.getElementById(id).style.display="";
		}
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
	var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
	if(opacStart == 100 ){
		document.getElementById(id).style.display="none";
		}
	if(opacStart == 0){
		document.getElementById(id).style.display="";
		}


}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function cambiar_opacity_menu_principal(id){
	if(id == 1)
	{
	document.getElementById("apDiv1").innerHTML = "<img src=\"menu.jpg\" onclick=\"opacity('apDiv2',0,100,1000);cambiar_opacity_menu_principal(0);\" style=\"cursor:pointer;\" id=\"menu\"  />";
	}
	else
	{
	document.getElementById("apDiv1").innerHTML = "<img src=\"menu.jpg\" onclick=\"opacity('apDiv2',60,0,1000);cambiar_opacity_menu_principal(1);\" style=\"cursor:pointer;\" id=\"menu\"  />";	
	}		
}

	
function acercade(){
	var Resultado = "";
	Resultado = document.getElementById("lista");
	Resultado.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", "acercade.php",true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			Resultado.innerHTML = ajax.responseText	
		}
		
	}

	ajax.send(null);
	
}

function clientes(){
	var Resultado1 = "";
	Resultado1 = document.getElementById("menu3");
	Resultado1.style.display = "";
	ajax1=objetoAjax();
	ajax1.open("GET", "clientes.php",true);
	ajax1.onreadystatechange=function() {

		if (ajax1.readyState==4) 
		{
			Resultado1.innerHTML = ajax1.responseText	
		}
		
	}

	ajax1.send(null);
}

function ocultar_menu3(){
		document.getElementById("menu3").style.display="none";
	}
function ocultar_menu2(){
		document.getElementById("menu2").style.display="none";
	}
function ocultar_pie(){
		document.getElementById("mas_imagenes").style.display="none";
		document.getElementById("mas_info").style.display="none";
	}

function ocultar_pie(){
		document.getElementById("mas_imagenes").style.display="none";
		document.getElementById("mas_info").style.display="none";
		document.getElementById("video").style.display="none";		
	}
	
function cambiar_estilo(item_menu,total,categoria){
	//alert(item_menu+" "+total+" "+categoria);
	var id ="";
	for(i=1;i<total+1;i++)
	{
		id = categoria+"_"+i;
		if(i==item_menu)
		{document.getElementById(id).style.color="#ff6634";}
		else
		{document.getElementById(id).style.color="#6D7384";}
	}	
}

function cambiar_fondo(imagen){
	document.getElementById("image_holder").innerHTML = '<img src="admin/archivos/'+imagen+'" id="main_image" alt=""/>';
	resize_image_with_cropping()
}

function cambiar_mas_info(id,idioma){
	//alert(id);
	document.getElementById("mas_info").style.display="";
	if(idioma == "_en")
	{ var mas_info = "More Info";}
	else
	{ var mas_info = "M&aacute;s Info"; }

	document.getElementById("mas_info").innerHTML = "<span onclick=\"opacity('menu3',0,60,1000);ver_info("+id+"); \" style='cursor:pointer;'><em>"+mas_info+"</em></span>";
	
}

function cambiar_ver_imagenes(id_img,idioma){
	//alert(id_img)	
	var Resultado = "";
	Resultado = document.getElementById("mas_imagenes");
	Resultado.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", "cambiar_ver_imagenes.php?id_img="+id_img+"&idioma="+idioma,true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			Resultado.innerHTML = ajax.responseText;	
		}		
	}
	ajax.send(null);
}

function cambiar_video(id,idioma){
	//alert(id+" "+idioma)	;
	document.getElementById("video").style.display="";
	var Resultado = "";
	Resultado = document.getElementById("video");
	Resultado.style.display = "";
	ajax1=objetoAjax();
	ajax1.open("GET", "cambiar_video.php?id="+id+"&idioma="+idioma,true);
	ajax1.onreadystatechange=function() {

		if (ajax1.readyState==4) 
		{
			Resultado.innerHTML = ajax1.responseText;	
		}		
	}
	ajax1.send(null);
}




function ver_info(id){
	var Resultado = "";
	Resultado = document.getElementById("menu3");
	Resultado.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", "ver_info.php?id="+id,true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			Resultado.innerHTML = ajax.responseText	
		}
		
	}

	ajax.send(null);
}

function ver_siguiente_imagen(id,orden,imagen){
	
	document.getElementById("image_holder").innerHTML = '<img src="admin/archivos/'+imagen+'" id="main_image" alt=""/>';;

	var Resultado = "";
	Resultado = document.getElementById("mas_imagenes");
	Resultado.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", "ver_imagen.php?id="+id+"&orden="+orden,true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			//alert(ajax.responseText);
			Resultado.innerHTML = ajax.responseText;
		}
		
	}

	ajax.send(null);
	resize_image_with_cropping()
}

function ver_anterior_imagen(id,orden,imagen){
	
	document.getElementById("image_holder").innerHTML = '<img src="admin/archivos/'+imagen+'" id="main_image" alt=""/>';;

	var Resultado = "";
	Resultado = document.getElementById("mas_imagenes");
	//Resultado_vsi.style.display = "";
	ajax=objetoAjax();
	ajax.open("GET", "ver_imagen.php?id="+id+"&orden="+orden,true);
	ajax.onreadystatechange=function() {

		if (ajax.readyState==4) 
		{
			//alert(ajax.responseText);
			Resultado.innerHTML = ajax.responseText;
		}
		
	}

	ajax.send(null);
	resize_image_with_cropping()
}