window.onload=function(){
	//ajustarImg('librogrande',200);
	//ajustarImg('librochico',80);
}

function elementsByClass(class_name, tag_name)
{

	var as=document.getElementsByTagName(tag_name);
	var arreglo=new Array();
	g=0
	for(i=0;i<as.length;i++)
	{
		if(as[i].className==class_name)
		{
			arreglo[g]=as[i];
			g++;
		}
	}
	
	return arreglo;
}

$(document).ready(		
	
		function(){
		var ventanas = getElementsByClass('marco');
		
		
		for (var x = 0; x < ventanas.length; x++){
			iniciar(ventanas[x].id);
	  	}	
		
		$('#windowClose').click();
		categorias_img = new Image();
		categorias_img.src = "./images/glossyback3.png";
		
		arrow_next = new Image();
		arrow_next.src = "./images/next_over.png";
		arrow_prev = new Image();
		arrow_prev.src = "./images/prev_over.png";
		arrow_nexts = new Image();
		arrow_nexts.src = "./images/snext_over.png";
		arrow_prevs = new Image();
		arrow_prevs.src = "./images/sprev_over.png";
	}	
	
)
		
function iniciar(id)
{		
	$('#'+id).bind(
		'click',
		function() {
			if($('#window').css('display') == 'none') {
				$(this).TransferTo(
					{
						to:'window',
						className:'transferer2', 
						duration: 400,
						complete: function()
						{
							$('#window').show();
						}
					}
				);
			}
			this.blur();
			return false;
		}
	);
	
	$('#windowClose').bind(
	'click',
		function()
		{
			$('#window').TransferTo(
				{
					to:'#'+id,
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
}