function init()
{
	var ruta=document.location.href;
	for(var i=0;i<ruta.length;i++)
	{
		if(ruta.charAt(i)=="_")
		var temp=i;
	}
	ruta=ruta.substr(temp+1);
	if(ruta=="rustico.php" || ruta=="laton.php" || ruta=="publicitarias.php")
		mostrar();
}
function mostrar()
{
	document.getElementById("boton2").style.visibility="visible";	
}

var codigos=new Array();
codigos[2]=new Array(740219, 740765, 740114, 740222, 740224, 740130, 740141, 740118, 740124, 740756, 740127, 740405, 740942, 740185, 740217, 740225, 740294, 740119, 740108, 740117, 740334, 740592, 740665, 740229, 740144, 740216, 740226, 740515, 740399, 740182, 740162, 740158, 740398, 740402, 740416);
codigos[3]=new Array(740404, 740526, 740614, 740531, 740186, 740496, 740492, 740169, 740166, 740172, 740178, 740180, 740167, 740371, 740228, 740652, 740409, 740465, 740293, 740466, 740212, 740220, 740211, 740525, 740253, 740254, 740255, 740256, 740257, 740258, 740259, 740276, 740296, 740411, 740412);
codigos[4]=new Array(740414, 740413, 740865, 740866, 740290, 740286, 740285, 740347, 740757, 740348, 740379, 740852, 740327, 740326, 740328, 740600, 740333, 740368, 740357, 740246, 740589, 740354, 740336, 740349, 740358, 740345, 740346, 740343, 740356, 740380, 740700, 740766, 740396, 740688, 740274);
codigos[5]=new Array(740689, 740262, 740264, 740267, 740430, 740265, 740263, 740309, 740287, 740266, 740320, 740300, 740422, 740418, 740308, 740313, 740304, 740323, 740302, 740620, 740306, 740331, 740355, 740736, 740325, 740332, 740324, 740342, 740330, 740728, 740760, 740720, 740374, 740367, 740248);
codigos[6]=new Array(740487, 740594, 740842, 740472, 740485, 740863, 740561, 740847, 740671, 740767, 740729, 740859, 740759, 740755, 740629, 740554, 740860, 740858, 740682, 740683, 740568, 740738, 740545, 740839, 740684, 740523, 740674, 740640, 740653, 740662, 740641, 740648, 740642, 740647, 740643);
codigos[7]=new Array(740645, 740649, 740651, 740646, 740545, "B-180", "B-181", "B-184", "B-185", 740879, "B-193", "B-197", "B-202", "B-239", 740892, 740885, 740961, 740893, 740926, 740900, 740887, 740886, 740952, 740953, 740240, 740918, 740134, 740135, 740833, 740139, 740148, 740140, 740149, 740426, 740136);
codigos[8]=new Array(740137, 740251, 740138, 740250, 740819, 740196, 740282, 740424, 740281, 740142, 740818, 740835, 740479, 740578, 740223, 740129, 740427, 740199, 740478, 740831, 740832, 740482, 740197, 740132, 740171, 740624, 740193, 740636, 740295, 740830, 740143, 740610, 740151, 740145, 740439);
codigos[9]=new Array(740163, 740429, 740425, 740190, 740493, 740230, 740639, "D-144", 740177, 740451, 740625, 740271, 740500, 740277, 740820, 740165, 740273, 740439, 740289, 740291, 740855, 740329, 740698, 740335, 740631, 740340, 740506, 740632, 740376, 740455, 740634, 740373, 740591, 740468, 740458);
codigos[10]=new Array(740613, 740678, 740764, 740762, 740829, 740630, 740834, 740810, "D-225", 740888, 740891, "D-230", 740875, 740871, 740870, 740898, "D-241", 740916, 740949, 740909, 740192, 740189, 740787, 740188, 740131, 740431, 740123, 740433, 740436, 740807, "G-033", 740785, 740260, 740432, 740437);
codigos[11]=new Array(740786, 740794, 740198, 740237, 740125, 740435, 740434, 740803, 740805, "G-064", 740154, 740152, 740442, 740583, 740268, 740914, 740773, 740438, 740243, 740244, 740768, 740154, "P-4091", 740580, 740441, 740776, 740578, 740555, 740446, 740443, 740556, 740769, "P-4195", 740947, "P-4203");
codigos[12]=new Array(740777, 740447, 740448, 740771, 740579, 740779, 740781, 740780, "P-4276", 740417, 740440, "P-4287", 740344, 740790, 740791, "P-4304", 740783, 740822, 740782, 740586, 740801, 740800, 740872, "P-4330", 740802, 740795, 740873, 740876, "P-6168", 740869, "P-9050", 740927, 740868, 740928, 740261);

function chapas(num)
{
	var numini=35*(num-1)+1;
	var numfin=numini+34;
	var x=1;
	for(var i=numini;i<=numfin;i++)
	{
		document.getElementById("celda"+x).src="img/chapas/"+i+".jpg";
		document.getElementById("celda"+x).name=codigos[num][x-1];
		x++;
	}
}
function laton(nombre,fin)
{
	var modificador=0;
	if(fin>35 && fin <71)	modificador=35;
	if(fin>71)				modificador=70;
	for(var i=1;i<=35;i++)
	{	
		if((i+modificador)<=fin)
		{
			document.getElementById("celda"+i).src="img/laton/"+nombre+"/"+(i+modificador)+".jpg";
			document.getElementById("celda"+i).style.display="block";
		}
		else
			document.getElementById("celda"+i).style.display="none";
	}
}

function rustico(nombre,fin)
{
	var modificador=0;
	if(fin>35)
		modificador=35;
	for(var i=1;i<=35;i++)
	{	
		if((i+modificador)<=fin)
		{
	   		document.getElementById("celda"+i).src="img/rustico/"+nombre+"/"+(i+modificador)+".jpg";
			document.getElementById("celda"+i).style.display="block";
		}
		else
			document.getElementById("celda"+i).style.display="none";
	}
}

var offsetxpoint=-80 
var offsetypoint=-280 
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext,num)
{
	if(num==0)
		tipobj.innerHTML="<img src="+thetext+" style='border:1px solid #cdbc3c'>"
	else
		tipobj.innerHTML="<img src="+thetext+"><div id='codigo'>cod."+num+" - 20x30cm.</div>"
	enabletip=true
	return false
}
function hideddrivetip()
{
	enabletip=false
	tipobj.style.visibility="hidden"
}
function positiontip(e)
{
	if (enabletip)
	{
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

		if (rightedge<tipobj.offsetWidth)
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
			tipobj.style.left="5px"
		else
			tipobj.style.left=curX+offsetxpoint+"px"
		if (bottomedge<tipobj.offsetHeight)
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
		else
			tipobj.style.top=curY+offsetypoint+"px"
		tipobj.style.visibility="visible"
	}
}
document.onmousemove=positiontip
