// JavaScript Document
var capa = null;
	var _IE_ = navigator.userAgent.indexOf("MSIE") != -1;
 
	function liberaCapa() {
		capa = null;
	}
	
	function clickCapa(e, obj) {
		capa = obj.parentNode;
		if (_IE_) {
			difX = e.offsetX;
			difY = e.offsetY;
		} else {
			difX = e.layerX;
			difY = e.layerY;
		}
	}
	
	function mueveCapa(e) {
		if (capa != null) {
			capa.style.top = (e.clientY-difY)+"px";
			capa.style.left = (e.clientX-difX)+"px";
		}
	}
function cambiacapamenu(dir,dir1){
var milon=document.getElementById(dir).style.width;
var mialt=document.getElementById(dir).style.height;
//document.getElementById(dir1).style.width=milon;
//document.getElementById(dir1).style.height=mialt;
}
function cierradiseno(){
	parent.document.getElementById('capadisenos').style.visibility='hidden';
	parent.document.getElementById('capadisenos1').style.visibility='hidden';
	}	

function fondomundo(){
document.getElementById('empresatablon').style.backgroundImage='url(/paweb/img/dec/fondos/fondomundo.jpg)';
}
/*
            Extract of functions developed by Francisco Javeir Martinez
            francisco_javier_martinez@hotmail.com
        */
        // Public function to get the LEFT (X) Object Position
	this.findLeftObj = function(obj)
        {
            var curleft = 0;
            if (obj.offsetParent)
            {
                while (obj.offsetParent)
                {
                    curleft += obj.offsetLeft
                    obj = obj.offsetParent;
                }
            }
            else
            {
                if(obj.x)
                {
                    curleft += obj.x;
                }
            }
            return(curleft);
        }
        
        // Public function to get the TOP (Y) Object Position
        this.findTopObj = function(obj)
        {
            var curtop = 0;
            if (obj.offsetParent)
            {
                while (obj.offsetParent)
                {
                    curtop += obj.offsetTop
                    obj = obj.offsetParent;
                }
            }
            else
            {
                if (obj.y)
                {
                    curtop += obj.y;
                }
            }
            return(curtop);
        }

function verdiseno(dirimage,dirleft,dir){
         var laImagen = document.getElementById(dir);
//         var posXImagen = findLeftObj(laImagen);
//         var posYImagen = findTopObj(laImagen);
//         alert ("La posición de la imagen X [" + posXImagen + "] Y [" + posYImagen + "]");

var position=findLeftObj(laImagen);
var navegador = navigator.appName 
if (navegador == "Microsoft Internet Explorer"){
 
	if(position<=380){
		parent.document.getElementById('capadisenos').style.left='543px';
		}
	else{
		parent.document.getElementById('capadisenos').style.left='21px';
		}
}
else{
	if(position<=380){
		parent.document.getElementById('capadisenos').style.left='552px';
		}
	else{
		parent.document.getElementById('capadisenos').style.left='25px';
		}
}
			
	parent.document.getElementById('capadisenos').style.visibility='visible';
	parent.document.getElementById('capadisenos1').style.visibility='visible';
	parent.document.getElementById('capadisenos1').style.backgroundImage='url(/paweb/img/dec/dis2010/g/'+dirimage+'.jpg)';
	
}
function vercapa(dir,dir1,dir2,dir3,dir4,dir5,dir6,dir7,dir8,dirtop){
		document.getElementById(dir).style.visibility='visible';
	//	document.getElementById(dir).style.position='absolute';
	document.getElementById(dir).style.top= dirtop;

	//	document.getElementById(dir).style.left='2px';
//		document.getElementById(dir).style.zIndex='4';
//		document.getElementById(dir).style.backgroundColor='#FAF7EF';
//		document.getElementById(dir).style.width='130px';
//		document.getElementById(dir).style.height='auto';
//		document.getElementById(dir).style.padding='5px';
//		document.getElementById(dir).style.MozBorderRadius='15px';
//		document.getElementById(dir).style.borderRadius='15px';
//		document.getElementById(dir).style.WebkitBorderRadius='15px';
//		document.getElementById(dir).style.borderRightWidth='medium';
//		document.getElementById(dir).style.borderBottomWidth='medium';
//		document.getElementById(dir).style.borderRightStyle='solid';
//		document.getElementById(dir).style.borderBottomStyle='solid';
//		document.getElementById(dir).style.borderRightColor='#CCCCCC';
//		document.getElementById(dir).style.borderBottomColor='#CCCCCC';
//		document.getElementById(dir).style.borderTopWidth='thin';
//		document.getElementById(dir).style.borderLeftWidth='thin';
//		document.getElementById(dir).style.borderTopStyle='solid';
//		document.getElementById(dir).style.borderLeftStyle='solid';
//		document.getElementById(dir).style.borderTopColor='#FFFFFF';
//		document.getElementById(dir).style.borderLeftColor='#FFFFFF';	
	document.getElementById(dir1).style.visibility='hidden';
	document.getElementById(dir1).style.position='absolute';
	document.getElementById(dir1).style.top='31px'; 
	document.getElementById(dir1).style.left='3px'; 
	document.getElementById(dir1).style.zIndex='3'; 
	//document.getElementById(dir8).style.backgroundColor='#EEEEEE';
	document.getElementById(dir1).style.width='119px';
	//document.getElementById(dir1).style.height=document.getElementById(dir1).style.height.value+5;
//		document.getElementById(dir11).style.filter='alpha(opacity=100)';
//		document.getElementById(dir11).style.MozOpacity='.100';
//		document.getElementById(dir11).style.opacity='.100';
  	document.getElementById(dir5).style.color='#CCCCCC';
	document.getElementById(dir8).style.color='#CCCCCC';
	document.getElementById(dir2).style.color='#666666';
	document.getElementById(dir3).style.visibility='hidden';
	document.getElementById(dir4).style.visibility='hidden';

	document.getElementById(dir6).style.visibility='hidden';
	document.getElementById(dir7).style.visibility='hidden';
//	document.getElementById(dir8).style.color='#A8C6A8';


}

