// JavaScript Document

//specify speed of scroll (greater=faster)
var speed=2
var ancho_pantalla=800;
var altura_pantalla=600;

function detectar_tipo_de_navegador()
{
	var V = navigator.appVersion; 
	var N = navigator.appName; 
	
	if (N == "Microsoft Internet Explorer")
	{
		X = parseFloat(V.substring(V.indexOf("MSIE")+5, V.lastIndexOf("Windows")));
		
		if ( X < 7.0)
			windows.location = "errores/pag_error.html";
	}		 
}

function cargar_fondo(fondo_id)
{
	objeto_container=document.getElementById("contenido");
	objeto_container.style.backgroundImage='url(../imagenes/fondo'+fondo_id+'.jpg)';	
}

function incializa_scroll()
{
    crossobj=document.getElementById("content");
    crossobj.style.top="0px";
}

function incializa_datos_pantalla()
{
	ancho_pantalla = window.screen.availWidth;
	altura_pantalla = window.screen.availHeight;
}

function cargar_texto_scroll_fondo(url_scroll_id, scroll_id, fondo_id)
{
	incializa_scroll();
	cargar_fondo(fondo_id);
	
	pagina = '/capas/fondo.php?id='+url_scroll_id;
	ajaxpage(pagina, scroll_id);
}

function movedown()
{
    crossobj=document.getElementById("content");
    contentheight=crossobj.offsetHeight;

	if (parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
		crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"

	movedownvar=setTimeout("movedown()",20)
}

function moveup()
{
	crossobj=document.getElementById("content");
	contentheight=crossobj.offsetHeight;

	if (parseInt(crossobj.style.top)<=0)
		crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"

	moveupvar=setTimeout("moveup()",20)
}

function getcontent_height()
{
    crossobj=document.getElementById("content");
	contentheight=crossobj.offsetHeight;
}

function addOnLoad(nuevoOnLoad) 
{
   var prevOnload = window.onload;
   if (typeof window.onload != 'function') 
   {
      window.onload = nuevoOnLoad;
   }
   else 
   {
      window.onload = function() 
	  {
          prevOnload();
          nuevoOnLoad();
      }
   }
}

function encontrar_objeto(n, d) 
{
	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=findObj(n,d.layers[i].document);
  	
	if(!x && d.getElementById) 
		x=d.getElementById(n); 

	return x;
}

function abrir_lista_bodas()
{
	var entrada_usuario, entrada_pass;
	
	entrada_usuario = encontrar_objeto("username", document);
	entrada_pass = encontrar_objeto("password", document);
	
	ancho_localizacion = 800;
	altura_localizacion = 600;
	
	tamano_pantalla = 'width='+ancho_localizacion+'px,height='+altura_localizacion+'px,center=0,resize=0;'	
	ruta = '/bodas/acceso.php?usr='+entrada_usuario.value+'&pass='+entrada_pass.value;
	
	dhtmlwindow.open('lista_bodas', 'iframe', ruta, 'LISTAS DE BODAS', tamano_pantalla); 
	
	entrada_usuario.value = "";
	entrada_pass.value = "";
	
	return false;
}

function abrir_localizacion()
{
	ancho_localizacion = 500;
	altura_localizacion = 300;
	
	tamano_pantalla = 'width='+ancho_localizacion+'px,height='+altura_localizacion+'px,center=1,resize=1;'	
	dhtmlwindow.open('Localización', 'iframe', '/localizacion/localizacion.html', 'LOCALIZACION', tamano_pantalla); 
	
	return false;
}

function abrir_galeria_proyectos()
{
	ancho_localizacion = 800;
	altura_localizacion = 600;
	
	tamano_pantalla = 'width='+ancho_localizacion+'px,height='+altura_localizacion+'px,center=0,resize=0;'
	ruta= '/galeria/index.php?id=proyectos';
	
	dhtmlwindow.open('galeria1', 'iframe', ruta, 'Proyectos', tamano_pantalla); 
	
	return false;
}

function abrir_galeria_ambientes()
{
	ancho_localizacion = 800;
	altura_localizacion = 600;
	
	tamano_pantalla = 'width='+ancho_localizacion+'px,height='+altura_localizacion+'px,center=0,resize=0;'
	ruta= '/galeria/index.php?id=ambientes';
	
	dhtmlwindow.open('galeria2', 'iframe', ruta, 'Ambientes', tamano_pantalla); 
	
	return false;
}



