function mycarousel_initCallback(carousel)
	{
		// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};

$(function(){
	$('.no-borderradius #header .cart').corner("top 15px");
	$('.no-borderradius #header .menu').corner("top 15px");
	$('.no-borderradius #header .menu ul ul, .no-borderradius #header .menu ul ul ul').corner("bottom 15px");
	$('.no-borderradius #header .detailContainer .cityDropdown').corner("5px");	
	//$('.no-borderradius #header .menu').corner("top 15px");
	$('.no-borderradius #banners').corner("bottom 5px");	
	$('.no-borderradius #banners .left').corner("bottom 5px");
	$('.no-borderradius #banners .right').corner("bottom 5px");
	$('.no-borderradius .content .box .more a').corner("5px");
	
	$('.no-borderradius #maincol .content').corner("top 5px");
	
	$("ul.nav_menu").supersubs({ 
				minWidth:    14,   // minimum width of sub-menus in em units 
				maxWidth:    28,   // maximum width of sub-menus in em units 
				extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
								   // due to slight rounding differences and font-family 
			}).superfish({
				animation:     {opacity:'show',height:'show'},
				speed:         'fast',
				autoArrows: false,
				dropShadows: false
			});  						
	$('.slider').nivoSlider({
		controlNav:false, pauseTime:8000
	});

	$('.slider1').nivoSlider({
		controlNav:false, pauseTime:8000
	});
	
	$('.gallery').nivoSlider({
		controlNavThumbs:true, 
		pauseTime:8000
	});
	
	//$("select").uniform();
	//$("select").selectmenu();

	$('#testimonials').jcarousel({
			vertical: true,
			scroll: 1,
			easing: "linear",
			auto: 5,
			wrap: "circular",
			buttonNextHTML: null,
			buttonPrevHTML: null,
			initCallback: mycarousel_initCallback
		});	
	$("input[title!='']").hint();
	$(".tip").tipTip();
	//$(".product_grid").mask("Loading...", 500);
	$("a[rel^='prettyPhoto']").prettyPhoto({deeplinking: false, modal:false});
	
	$(".prttyModal[rel^='prettyPhoto']").prettyPhoto({social_tools:'', deeplinking: false, modal:false});
	
	/* $( "#datepicker" ).datepicker(); */
	
	$("#datepicker").live('focus', function(){ 
		$(this).attr("id","datepickerNEWID");                 
		$(this).datepicker();
	});
	
});

/*
inputs : formId	=	id of the form
		msg should be in the following form 
		
		'Failure# formFieldId @@  errorlabel'
*/
function showErrorMessage(formId,msg){
	var errorData,i,errVal;
	errorData=msg.split('#');
	
	$("#"+formId+" :input").each(function(){
		var id= this.id;			
		if(id)
		{
			$("#"+id).removeClass("error");
			$("#li_"+id).removeClass("bg_error");
		}
	});
	
	$("#"+formId+" div").each(function(){									   
		if(this.id.indexOf("error_") != "-1")
		{			
			this.style.display="none";
		}
	});
	first_msg = 0;
	
	var counter		= 0;
	var first_error	= "";
	
	for(i=1; i<errorData.length; i++){			
		errVal = errorData[i].split('@@');			
		if(errVal[0]	!=	"")
		{
			$("#"+errVal[0]).addClass("error");
			$("#li_"+errVal[0]).addClass("bg_error");
			$("#error_"+errVal[0]).css("display","block");			
			$("#error_"+errVal[0]).html(errVal[1]);
			if(first_error == "")
			{				
				counter 	= 1;
				first_error	= errVal[0];
				if(first_error	==	'common')
				{
					first_error	=	'error_'+first_error;
				}
					 
			}
		}
	}
	
} 

