var step = 1;
function rotateImages(prefijo, cantidad) {
	var image1 = new Image();
	image1.src = "images/fotos/" + prefijo + "_1.jpg";
	var image2 = new Image();
	image2.src = "images/fotos/" + prefijo + "_2.jpg";
	var image3 = new Image();
	image3.src = "images/fotos/" + prefijo + "_3.jpg";
	if (!document.images)
		return;
	
	document.images.slide.src = eval("image" + step + ".src");
	if (step < 3) {
		step++;
	}
	else {
		step = 1;
	}
	setTimeout("rotateImages('" + prefijo + "', " + cantidad + ")",5000);
}

//.............

function showNav() {
  document.getElementById("navHolderDiv").style.height = "600px";
}
function hideNav() {
  document.getElementById("navHolderDiv").style.height = "72px";
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function popWin(windo,W,H) {
	window.open(windo, 'pop','scrollbars=yes,resizable=yes,width='+W+',height='+H+',status=yes') ;
}

function abrirFullScreen(quePiso) {
		document.getElementById("divFullScreen").style.width = "100%";
		document.getElementById("divFullScreen").style.height = "100%";
}

function abrirFullScreenL(queLocal) {
	//alert(queLocal);
	var XMLHttpRequestObject = false;
	if (window.XMLHttpRequest) {
		XMLHttpRequestObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		XMLHttpRequestObject = new
		ActiveXObject("Microsoft.XMLHTTP");
	}
	if(XMLHttpRequestObject) {
		XMLHttpRequestObject.open("POST", "infoLocalAriel.asp", false);
		XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		XMLHttpRequestObject.send("id_local=" + queLocal);//Saco Local segun el Piso
	}
	var arreglo = XMLHttpRequestObject.responseText.split("|separador|");
	//Acá ya tienes lo que quieres
	var logo = arreglo[0];
	var foto = arreglo[1];
	var local = arreglo[2];
	var descripcion = arreglo[3];
	//alert(logo);
	var so2 = new SWFObject("images/locales.swf", "elLocal", "100%", "100%", "7", "#000000");
	so2.addParam("quality", "high");
	so2.addVariable("logoLocal","images/info_pisos/" + logo);
	so2.addVariable("imagenLocal","images/info_pisos/" + foto);
	so2.addVariable("tituloLocal",local);
	so2.addVariable("descripionLocal",descripcion);
	
	so2.addVariable("wmode", "opaque");
	so2.write("divLocal");
	document.getElementById("divLocal").style.width = "100%";
	document.getElementById("divLocal").style.height = "100%";
}

function abrirFullScreenP(quePiso) {
		var qMapa;
		qPiso = quePiso;
		if (quePiso == 1) qMapa = "subsuelos.swf"; 
		if (quePiso == 2) qMapa = "plantabaja.swf";  
		if (quePiso == 3) qMapa = "nivel1.swf";  
		if (quePiso == 4) qMapa = "nivel2.swf"; 
		//alert(qPiso);	
		var so = new SWFObject("images/" + qMapa, "elPiso", "100%", "100%", "7", "#000000");
		so.addParam("quality", "high");
		so.addVariable("variable_pisos","images/");
		//so.addVariable("wmode", "opaque");
		so.addVariable("wmode", "transparent");
		so.write("divFullScreen");
		document.getElementById("divFullScreen").style.width = "100%";
		document.getElementById("divFullScreen").style.height = "100%";
}

function abrirFullScreenRC(queResycaf) {
		var so = new SWFObject("images/seccion_resycaf.swf", "test", "100%", "100%", "7", "#000000");
		so.addParam("quality", "high");
		so.addVariable("rutaResycaf","images/");
		so.addVariable("queResycaf",queResycaf);
		so.addVariable("wmode", "Opaque");
		so.write("divFullScreen");
		document.getElementById("divFullScreen").style.width = "100%";
		document.getElementById("divFullScreen").style.height = "100%";
}

function cerrarFullScreen() {
		document.getElementById("divFullScreen").style.width = "0px";
		document.getElementById("divFullScreen").style.height = "0px";
}

function cerrarFullScreenL() {
		document.getElementById("divLocal").style.width = "0px";
		document.getElementById("divLocal").style.height = "0px";
}

function fullScreen(divID) {
		document.getElementById(divID).style.width = "100%";
		document.getElementById(divID).style.height = "100%";
}

function fullScreenRevista_OLD(divID, revista) {
		var so = new SWFObject(revista + ".swf", "nav", "100%", "100%", "7", "#000000");
		so.addParam("quality", "high");
		so.addParam("wmode", "transparent");
		so.write(divID);
		document.getElementById(divID).style.width = "100%";
		document.getElementById(divID).style.height = "100%";
}

function fullScreenRevista(revista) {
		var so = new SWFObject(revista + ".swf", "nav", "100%", "100%", "7", "#000000");
		so.addParam("quality", "high");
		so.addParam("wmode", "transparent");
		so.write("divFullScreen");
		document.getElementById("divFullScreen").style.width = "100%";
		document.getElementById("divFullScreen").style.height = "100%";
}



var curOS ;
if (navigator.appVersion.indexOf("Win")!=-1) curOS="Windows";
else if (navigator.appVersion.indexOf("Mac")!=-1) curOS="MacOS";
else if (navigator.appVersion.indexOf("X11")!=-1) curOS="UNIX";
else if (navigator.appVersion.indexOf("Linux")!=-1) curOS="Linux";
else curOS="unknown";

if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true ;
else if (document.childNodes && !document.all && !navigator.taintEnabled) window.khtml = true ;
else if (document.getBoxObjectFor != null) window.gecko = true ;
if (window.ie6) try {document.execCommand("BackgroundImageCache", false, true);} catch (e){} ;

// Disable a form's submit/cancel button and submit the form. Before submitting, 
// we'll execute a callback function, if applicable...
var disableAndSubmit = function(submitID, cancelID, formID, callback){

	if ($(submitID)) {
		if ($(submitID).getTag() == 'input') {
			$(submitID).setProperty('disabled', true) ;
		} else if ($(submitID).getTag() == 'a') {
			$(submitID).setProperty('href','javascript:void(0)') ;
		} 
		$(submitID).setStyle('opacity', .5) ;
	}

	if ($(cancelID)) {
		if ($(cancelID).getTag() == 'input') {
			$(cancelID).setProperty('disabled', true) ;
		} else if ($(cancelID).getTag() == 'a') {
			$(cancelID).setProperty('href','javascript:void(0)') ;
		} 
		$(cancelID).setStyle('opacity', .5) ;
	}

	if (typeof(callback) == 'function') {
		callback() ;
	}

	return true ; 
} ;

