var labelToInput = {

	init: function() {
	
		jQuery('.labelvalue').each(function(){
			jQuery(this).css("display","none");
			var txt = jQuery(this).text();
			var chpsTxt = jQuery(this).next().children(':text, :password');
			
			if(chpsTxt.attr('type') == "text") {
				chpsTxt.val(txt);
				chpsTxt.focus(function(e){if(jQuery(e.target).val() == txt) jQuery(e.target).val('')});
				chpsTxt.blur(function(e){if(jQuery(e.target).val() == '') jQuery(e.target).val(txt)});
			}
			
			if(chpsTxt.attr('type') == "password") {
				var newInput = jQuery('<input type="text" />');
				jQuery(newInput).attr('class',chpsTxt.attr('class'))
				jQuery(newInput).attr('id',chpsTxt.attr('id'));
				jQuery(newInput).val(txt);
			
				var oldInput = chpsTxt.clone();
				jQuery(chpsTxt).replaceWith(newInput);
				newInput.focus(function(e){ jQuery(e.target).replaceWith(oldInput); oldInput.focus();});
			}
		});
		
	}

}

var DecorateProductList = {
	init: function() {
		
		var currentTallest = 0;
		
		$$('.products-grid li').each( function(elmt) {
			Event.observe(elmt, 'mouseover', DecorateProductList.colorIt);
			Event.observe(elmt, 'mouseout', DecorateProductList.uncolorIt);
		});
		
	},
	
	colorIt: function(event) {
		$(this).addClassName('over');
	},
	
	uncolorIt: function(event) {
		$(this).removeClassName('over');
	}
}

jQuery(document).ready(function() {

	DecorateProductList.init();
	
	labelToInput.init();
	
/*if(jQuery('.fb_elements').length > 0)
{
	//-- Lightbox product page
	jQuery("a.fb_elements").fancybox({
		'overlayOpacity':'0.6',
		'overlayColor':'#000',
		'titleShow':'false'	
	});
}*/
jQuery("a#guide_tailles_link").fancybox({'hideOnContentClick': true});
jQuery("a#guide_tailles_link2").fancybox({'hideOnContentClick': true});
	
if(jQuery('#bloc1ProductHome').length > 0)
{
	jQuery('#bloc1ProductHome').bxSlider({
		pager: false,
		mode: 'horizontal',
		controls: true,
		auto: false,
		pause: 4000,
		displaySlideQty: 3,
    	moveSlideQty: 2
	});
}

if(jQuery('#bloc2ProductHome').length > 0)
{
	jQuery('#bloc2ProductHome').bxSlider({
		pager: false,
		mode: 'horizontal',
		controls: true,
		auto: false,
		pause: 4000,
		displaySlideQty: 3,
    	moveSlideQty: 2
	});
}


if(jQuery('#homeSlider').length > 0)
{

	if(jQuery('#homeSlider').find('li').size()>1)
	{
		jQuery('#homeSlider').bxSlider({
			auto: true,
			controls: false,
			pager: true,
			pause: 3500
		});
	}
}

  // product options
  jQuery('.product-shop').each( function() {
    jQuery('.tabs-header a').click( function() {
      var $link = jQuery(this);
      if ($link.parent().hasClass('active')) {
        return false;
      }

      var id = $link.attr('class');
      jQuery('#' + id).show().siblings().hide();
      $link.parent().addClass('active').siblings().removeClass('active');

      return false;
    });
  });

  // home slider
  /*jQuery('.cms-home .col-main').slides({
    container: 'std',
    //pause: 2500,
    play: 5000
  });*/
});

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

