// validacion de email

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Por favor ingresá una dirección de email válida")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Por favor ingresá una dirección de email válida")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Por favor ingresá una dirección de email válida")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Por favor ingresá una dirección de email válida")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Por favor ingresá una dirección de email válida")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Por favor ingresá una dirección de email válida")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Por favor ingresá una dirección de email válida")
		    return false
		 }

 		 return true					
}


function agrandarImg(u){
	o_img_gde = document.getElementById('img_gde');	
	o_img_gde.innerHTML = '<img src="'+u+'">';
	o_contenedor_img_gde = document.getElementById('contenedor_img_gde');	
	o_contenedor_img_gde.style.display = 'block';
}

function cerrarImg(){
	o_img_gde = document.getElementById('img_gde');	
	o_contenedor_img_gde = document.getElementById('contenedor_img_gde');	
	o_img_gde.innerHTML = '';
	o_contenedor_img_gde.style.display = 'none';
	
}

function agrandarColor(u){
	o_img_gde = document.getElementById('color_gde');	
	o_img_gde.innerHTML = '<img src="'+u+'">';
	o_contenedor_img_gde = document.getElementById('contenedor_color_gde');	
	o_contenedor_img_gde.style.display = 'block';
}

function cerrarColor(){
	o_img_gde = document.getElementById('color_gde');	
	o_contenedor_img_gde = document.getElementById('contenedor_color_gde');	
	o_img_gde.innerHTML = '';
	o_contenedor_img_gde.style.display = 'none';
	
}


abierto = false;
function menuProd(a,ingles){
	if (ingles == 1){
		imgAbrir = '/img/list_botdesplegar_e.png';
		imgCerrar = '/img/list_botcerrar_e.png';
	} else {
		imgAbrir = '/img/list_botdesplegar.png';
		imgCerrar = '/img/list_botcerrar.png';
	}
	
	lista = document.getElementById("listado");
	if (abierto){
		//cierra
		a.src = imgAbrir;
		lista.style.display = 'none';
		abierto = false;
	} else {
		//abre
		a.src = imgCerrar;
		lista.style.display = 'block';
		abierto = true;
	}	
}


pagActual = '';
linkActual = '';

function verPag(n,objLink){
	if (pagActual == ''){
		pagActual = document.getElementById("pag_1");	
	}
	if (linkActual == ''){
		linkActual = document.getElementById("link1");	
	}

	pag = eval('document.getElementById("pag_'+n+'")');
	
	pagActual.style.display = 'none';	
	linkActual.style.fontWeight = 'normal';	
	
	pag.style.display = 'block';
	objLink.style.fontWeight = 'bold';	

	pagActual = pag;
	linkActual = objLink;

}

function ajuste(){
	izq = (screen.width - 880) / 2;	
	contenedor = document.getElementById('contenedor_general');
	contenedor.style.left = izq + "px";
}

function ocultarTodos(){

	elContenedor = document.getElementById('cont_menu');
	maderas = document.getElementById('submenu_maderas');
	metales = document.getElementById('submenu_metales');
	industrial = document.getElementById('submenu_industrial');
	
	maderas.style.display='none';
	metales.style.display='none';
	industrial.style.display='none';
	
	for (hijo in elContenedor.childNodes){
		if (elContenedor.childNodes[hijo].id != undefined){
			elContenedor.childNodes[hijo].style.display='none';
		}
	}
	
	//los botones
	menu_usos = document.getElementById('bot_m_prod_usos');
	menu_usos_link = document.getElementById('bot_m_prod_usos_link');
	menu_usos.className = 'mesup_botnegro';
	menu_usos_link.className = 'mesup_botnegro_link';
	
	menu_lineas = document.getElementById('bot_m_prod_lineas');
	menu_lineas_link = document.getElementById('bot_m_prod_lineas_link');
	menu_lineas.className = 'mesup_botnegro';
	menu_lineas_link.className = 'mesup_botnegro_link';
	
	menu_pdv = document.getElementById('bot_m_pdv');
	menu_pdv_link = document.getElementById('bot_m_pdv_link');
	menu_pdv.className = 'mesup_botnegro';
	menu_pdv_link.className = 'mesup_botnegro_link';
	
}
var tSubUso;
function ocultarSubMenusDelay(){
	tSubUso=setTimeout("ocultarSubMenus()",2500);
}
function ocultarSubMenus(){

	maderas = document.getElementById('submenu_maderas');
	metales = document.getElementById('submenu_metales');
	industrial = document.getElementById('submenu_industrial');
	
	maderas.style.display='none';
	metales.style.display='none';
	industrial.style.display='none';
		
}

var menuOnDef;

function menuOn(a,c){
	if (c == 'abajo'){
		elMenu = document.getElementById(a);
		elMenu.className = 'mesup_botnegro_on';
		elMenuLink = document.getElementById(a+'_link');
		elMenuLink.className = 'mesup_botnegro_on';
	} else {
		elMenu = document.getElementById(a);
		elMenu.className = 'mesup_textos_on';
	}
	
}

function verMenu(a){

	ocultarTodos();
	
	elMenu = document.getElementById(a);
	elMenu.style.display = 'block';
	
}

function mantenerSubUso(){
	clearTimeout(tSubUso);
}

function verSubUso(a){
	ocultarSubMenus();

	elMenu = document.getElementById(a);
	elMenu.style.display = 'block';

}

function smOver(a){
	mantenerSubUso();
	a.style.opacity = '1';
	a.style.filter = 'alpha(opacity=100)';
	
}
function smOut(a){
	a.style.opacity = '0.8';
	a.style.filter = 'alpha(opacity=80)';
	
}

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];}
}

