var ruta="";
var sum=1;
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

///////////////////////////////////////////////////////
//funcion borrar
function hidelayer(lay){
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
sum=1;
//borrar_bot('bot_sig');
//borrar_bot('bot_ant');
}
function hidelayer2(lay){
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
sum=1;
borrar_bot('bot_sig');
borrar_bot('bot_ant');
}
//----------------------------------------------


function siguiente(){
	sum=sum+1;
	if (sum>=16) { borrar_bot('bot_sig'); ver_bot('bot_ant'); }

	if (sum>=1 && sum<=16){
//		alert(ruta+'foto'+sum+'.jpg');
		ver_bot('bot_ant');
		document.getElementById('fotito').src = ruta+'foto'+sum+'.jpg';
	}
	else sum=16;
}

function anterior(){
	sum=sum-1;
	if (sum<=1) { borrar_bot('bot_ant'); ver_bot('bot_sig'); }
	if (sum>0){
		ver_bot('bot_sig');
		document.getElementById('fotito').src = ruta+'foto'+sum+'.jpg';
	}
	else sum=1;
}

function borrar_bot(boton){
/*	if (ie4) {document.all[boton].style.visibility = "hidden";}
	if (ns4) {document.layers[boton].visibility = "hide";}
	if (ns6) {document.getElementById(boton).style.display = "none";}*/
	document.getElementById(boton).style.visibility='hidden';

}

function ver_bot(boton){
/*	if (ie4) {document.all[boton].style.visibility = "visible";}
	if (ns4) {document.layers[boton].visibility = "show";}
	if (ns6) {document.getElementById(boton).style.display = "";} */
	document.getElementById(boton).style.visibility='visible';
}


 function callAJAX(url, pageElement, callMessage) {
	document.getElementById(pageElement).innerHTML = callMessage;
	try {
      req = new XMLHttpRequest(); /* e.g. Firefox */
    } catch(e) {
      try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    /* some versions IE */
      } catch (e) {
        try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
  	/* some versions IE */
        } catch (E) {
          req = false;
        }
      }
    }
 
    req.onreadystatechange = function() {responseAJAX(pageElement);};
    req.open("GET",url,true);
    req.send(null);
 
  }
 
 function responseAJAX(pageElement) {
    var output = '';
    if(req.readyState == 4) {
      if(req.status == 200) {
        output = req.responseText;
        document.getElementById(pageElement).innerHTML = output;
      }
    }
  }
  
 function showWS(where, pos) {
	 	ruta = "../images/fotos"+pos+"/";
		document.getElementById('widescreen').style.visibility='visible';
		document.getElementById('widescreen').style.display='';
		callAJAX(where,'contenedor','<center><img src=../images/ajax-loader.gif></center>');
		//borrar_bot('bot_ant');
		return false;
 }
