
var table_cell_display='table-cell';function fadeprecio()
{var precio_div=document.getElementById('precio_div');var precio=getprecio();if((precio>0)&&(document.getElementById('colorcod').value))
precio_div.innerHTML=precio+"&nbsp;€";else precio_div.innerHTML='';}
function toggle_dir()
{var tocheck=document.getElementById('misma_dir');if(tocheck.checked)
dir2_li.style.display='none';else
dir2_li.style.display='block';}
function ajax(query)
{if(window.XMLHttpRequest)
{var xmlhttp=new XMLHttpRequest()}
else if(window.ActiveXObject)
{var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}
xmlhttp.open('POST',"/ajaxreq.php",false);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("tgt="+query);return xmlhttp.responseText;}
function safe_destroy(dyingID)
{var dID=document.getElementById(dyingID);if(dID)
dID.parentNode.removeChild(dID);}
function hide_help()
{var anchol=document.getElementById('anchol');var video_div=document.getElementById('video_div');var colores=document.getElementById('colores');if(video_div)
document.getElementById('video_div').innerHTML='';safe_destroy('big_color');safe_destroy('colores');safe_destroy('montar');safe_destroy('masinfo');safe_destroy('muestras');safe_destroy('medir');safe_destroy('screen');safe_destroy('black_screen');}
function show_masinfo(id)
{show_lightwindow("masinfo","id="+id);}
function show_lightwindow(funcion,query)
{var info=eval(sjax("/ajax/"+funcion,query));myLightWindow.dimensions.titleHeight=100;myLightWindow.activateWindow({height:500,href:info.text,title:info.title,width:800});}
function open_lightwindow(e)
{if(e.target)
var sender=e.target.parentNode;else if(e.srcElement)
var sender=e.srcElement.parentNode;else
return true;myLightWindow.activateWindow({href:sender.href,title:''});}
function show_help(helpid)
{var anchol=document.getElementById('anchol');hide_help();document.body.innerHTML+='<div id="black_screen" class="black_screen"></div>';var black_screen=document.getElementById('black_screen');if(window.XMLHttpRequest)
{var xmlhttp=new XMLHttpRequest()}
else if(window.ActiveXObject)
{var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}
xmlhttp.open('POST',"/ajaxreq.php",false);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("tgt="+helpid);document.body.innerHTML+=xmlhttp.responseText;if(helpid.indexOf("&")==-1)
var help_popup=document.getElementById(helpid);else
var help_popup=document.getElementById(helpid.substr(0,helpid.indexOf("&")));var black_screen=document.getElementById('black_screen');if(help_popup.offsetWidth<window.innerWidth)
{if(help_popup.id=="muestras")
help_popup.style.left=help_popup.offsetWidth+"px";else
help_popup.style.left=Math.round(black_screen.offsetWidth/2-help_popup.offsetWidth/2+window.pageXOffset)+"px";}
else
help_popup.style.left=0;if(help_popup.offsetHeight<window.innerHeight)
help_popup.style.top=Math.round(screen.availHeight/2-help_popup.offsetHeight/2+window.pageYOffset)+"px";else
help_popup.style.top=0;}
function show_videos(sender,group)
{if(sender!=false)
{if(sender.parentNode.getAttribute("class")=="collapsed")
sender.parentNode.setAttribute("class","");else
sender.parentNode.setAttribute("class","collapsed");}
if(document.getElementById(group).style.display=='table-row')
document.getElementById(group).style.display='none';else
document.getElementById(group).style.display='table-row';}
function video_play(cat)
{var vid_player=document.getElementById('vid_player');switch(cat)
{case'madera':var video_num='246317';break;case'veneciana':var video_num='246586';break;case'estorn':var video_num='1288337';break;case'estorm':var video_num='1241040';break;case'estorg':var video_num='246396';break;case'solar':var video_num='246355';break;case'cofre':var video_num='1288910';break;case'verticalt':var video_num='2659884';break;case'verticalp':var video_num='2531776';break;}
if(video_num!=undefined)
url='http://blip.tv/scripts/flash/showplayer.swf?autostart=true&brandname=LosEstores.com&brandlink=http%3A//www.losestores.com&showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&file=http%3A//estores.blip.tv/file/'+video_num+'/%3Fskin%3Drss&user=estores&showguidebutton=false&showsharebutton=true&showfsbutton=false&lightcolor=0x00BE00&backcolor=0xFFFFFF&frontcolor=0x007F00';var vid_div=document.getElementById('video_div');if(url!=undefined)
{if(vid_player!=undefined)
vid_div.removeChild(vid_player);vid_player=document.createElement('object');vid_player.id='vid_player';vid_player.type='application/x-shockwave-flash';vid_player.width=640;vid_player.height=480;vid_player.data=url;vid_player.innerHTML='<div class="warn">Para reproducir los vídeos en vivo tiene que instalar el plug-in de <a href="http://www.macromedia.com/go/getflashplayer/">Flash Player<\/a> o alternativamente puede descargarlo para verlo con su reproductor de vídeo.<\/div>';vid_div.appendChild(vid_player);location.href="#video";}}
function getprecio()
{var cantidad=0;var mult1=0;var mult2=0;var mult3=0;var mult=0;var anchol;var redondeo=100;var alto=document.getElementById('alto').value;var ancho=document.getElementById('ancho').value;if((alto!="")&&(ancho!=""))
{cantidad=document.getElementById('cantidad').value;precio=document.getElementById('precio');if(cantidad!="")
{mult=4986;if(alto%redondeo!=0)
alto=alto-alto%redondeo+redondeo;if(ancho%redondeo!=0)
ancho=ancho-ancho%redondeo+redondeo;if(document.getElementById('colorcod').value.search(/^foto:/)!=-1)
mult+=3835;var superf=(alto/1000)*(ancho/1000);if(superf<1)superf=1;salida=Math.round(cantidad*superf*mult)/100;return salida;}}}
function load_sim(color)
{var simulador=document.getElementById('simulador');simulador.src='/img/loading.gif';simulador.style.visibility='visible';var fondo=document.getElementById('sim_color').style.backgroundColor;if(color=="!img")
var colorhex=document.getElementById('colorcod').value;else
var colorhex="#"+color;simulador.src='/img/simulador/simulador.php?fondo='+fondo.replace("#","%23")+'&color='+colorhex.replace("#","%23");document.getElementById('id3').style.visibility='visible';}
function sim_chbg(color)
{document.getElementById('sim_color').style.backgroundColor=color;if(document.getElementById('color_table'))
var color_table=document.getElementById('color_table');else if(document.getElementById('colorList1').style.display=='block')
var color_table=document.getElementById('color_table1');else if(document.getElementById('colorList2').style.display=='block')
var color_table=document.getElementById('color_table2');if(color_table.value!='')
{document.getElementById('simulador').src='http://img.losestores.com/loading.gif';load_sim(color_table.value.replace("#",""));}}
function chcolor(color,nombre)
{document.getElementById('colorcod').value=nombre;document.getElementById('colorhex').value=color;check_medidas();fadeprecio();}
function checkint(inp)
{var val=document.getElementById(inp).value;for(var i=0;i<inp.length;i++)
if((val.charCodeAt(i)<48)||(val.charCodeAt(i)>57))
val=val.replace(val.charAt(i),"");document.getElementById(inp).value=val;}
function check_medidas()
{var max_ancho=3000;var error_alto=false;var error_ancho=false;var alto=document.getElementById('alto');var ancho=document.getElementById('ancho');if(((alto.value)&&(alto.value<320))||((ancho.value)&&(ancho.value<320)))
document.getElementById('warn_medidas').style.display='block';else
document.getElementById('warn_medidas').style.display='none';if((alto.value)&&(alto.value<320))alto.value='';if((ancho.value)&&(ancho.value<320))ancho.value='';if((ancho.value)&&(ancho.value>max_ancho))
error_ancho=true;if(error_ancho)
ancho.value='';if(error_alto)
alto.value='';if((error_ancho)||(error_alto))
document.getElementById('warn_ancho').style.display='block';else{document.getElementById('warn_ancho').style.display='none';}}
function toggle_colorpared()
{var paletapared=document.getElementById('paletapared').style;var sim_color=document.getElementById('sim_color');if(paletapared.visibility=='hidden')
{paletapared.top=sim_color.offsetTop;paletapared.left=sim_color.offsetLeft;paletapared.visibility='visible';}
else
paletapared.visibility='hidden';}
function marcar_color(celda,tabla)
{var childNum=3;for(var i=0;i<colores.length;i++)
document.getElementById(colores[i]).style.border='none';if(celda.style.backgroundColor=='#000000')
celda.style.border='2px solid white';else
celda.style.border='2px solid black';}
function show_large_btn(celda,tabla,colorName)
{var childNum=1;if($('ampliar_color'))$('ampliar_color').parentNode.removeChild($('ampliar_color'));var div=celda.childNodes[childNum];var tabla=document.getElementById(tabla);var btn=document.createElement('div');btn.id="ampliar_color";btn.appendChild(document.createTextNode("Ampliar"));btn.setAttribute("onclick","show_help('big_color&color="+colorName+"')");btn.onmouseover="show_large_btn($('"+celda.id+"'), '"+tabla.id+"')";div.appendChild(btn);}
function setcant(oferta,cant,max)
{var oferta_form=document.getElementById('oferta_'+oferta);oferta_form.elements[1].value=cant;for(var i=1;i<=max;i++)
if(i==cant)
document.getElementById('cant_'+oferta+'_'+i).style.border='2px solid black';else
document.getElementById('cant_'+oferta+'_'+i).style.border='none';}
function dopoll(pedid)
{var pollr=document.getElementById('poll').elements['poll'];var id;for(var i=0;i<pollr.length;i++)
if(pollr[i].checked)
var id=pollr[i].value;if(document.getElementById('poll4').checked)
document.getElementById('poll_other').style.display='block';else
document.getElementById('poll_other').style.display='none';ajax("poll&pedido="+pedid+"&id="+id);}
function poll_other_send(pedid)
{if(document.getElementById('poll_other_text').value!="")
{ajax("poll_other&pedido="+pedid+"&text="+escape(document.getElementById('poll_other_text').value));document.getElementById('poll_other').style.display='none';}}
function check_pedido()
{if($("pedido").value=="")return;if($("form_foto_error"))
$("form_foto_error").parentNode.removeChild($("form_foto_error"));if(ajax("check_pedido&id="+$("pedido").value)!="ok")
{var ffe=document.createElement("div");ffe.id="form_foto_error";ffe.setAttribute("class","error");ffe.style.margin='auto';ffe.innerHTML='El código de pedido introducido no es válido';$("form_foto").parentNode.insertBefore(ffe,$("form_foto").nextSibling);}}
