Cufon.replace('H1.head, #sidebar H2, #banner H1, #main H2, H4', { fontFamily: 'bdcn' });
Cufon.replace('#main H3', { fontFamily: 'helvetica-cn' });

$(document).ready(function() {

	$('#carousel UL').cycle({ 
		 fx: 'scrollHorz',
  
    timeout:  0,
   
		next:   '#carousel .next', 
    	prev:   '#carousel .prev'  
	});
	
	zIndexWorkaround();
	
});

function isIE() {     if(navigator.userAgent.match(/MSIE \d\.\d+/))         return true;     return false; } 

  
function zIndexWorkaround() {     
  // If the browser is IE,     
  if(isIE())     {         
  /* ** For each div with class menu (i.e.,         ** the thing we want to be on top),         */        
    $(".overlay").parents().each(function() {             
      var p = $(this);             
      var pos = p.css("position");              
      // If it's positioned,             
      if(pos == "relative" || pos == "absolute" || pos == "fixed") {                 
	   /*  ** Add the "on-top" class name when the                 
	   ** mouse is hovering over it, and remove                 
	   ** it when the mouse leaves.   */               
       p.hover(function() {                         
	     $(this).addClass("on-top");                     
	   },                     
	   function() {                         
	     $(this).removeClass("on-top");                    
	   });             
	 }         
    });     
	} 
}  


$('#more-posts').live('click',function(){
		var link = this;
		var url = $(link).attr('href');
		//$('#more-products-loader').removeClass('hidden');
		$(link).addClass('hidden');
		$.ajax({
			url: url,
			success: function(response){
				$(link).remove();
				$('#more-products-loader').remove();
				var new_products = $('.products-grid-wrapper',response);
				$('.products-grid-wrapper').append('<div class="products-grid-page" style="display:none;">'+$(new_products).html()+'</div>');
				$('.products-grid-page').slideDown('fast');
				Cufon.replace('#more-products');
			},
			error: function(){
				$(link).removeClass('hidden');
			}
		});
		return false;
	});
