$(document).ready(function(){
$('.buy_it').corner('round 10px');
$('.title1, .border3 .back').corner('round 5px');
 	$('#slides').slides({
				preload: true,
				preloadImage: '../images/loading.gif',
				play: 5000,
				pause: 2000,
				hoverPause: false,
				effect:'slide'
			});
	
$('.box img').mouseover(function(){
$(this).parent().find('.img1').hide();
$(this).parent().find('.img2').fadeIn(2);
});

$('.box a').mouseleave(function(){
$(this).parent().find('.img2').hide();
$(this).parent().find('.img1').fadeIn(500);	
	});


if($('.athumb')[0]){
 $('.athumb').lightBox({
	imageLoading: '../wp-content/themes/Miel/images/loading.gif',
	imageBtnClose: '../wp-content/themes/Miel/images/lightbox-btn-close.gif',
	imageBtnPrev: '../wp-content/themes/Miel/images/lightbox-btn-prev.gif',
	imageBtnNext: '../wp-content/themes/Miel/images/lightbox-btn-next.gif'
});
} 

$('.blockStore .back').click(function(){
//$('html, body').animate({ scrollTop: 0 }, 'slow');
$.scrollTo( '.header', 1500 );
});
$('#lcanadaStores').click(function(){$.scrollTo( '#canadaStores', 1500 );  return false;});
$('#lusaStores').click(function(){$.scrollTo( '#usaStores', 1500 );  return false;});
$('#leuropeStores').click(function(){$.scrollTo( '#europeStores', 1500 );  return false;});
$('#lasiaStores').click(function(){$.scrollTo( '#asiaStores', 1500 );  return false;});
$('#lonlinestores').click(function(){$.scrollTo( '#onlinestores', 1500 );  return false;});

$('#newsletter .txt').focus(function(){
if($(this).val()=='enter your email'){$(this).val('');}
}).blur(function(){if($(this).val()==''){$(this).val('enter your email');}});

$('#s1 .txt').focus(function(){
if($(this).val()=='enter your desired city'){$(this).val('');}
}).blur(function(){if($(this).val()==''){$(this).val('enter your desired city');}});


if($("#searchCity")[0]){
	var villes = '';
$('.ville').each(function(){
villes += $(this).html()+' ';						  
});	
 
 
$("#searchCity").autocomplete(villes.split(" "));	
$("#searchCitySubmit").click(function(){ 
var keyword = $(".ville:contains('"+$('#searchCity').val()+"')");
 
if(keyword[0]){
$.scrollTo( keyword, 1500 ); 
keyword.addClass('activeVille').delay(2000).fadeOut(400).fadeIn(600).fadeOut(300).fadeIn(300);
setTimeout(function(){keyword.removeClass('activeVille')},5000);
}else{
alert('No results found. Please try another search.');}
});

$('#searchCityForm').submit(function(){
	$("#searchCitySubmit").trigger('click');
	return false;		 
});

}

$('.sweet-element').click(function (e) {
		$(this).find('.imgModal').modal();
		return false;
            });






});

