window.addEvent('domready', function()	{

var color = 'ojo';

//mooq = new mooquee($('mooquee'));
roar = new Roar({
	position: 'lower-right'
});

var carrito = new Request.HTML({
	  url: 'ajax/carrito.php'
	, encoding: 'ISO-8859-1'
	, method: 'post'
	, onSuccess: function(tree, elements, html) {
		//html = new String(html);
		q = html.split('::');
		roar.alert(q[0], q[1]);
	}
	, onFailure: function() {
		roar.alert('ERROR', 'no fue posible agregar el articulo');
	}
});

$$('.cart_add').each(function(el, i)	{
	el.addEvent('click', function(e)	{
		carrito.send('id='+this.rel);
		e.stop();
		return false;
	});
	return false;
});

$$('.mas').each(function(el, i)	{
	el.addEvent('mouseover', function(e)	{
		this.src = 'imagenes/bullets/mas_over.gif';
	});
	el.addEvent('mouseout', function(e)	{
		this.src = 'imagenes/bullets/mas.gif';
	});
});
$$('.menos').each(function(el, i)	{
	el.addEvent('mouseover', function(e)	{
		this.src = 'imagenes/bullets/menos_over.gif';
	});
	el.addEvent('mouseout', function(e)	{
		this.src = 'imagenes/bullets/menos.gif';
	});
});

if($chk($('ingresa_btn')))	{
	var ingresa_slide = new Fx.Slide('ingresa_content');
	if(ingresa_hide)	{
		ingresa_slide.hide();
	}
	$$('#ingresa_btn img').each(function(el, i)	{
		el.addEvent('mouseover', function(e)	{
			this.src = 'imagenes/botones/btn_ingresa_over'+color+'.gif';
		});
		el.addEvent('mouseout', function(e)	{
			this.src = 'imagenes/botones/btn_ingresa.gif';
		});
	});
	$('ingresa_btn').addEvent('click', function()	{
		ingresa_slide.toggle();
		$('nick_usua').focus();
		return false;
	});
}


if($chk($('market_btn')))	{
	var market_slide = new Fx.Slide('market_form');
	//alert(market_slide);
	if(market_slide)	{
		market_slide.hide();
	}
	$('market_btn').addEvent('click', function()	{
		market_slide.toggle();
		$('nomb_mark').focus();
		return false;
	});
}


if($chk($('registra_btn')))	{
	var registra_slide = new Fx.Slide('registra_content');
	if(registra_hide)	{
		registra_slide.hide();
	}
	$$('#registra_btn img').each(function(el, i)	{
		el.addEvent('mouseover', function(e)	{
			this.src = 'imagenes/botones/btn_registro_over'+color+'.gif';
		});
		el.addEvent('mouseout', function(e)	{
			this.src = 'imagenes/botones/btn_registro.gif';
		});
	});
	$('registra_btn').addEvent('click', function()	{
		registra_slide.toggle();
		$('nomb_usua').focus();
		return false;
	});
}

if($chk('btn_carrito'))	{
	$$('#btn_carrito img').each(function(el, i)	{
		el.addEvent('mouseover', function(e)	{
			this.src = 'imagenes/botones/btn_carrito_over'+color+'.gif';
		});
		el.addEvent('mouseout', function(e)	{
			this.src = 'imagenes/botones/btn_carrito.gif';
		});
	});
}

if($chk('btn_facebook'))	{
	$$('#btn_facebook img').each(function(el, i)	{
		el.addEvent('mouseover', function(e)	{
			this.src = 'imagenes/botones/btn_facebook_over.gif';
		});
		el.addEvent('mouseout', function(e)	{
			this.src = 'imagenes/botones/btn_facebook.gif';
		});
	});
}

if($chk($('mandala_btn')))	{
	var mandala_slide = new Fx.Slide('mandala_content');
	if(mandala_hide)	{
		mandala_slide.hide();
	}
	$('mandala_btn').addEvent('click', function()	{
		mandala_slide.toggle();
		$('imag_gale').focus();
	});
	return false;
}


$$('a.tipz').each(function(element,index) {
	var content = element.get('title').split('::');
	element.store('tip:title', content[0]);
	element.store('tip:text', content[1]);
});

//create the tooltips
var tipz = new Tips('.tipz',{
	className: 'tipz',
	fixed: true,
	hideDelay: 50,
	showDelay: 50
});

if($chk($('registra_forma')))	{
	formcheck = new FormCheck('registra_forma');
}

//if($chk($('')))	{}

});