 $j(document).ready(function() {
    /////////////////////////////////
     //back to top
      $j("#contact").validate({
                rules:{
                    name:{
                        required:true,
                        minlength: 5
                    },
                   	Email: {
                   	    required:true,
    				    email:true
    			     },
                    phone:{
                        minlength:10,
                        number:true
                    },
                    content:{
                        required:true
                    },
                    confcaptcha:{
                        required:true,
                        minlength:5,
                        equalTo:'#captcha'
                    }
                },
                messages:{
                    name:{
                        required: "Vui lòng nhập tên",
    				    minlength: "Tên đăng nhập ít nhất phải 5 ký tự"
                    },
                   	Email: {
    				    required: "Vui lòng nhập địa chỉ mail",
    				    email:"Địa chỉ mail không hợp lệ"
                    },
                    phone:{
                        minlength:"Số điện thoại không đủ ký tự",
                        number:"Số điện thoại không hợp lệ"
                    },
                    content:"Chưa có nội dung",
                    confcaptcha:{
                        required:"Vui lòng nhập mã xác nhận",
                        minlength:"Mã xác nhận không đủ",
                        equalTo:"Mã xác nhận không đúng"
                        }
                }
            });
    /////////////////////////////////////////////////////////////////
    //$('.footer').append('<div id="top">Back to Top</div>');
	$j(window).scroll(function() {
            if($j(window).scrollTop() != 0) {
                $j('#backtotop').fadeIn();
            } else {
                $j('#backtotop').fadeOut();
            }
           });
           $j('#backtotop').click(function() {
            $j('html, body').animate({scrollTop:0},500);
           });
    //$j('.image').corner('10px');
    ////////////////////////////////
    $j("#nav li").hover(function(){ 

                $j(this).find('ul:first').css({visibility: "visible",display: "none",filter:"alpha(opacity=80)"}).show(200);
                //$j("#nav li:first").corner("top 5px");
                },function(){ 
                 $j(this).find('ul:first').css({visibility: "hidden"}); 
                });
    //$j("#nav li:first").corner("top 5px 0px");
    $j("#nav li:first").css("border-left","none");
    /////////////////////////////////
    
    //$j(".nav-bar").corner("top 5px");
    //$j(".wrap").corner("top 5px");
    /////////////////////////////////
    $j('.slideshow').cycle({
		fx:     'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
    $j('#slider').nivoSlider({ 
                pauseTime:5000, 
                pauseOnHover:false,
                directionNav:false, //Next & Prev
                controlNav:false //1,2,3...
                });
    /////////////////////////images show//////////////////////////////
     var myTimer;
	    myTimer = setTimeout("showNext()", 3000);
		showNext(); //loads first image
        $j('#thumbs li').bind('click',function(e){
        	var count = $j(this).attr('rel');
        	showImage(parseInt(count)-1);
        });
   
    /////////////////////////end images show//////////////////////////
    
 });

