/* ACORDEON SIMPLE */
var Acordeon = window.Acordeon || {};
Acordeon.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function(identificador) {
			//this.id = identificador;
			var oLi = YUD.getElementsByClassName('filtro','div',identificador);
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();

/* ACORDEON QUE MUESTRA UN ELEMENTO A LA VEZ */
/*
var Acordeon1 = window.Acordeon1 || {};
Acordeon1.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	var id = "";
	var idactual = "";
	return {
		init : function(identificador) {
			id = identificador;
			var oLi = YUD.getElementsByClassName('filtro','div',identificador);
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			
			if(idactual != "")
			{
				// cerrar el actual primero
				YUD.addClass(idactual, 'close');
				var oEl = idactual.parentNode.getElementsByTagName('ul')[0];
	
				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}

			// collapse			
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				idactual = this;
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		},
		closeAll: function() {
			var oLi = YUD.getElementsByClassName('filtro','div',this.id);
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();
*/

/* MAS INFORMACION */
var DED = window.DED || {};
DED.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function() {
			var oLi = YUD.getElementsByClassName('filtro','div','aco_masinfo');
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ocultar';
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ver';

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();


/* SERVICIOS ADICIONALES */
var DEDservicios = window.DEDservicios || {};
DEDservicios.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function() {
			var oLi = YUD.getElementsByClassName('filtro','div','aco_servicios');
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ocultar';
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ver';

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();

/* VENTAJAS EXCLUSIVAS */
var DEDventajas = window.DEDventajas || {};
DEDventajas.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function() {
			var oLi = YUD.getElementsByClassName('filtro','div','aco_ventajas');
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ocultar';
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ver';

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();


/* INFORMACION EXTRA */
var DEDnotas = window.DEDnotas || {};
DEDnotas.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function() {
			var oLi = YUD.getElementsByClassName('filtro','div','aco_notas');
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ocultar';
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ver';

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();

/* MENUS ESPECIALES */
var DEDmenus = window.DEDmenus || {};
DEDmenus.example = function() {
	var YUD = YAHOO.util.Dom;
	var YUE = YAHOO.util.Event;
	var YUA = YAHOO.util.Anim;
	var onMenuCollapse = new YAHOO.util.CustomEvent('menu collapse');
	var onMenuOpen = new YAHOO.util.CustomEvent('menu open');
	var last = [];
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera') != -1);
	var isIE = (ua.indexOf('msie') != -1 && !isOpera);
	return {
		init : function() {
			var oLi = YUD.getElementsByClassName('filtro','div','aco_menus');
			for ( var i=0, j=oLi.length; i<j; ++i ) {
				YUE.on(oLi[i], 'click', this.collapse, oLi[i].parentNode.offsetHeight);
			}
			YUD.batch(oLi, function(oEl) {
					if ( YUD.hasClass(oEl, 'close') ) {
						oEl.parentNode.getElementsByTagName('ul')[0].style.height = '0';
					}
				}
			);
		},
		collapse : function(e, iH) {
			last.push(this);
			if ( last.length > 3 ) {
				last.shift();
			}
			if ( YUD.hasClass(this, 'close') ) {
				YUD.removeClass(this, 'close');
				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ocultar';
				oEl.style.height = '0';
				var iHeight = (isIE ? parseInt(iH)-22 : parseInt(iH)-25);
				var attributes = {
					height : {
						from : 0,
						to : iHeight
					}
				};
				var anim = new YAHOO.util.Anim(oEl, attributes, 0.5, YAHOO.util.Easing.easeOut);
				anim.animate();
				onMenuOpen.fire();
			}
			else {
				YUD.addClass(this, 'close');

				var oEl = this.parentNode.getElementsByTagName('ul')[0];
				var switchMostrar = this.parentNode.getElementsByTagName('span')[0];
				switchMostrar.innerHTML = 'Ver';

				var attributes = {
					height : {
						to : 0
					}
				};
				var anim = new YUA(oEl, attributes, 0.5, YAHOO.util.Easing.easeIn);
				anim.animate();
				onMenuCollapse.fire();
			}
		}
	};
}();


function inicioAcordeon(){
	
	YAHOO.util.Event.onContentReady('aco_masinfo',DED.example.init, DED.example, true);
	YAHOO.util.Event.onContentReady('aco_servicios',DEDservicios.example.init, DEDservicios.example, true);
	YAHOO.util.Event.onContentReady('aco_ventajas',DEDventajas.example.init, DEDventajas.example, true);
	YAHOO.util.Event.onContentReady('aco_notas',DEDnotas.example.init, DEDnotas.example, true);
	YAHOO.util.Event.onContentReady('aco_menus',DEDmenus.example.init, DEDmenus.example, true);

	//YAHOO.util.Event.onContentReady('contentprecio',DEDprecio.example.init, DEDprecio.example, true);
	//YAHOO.util.Event.onContentReady('contentcategoria',DEDcategoria.example.init, DEDcategoria.example, true);
	//YAHOO.util.Event.onContentReady('contentdisponibilidad',DEDdisponibilidad.example.init, DEDdisponibilidad.example, true);
}
