function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.hover(function() {
    	carousel.options.smer = 'right';
        carousel.options.animation = 800;
        carousel.options.auto = 0.00001;
        carousel.startAuto();
    }, function() {
    	carousel.stopAuto();
    	carousel.options.auto = 0;
    });

    carousel.buttonPrev.hover(function() {
        carousel.options.smer = 'left';
        carousel.options.animation = 800;
        carousel.options.auto = 0.00001;
        carousel.startAuto();
    }, function() {
    	carousel.stopAuto();
    	carousel.options.auto = 0;
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.options.auto = 0;
    }, function() {
    	carousel.options.auto = 0;
    });
};


$(document).ready(function() { 
  
 ajx_form('#regmail','#box2_btm', true, false);
 ajx_form('#friendmail','#box3_btm', true, false);
 ajx_cart('.cart_form','#mk');
 
 $("#obj_form").validate();
 $("#reg_form").validate();
 $("#lostpass_form").validate();
 
 $('#toplink').click(function(){
 	$.scrollTo( "#top", 600);
 });
 
  		
 function ajx_form(fname, tid, rebind, modalMsg){
 	$(fname).submit(function() { 
   		$(this).ajaxSubmit({
 		target: tid,
 		success: function(){
 			if(modalMsg){
 		    	showMsg('msg',300,90,2000);
 		    }
 		    if(rebind){
 				ajx_form(fname, tid, rebind, modalMsg);
 			}
 		}
 	});
 	return false;});
 }
 
 function ajx_cart(fname, tid){
 	$(fname).submit(function() { 
   		var rel = $(this).attr("target");
   		$(this).ajaxSubmit({
 		url: "ajx_cart.php",
 		target: tid,
 		beforeSubmit: function(){tb_remove(false)},
 		success: function(){
 			document.getElementById(rel).value='';
 			showMsg('msg',500,35,2000);
 		}
 	});
 	return false;});
 }
  
 function showMsg(div,width,height,time){
 	tb_show('', '#TB_inline?reload=false&height='+height+'&width='+width+'&inlineId='+div+'&modal=true', null, true)
	setTimeout(function(){tb_remove(false)}, time);
 }
 
});
