/* Popups */
function AbrirPopUp ( iNumero, nombrefoto, anchofoto, altofoto ) {
	var sNombre = '';
	var sScroll = 'no';
	var sWidth = '450';
	var sHeight= '300';
	var resiz = 'no';
	switch (iNumero) {
		  case 1:
			sNombre = '../institucional/fotos.jsp?pathfoto=' + nombrefoto + '&anchofoto=' + anchofoto + '&altofoto=' + altofoto;
			var sWidth = anchofoto;
			var sHeight= altofoto;
		    break;			
		  case 2:
			sNombre = '../institucional/tallerespop.jsp?t='+nombrefoto;
			sScroll = 'yes';
			var sWidth = '492';
			var sHeight= '450';
		    break;
		  case 3:
			sNombre = '../calculadoras/calculadoras_aire.jsp'
			var sWidth = '360';
			var sHeight= '540';
		    break;
		  case 4:
			sNombre = '../calculadoras/calculadoras_jardin.jsp'
			sScroll = 'yes';
			var sWidth = '560';
			var sHeight= '500';
		    break;
		  case 5:
			sNombre = '../calculadoras/calculadoras_papel.jsp'
			sScroll = 'yes';
			var sWidth = '560';
			var sHeight= '500';
		    break;
		  case 6:
			sNombre = '../calculadoras/calculadoras_calefaccion.jsp'
			var sWidth = '360';
			var sHeight= '540';
		    break;
		  case 7:
		  	if (nombrefoto) {
				sNombre = '../calculadoras/calculadoras_ceramicos.jsp?mcaja='+nombrefoto;
			    sScroll = 'no';
				var sWidth = '543';
				var sHeight= '386';
			} else {
				sNombre = '../institucional/terminos_condiciones.htm'
				sScroll = 'yes';
				var sWidth = '560';
				var sHeight= '500';
			}
		    break;
		  case 8:
			sNombre = '../servlet/showLocales.ev?COMO_LLEGAR=1&ID_LOCAL=' + nombrefoto;
			var sWidth = '430';
			var sHeight= '400';
			break;
		  case 9:
			sNombre = '../servlet/showLocales.ev?COMO_LLEGAR=2&ID_LOCAL=' + nombrefoto;
			sScroll = 'yes';
			var sWidth = '560';
			var sHeight= '500';
		    break;
		  case 10:
			sNombre = '../venta/pop_icono.jsp?CUAL=' + nombrefoto + '&SCUAL=' + anchofoto;
			var sWidth = '440';
			var sHeight= '300';
		    break;
		  case 11:
			sNombre = '../servlet/showArticuloSeleccionado.ev?ID_ARTICULO='+ nombrefoto +'&CANTIDAD=' + anchofoto;
			var sWidth = '422';
			var sHeight= '249';
		    break;
		// case 11:
		//	sNombre = '../venta/pop_articulo_seleccionado.jsp' + nombrefoto;
		//	var sWidth = '280';
		//	var sHeight= '190';
		//    break;
		  case 12:
			sNombre = '../venta/foto_articulo.jsp?sap=' + nombrefoto;
			var sWidth = 350;
			var sHeight= 400;
		    break;
		  case 13:
			sNombre = '../servlet/showAhorroPack.ev?ID_ARTICULO=' + nombrefoto + '&CANTIDAD=' + anchofoto;
			var sWidth = 440;
			var sHeight= 330;
		    break;
		  case 14:
			sNombre = '../institucional/tapa_almaviva.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 15:
			sNombre = '../institucional/sumario1.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 16:
			sNombre = '../institucional/sumario2.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 17:
			sNombre = '../institucional/sumario3.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 18:
			sNombre = '../institucional/sumario4.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 19:
			sNombre = '../institucional/sumario5.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		  case 20:
			sNombre = '../servlet/showAhorroPack.ev?ID_ARTICULO=' + nombrefoto + '&CANTIDAD=' + anchofoto + '&ID_COMBO=' + altofoto;
			var sWidth = 440;
			var sHeight= 330;
		    break;
		  case 21:
			sNombre = '../institucional/sumario6.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '450';
		    break;
		 case 22:
			sNombre = '../institucional/pop_pinturitas.htm';
			sScroll = 'no';
			var sWidth = '600';
			var sHeight= '436';
		    break;
		 case 23:
			sNombre = '../institucional/bases_pinturitas.htm';
			sScroll = 'yes';
			var sWidth = '475';
			var sHeight= '400';
		    break;
		 case 24:
			sNombre = '../institucional/promo_1.htm';
			sScroll = 'yes';
			var sWidth = '625';
			var sHeight= '400';
		    break;
		  case 25:
			sNombre = '../institucional/promo_2.htm';
			sScroll = 'yes';
			var sWidth = '625';
			var sHeight= '400';
		    break;
		  case 26:
			sNombre = '../institucional/promo_rally.htm';
			sScroll = 'no';
			var sWidth = '600';
			var sHeight= '436';
		    break;
		  case 27:
			sNombre = '../institucional/bases_rally.htm';
			sScroll = 'yes';
			var sWidth = '475';
			var sHeight= '400';
		    break;
		  case 28:
			sNombre = '../institucional/promo_3.htm';
			sScroll = 'yes';
			var sWidth = '625';
			var sHeight= '400';
		    break;
		  case 29:
			sNombre = '../institucional/promo_4.htm';
			sScroll = 'yes';
			var sWidth = '625';
			var sHeight= '400';
		    break;
		 case 30:
			sNombre = '../institucional/promociones_fin_semana.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '620';
			break;
		 case 31:
			sNombre = '../institucional/promociones_fin_semana_2.htm';
			sScroll = 'yes';
			var sWidth = '620';
			var sHeight= '620';
			break;
			
		case 32:
			sNombre = '../institucional/emi_1.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
			
		case 33:
			sNombre = '../institucional/emi_2.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
			
		case 34:
			sNombre = '../institucional/emi_3.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
			
		case 35:
			sNombre = '../institucional/emi_4.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
			
		case 36:
			sNombre = '../institucional/emi_5.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
			
		case 37:
			sNombre = '../institucional/pop_bases.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;
			
		case 38:
			sNombre = '../institucional/pop_bases_entrega_gratuita.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;


		case 39:
			sNombre = '../institucional/pop_entrega_gratis.htm';
			sScroll = 'no';
			var sWidth = '200';
			var sHeight= '283';
			break;
			
		case 40:
			sNombre = '../institucional/emi_6.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
			
		case 41:
			sNombre = '../institucional/emi_7.html';
			sScroll = 'no';
			var sWidth = '250';
			var sHeight= '263';
			break;
		case 42:
			sNombre = '../institucional/pop_bases_promo_dia_ninio.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;

       case 43:
			sNombre = '../institucional/pop_detalle_articulos.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;

		case 44:
			sNombre = '../institucional/pop_bases_equipa.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;
			
		case 45:
			sNombre = '../institucional/gal_1.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
			
		
		case 46:
			sNombre = '../institucional/gal_2.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 47:
			sNombre = '../institucional/gal_3.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 48:
			sNombre = '../institucional/gal_4.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 49:
			sNombre = '../institucional/gal_5.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 50:
			sNombre = '../institucional/gal_6.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 51:
			sNombre = '../institucional/gal_8.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 52:
			sNombre = '../institucional/gal_9.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 53:
			sNombre = '../institucional/gal_10.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 54:
			sNombre = '../institucional/gal_11.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 55:
			sNombre = '../institucional/gal_12.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 56:
			sNombre = '../institucional/gal_13.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 57:
			sNombre = '../institucional/gal_14.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 58:
			sNombre = '../institucional/gal_15.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 59:
			sNombre = '../institucional/gal_16.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 60:
			sNombre = '../institucional/gal_17.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 61:
			sNombre = '../institucional/gal_18.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 62:
			sNombre = '../institucional/gal_19.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 63:
			sNombre = '../institucional/gal_20.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 64:
			sNombre = '../institucional/gal_21.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 65:
			sNombre = '../institucional/gal_23.html';
			sScroll = 'no';
            var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 66:
			sNombre = '../institucional/gal_24.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 67:
			sNombre = '../institucional/gal_25.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 68:
			sNombre = '../institucional/gal_26.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 69:
			sNombre = '../institucional/gal_27.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 70:
			sNombre = '../institucional/gal_28.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 71:
			sNombre = '../institucional/gal_29.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 72:
			sNombre = '../institucional/gal_30.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 73:
			sNombre = '../institucional/gal_31.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 74:
			sNombre = '../institucional/gal_32.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 75:
			sNombre = '../institucional/gal_33.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 76:
			sNombre = '../institucional/gal_34.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		case 77:
			sNombre = '../institucional/gal_35.html';
			sScroll = 'no';
			var sWidth = '350';
			var sHeight= '525';
			break;
		
		
		case 78:
			sNombre = '../institucional/pop_bases_promo_alma.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;
			
				
		case 79:
			sNombre = '../institucional/pop_bases_promo_cba.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;
		
		case 80:
			sNombre = '../institucional/pop_bases_promo_navidad.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break;
		
		case 81:
			sNombre = '../institucional/pop_1er_premio.html';
			sScroll = 'yes';
			var sWidth = '600';
			var sHeight= '608';
			break;
		
		case 82:
			sNombre = '../institucional/pop_2_premio.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
			
		case 83:
			sNombre = '../institucional/pop_3_premio_A.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
			
		case 84:
			sNombre = '../institucional/pop_3_premio_B.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
		
		case 85:
			sNombre = '../institucional/pop_mencion_1.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
		
		case 86:
			sNombre = '../institucional/pop_mencion_2.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
			
		case 87:
			sNombre = '../institucional/pop_mencion_prensa.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
		
							
		case 88:
			sNombre = '../institucional/pop_mencion_easy.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '500';
			break;
			
		case 89:
			sNombre = '../institucional/pop_mencion_churba.html';
			sScroll = 'yes';
			var sWidth = '700';
			var sHeight= '450';
			break;
		
		case 90:
			sNombre = '../institucional/pop_detalle_articulos_1.html';
			sScroll = 'yes';
			var sWidth = '572';
			var sHeight= '500';
			break; 
		}

var anchosc=screen.availWidth;
var altosc=screen.availHeight;
window.open (sNombre, 'ventana', 'left='+((anchosc/2)-parseInt(sWidth)/2)+',top='+((altosc/2)-parseInt(sHeight)/2)+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable='+resiz+',scrollbars=' + sScroll + ',width=' + sWidth + ',height=' + sHeight + '');
}

function randomLayer(iCantidadLayers) {
	var iRandomNumber;
	var iIndex;
	var sEstadoLayer;
	
	iRandomNumber = Math.floor(Math.random()*iCantidadLayers) + 1;
	iCantidadLayers ++;
	
	setPosition(getDivStyle('nece' + iRandomNumber), 'imgpercurva',30,0);
	
	for (iIndex = 1; iIndex < iCantidadLayers; iIndex ++) {
		if (iIndex == iRandomNumber) sEstadoLayer = 'show';
		else sEstadoLayer = 'hide';
		MM_showHideLayers('nece' + iIndex,'', sEstadoLayer);
	}
}

function bajarWallpaper(id) {
	var selector = document.getElementById(id);
	var url = selector.options[selector.selectedIndex].value;
	window.location.href=url;
}

function randomImages() {
	// Array con las imagenes/flash que se desea randomizar.
	var imgUrlArray = new Array( "../images/swf/1_lampara_cesto.swf", "../images/swf/2_florero_tubo_1.swf", "../images/swf/3_lapic_ladrillo.swf", "../images/swf/4_escalera_modular.swf", "../images/swf/5_violetero_tubo.swf", "../images/swf/6_bota_florero.swf", "../images/swf/7_tubo_florero_2.swf", "../images/swf/8_bodega_rejilla.swf", "../images/swf/9_tabla_arrimo.swf", "../images/swf/10_mesita_cono.swf" );
	var firstImgId, secondImgId, thirdImgId;
	
	firstImgId = Math.floor(Math.random()*imgUrlArray.length);
	
	do {
		secondImgId = Math.floor(Math.random()*imgUrlArray.length);
	} while( firstImgId == secondImgId )
	
	do {
		thirdImgId = Math.floor(Math.random()*imgUrlArray.length);
	} while( firstImgId == thirdImgId || thirdImgId == secondImgId )
/*	
	var firstImgObj = document.getElementById("random1");
	var secondImgObj = document.getElementById("random2");
	var thirdImgObj = document.getElementById("random3");

	alert(firstImgId);
	alert(secondImgId);
	alert(thirdImgId);
	alert(imgUrlArray[firstImgId]);
	alert(imgUrlArray[secondImgId]);
	alert(imgUrlArray[thirdImgId]);
	
	alert(firstImgObj.id);

	firstImgObj.value = imgUrlArray[firstImgId];
	secondImgObj.value = imgUrlArray[secondImgId];
	thirdImgObj.value = imgUrlArray[thirdImgId];
*/	
	var flashContainer = document.getElementById("randomFlash");
	flashContainer.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='155' height='146'><param name='movie' value='" + imgUrlArray[firstImgId] + "'><param name='quality' value='high'><embed src='" + imgUrlArray[firstImgId] + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='155' height='146'></embed></object>";

	flashContainer.innerHTML += "<br>";
	flashContainer.innerHTML += "<br>";
	flashContainer.innerHTML += "<br>";
	
	flashContainer.innerHTML += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='155' height='146'><param name='movie' value='" + imgUrlArray[secondImgId] + "'><param name='quality' value='high'><embed src='" + imgUrlArray[secondImgId] + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='155' height='146'></embed></object>";
	
	flashContainer.innerHTML += "<br>";
	flashContainer.innerHTML += "<br>";
	flashContainer.innerHTML += "<br>";
	
	flashContainer.innerHTML += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='155' height='146'><param name='movie' value='" + imgUrlArray[thirdImgId] + "'<param name='quality' value='high'><embed src='" + imgUrlArray[thirdImgId] + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='155' height='146'></embed></object>";
	
	flashContainer.innerHTML += "<br>";
	
}


function AbrirPopup(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
window.open(mypage,myname,settings);
}

function randomPopUp2(url) {
 var iRandomNumber, mypage, myname, w, h;
 iRandomNumber = Math.floor(Math.random()*2);
 
 switch (iRandomNumber) {
  case 0:
   mypage = url +'pop_home';
   myname = '';
   w = 200;
   h = 276;
   break;
  case 1:
	mypage = url +'pop_home_2';
   myname = '';
   w = 200;
   h = 276;
   break;
 }
 
 AbrirPopup(mypage,myname,w,h,'no');
}