function colormenusup(){
  	document.getElementById('nuestraempresa').style.color='#CCCCCC';
	document.getElementById('nuestrosproductos').style.color='#CCCCCC';
	document.getElementById('nuestrasnoticias').style.color='#CCCCCC';
}

function miinicio(){
document.getElementById('capamedia').style.visibility='visible'; 
document.getElementById('capamedia1').style.visibility='hidden';
document.getElementById('header').style.backgroundImage='url(/paweb/img/dec/fondos/fondosup2010.jpg)';
document.getElementById('capamimenuinicio1').style.visibility='visible';
document.getElementById('capamimenuinicio2').style.visibility='visible';
document.getElementById('capamimenuinicio3').style.visibility='visible';
document.getElementById('capalema').style.visibility='visible';
document.getElementById('footer').style.visibility='visible';
document.getElementById('capalema').style.top='10px';
}

function miempresa(){
document.getElementById('capamedia1').style.visibility='hidden';document.getElementById('capamedia').style.visibility='hidden'; document.getElementById('header').style.backgroundImage='url(/paweb/img/dec/fondos/fondosup2010_e.jpg)',document.getElementById('empresatablon').style.visibility='hidden';}
function misnoticias(){
document.getElementById('capamedia1').style.visibility='hidden';document.getElementById('capamedia').style.visibility='hidden'; document.getElementById('header').style.backgroundImage='url(/paweb/img/dec/fondos/fondosup2010_n.jpg)',document.getElementById('empresatablon').style.visibility='hidden';}
function misproductos(){
document.getElementById('capamedia1').style.visibility='hidden';document.getElementById('capamedia').style.visibility='hidden'; document.getElementById('header').style.backgroundImage='url(/paweb/img/dec/fondos/fondosup2010_p.jpg)',document.getElementById('empresatablon').style.visibility='hidden';}

function empresaintroduccion(dirtop,dirleft,dirwidth,dirheight){
	
document.getElementById('empresatablon').style.visibility='visible';
document.getElementById('empresatablon').style.top=dirtop;
document.getElementById('empresatablon').style.left=dirleft;
document.getElementById('empresatablon').style.width=dirwidth;
document.getElementById('empresatablon').style.height=dirheight;
document.getElementById('empresatablon').style.backgroundColor='#f8f6ef';
document.getElementById('empresatablon').style.padding='10px';
//document.getElementById('empresatablon').style.filter='alpha(opacity=100)';
//	document.getElementById('empresatablon').style.MozOpacity='.100';
//	document.getElementById('empresatablon').style.opacity='.100';	
document.getElementById('capalogo').style.visibility='hidden';
document.getElementById('capalema').style.visibility='hidden';
}


function NuevoAjax(){
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 Cargar(url,dirheight,miscroll){
	var navegador = navigator.appName 
//if (navegador == "Microsoft Internet Explorer"){ 
document.getElementById('contenido').innerHTML="<iframe name='marcoempresatablon' id='marcoempresatablon' src='"+url+"' style='border: 0px solid #ffffff;' width='98%' height='"+dirheight+"' scrolling='"+miscroll+"' frameborder='#'>";
marcoempresatablon.location=url;
return;
//}
var contenido, preloader;
contenido = document.getElementById('contenido');
preloader = document.getElementById('preloader');
//creamos el objeto XMLHttpRequest
ajax=NuevoAjax();
//peticionamos los datos, le damos la url enviada desde el link
//modificacion
ajax.open("POST", url,true);
ajax.onreadystatechange=function(){
if(ajax.readyState==1){
preloader.innerHTML = "Cargandoâ€¦";
//modificamos el estilo de la div, mostrando una imagen de fondo
//preloader.style.background = "url('loading.gif') no-repeat";
}else if(ajax.readyState==4){
if(ajax.status==200){
contenido.innerHTML = ajax.responseText;
preloader.innerHTML = "";
//preloader.style.background = "url('loaded.gif') no-repeat";
}else if(ajax.status==404){
preloader.innerHTML = "La pĂˇgina no existe";
}else{
//mostramos el posible error
preloader.innerHTML = "Error:";
}
}
}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send(null);
}


function cerrarcapas(dir,dir1,dir2,dir3){
document.getElementById('capadisenos').style.visibility='hidden';
document.getElementById('capadisenos1').style.visibility='hidden';
document.getElementById('mapared').style.visibility='hidden';
 if(document.getElementById(dir)){
 document.getElementById(dir).style.visibility='hidden';
 }
 if(document.getElementById(dir1)){
 document.getElementById(dir1).style.visibility='hidden';
 }
 if(document.getElementById(dir2)){
 document.getElementById(dir2).style.visibility='hidden';
 }
 if(document.getElementById(dir3)){
 document.getElementById(dir3).style.visibility='hidden';
 }
}

function abrircapas(dir,dir1){
 if(document.getElementById(dir)){
 document.getElementById(dir).style.visibility='visible';
 }
 if(document.getElementById(dir1)){
 document.getElementById(dir1).style.visibility='visible';
 }
}
