document.observe("dom:loaded", function() {
	$$('#nav li.level0 > a, #footer-bar li a, h2').each(function(index) {
		Cufon.replace(index, { fontFamily: 'Plume DaMa', hover: true });
	});
		
	$$('.page-title h1, .page-title h2,.product-name h1, .product-name h2,.product-options-wrapper-inner2 h1').each(function(index) {
		Cufon.replace(index, { fontFamily: 'Gotham Rounded Light' });
	});
	
	$$('.block .block-title strong').each(function(index) {
		Cufon.replace(index, { fontFamily: 'Plume DaMa' });
	});
	
	$$('.box-up-sell h2').each(function(index) {
		Cufon.replace(index, { fontFamily: 'Plume DaMa' });
	});
	
	$$('.product-options-wrapper-inner-slider h3').each(function(index) {
		Cufon.replace(index, { fontFamily: 'Plume DaMa' });
	});
	
	$$('.product-options .product-options-generate-button .button').each(function(el) {
		el.observe('click',function() {
			var topElement = $('product-options-wrapper');
			var topElementChildren = topElement.childElements();
		
			var firstChild = topElementChildren[1];
			var secondChild = topElementChildren[2];		
	
			new Effect.Move(secondChild.childElements()[0], { x: 0, y: 0, mode: 'absolute',
				afterFinish: function() { 
					secondChild.setStyle({'zIndex':'99'});
				}.bind(this)																													   
			});//,afterFinish:el.up(3).childElements()[2].childElements()[0].setStyle({'zIndex':'99'})}
			new Effect.Move(firstChild.childElements()[0], { x: 0, y: -999, mode: 'absolute'});
		});	
	});
	
	$$('.product-options .product-options-button .button').each(function(el) {
		el.observe('click',function() {
			var topElement = $('product-options-wrapper');
			var topElementChildren = topElement.childElements();
		
			var firstChild = topElementChildren[1];
			var secondChild = topElementChildren[2];		
	
			new Effect.Move(firstChild.childElements()[0], { x: 0, y: 0, mode: 'absolute',
				afterFinish: function() { 
					secondChild.setStyle({'zIndex':'0'});
				}.bind(this)																													   
			});//,afterFinish:el.up(3).childElements()[2].childElements()[0].setStyle({'zIndex':'99'})}
			new Effect.Move(secondChild.childElements()[0], { x: 0, y: -999, mode: 'absolute'});
		});	
	});
});


function resetProductBox() {
	var topElement = $('product-options-wrapper');
	var topElementChildren = topElement.childElements();

	var firstChild = topElementChildren[1];
	var secondChild = topElementChildren[2];		

	new Effect.Move(firstChild.childElements()[0], { x: 0, y: 0, mode: 'absolute',
		afterFinish: function() { 
			secondChild.setStyle({'zIndex':'0'});
		}.bind(this)																													   
	});//,afterFinish:el.up(3).childElements()[2].childElements()[0].setStyle({'zIndex':'99'})}
	new Effect.Move(secondChild.childElements()[0], { x: 0, y: -999, mode: 'absolute'});
}

function toggleMenu(el, over)
{
    if (over) {
        Element.addClassName(el, 'over');
    }
    else {
        Element.removeClassName(el, 'over');
    }
}

