
$.fn.clearForm = function() {

    // iterate each matching form

    return this.each(function() {

        // iterate the elements within the form

        $(':input', this).each(function() {

            var type = this.type, tag = this.tagName.toLowerCase();

            if (type == 'text' || type == 'password' || tag == 'textarea')

                this.value = '';

            else if (type == 'checkbox' || type == 'radio')

                this.checked = false;

            else if (tag == 'select')

                this.selectedIndex = -1;

        });

    });
}


$(document).ready(function() {


$('.scrolltotop').click(function(event){

$('html, body').animate({scrollTop:0}, 'slow');
event.preventDefault();
});

$(".nav-buttons a").html("");

$('a.thumb-wrapper').lightBox(); // Select all links with lightbox class
    $('#slider').cycle({
        fx: 'scrollLeft', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout:5000,
        speed:1500
    });

    $('.panel-click').click(function(event){
        event.preventDefault();
        idToShow=this.id.split("-")[1];
        idToHide=this.id.split("-")[1];
        $(".panel-click").removeClass("on");
        $(this).addClass("on");
        $(".panel.active").fadeOut("fast",function(){
            $(".panel.active").removeClass("active");
            $("#"+idToShow).fadeIn();
            $("#"+idToShow).addClass("active");

        });
      
        
    });

    $("#contactform").validate({
        rules: {
            name: "required",
            
            email: {
                required: true,
                email: true
             
            }
        },messages: {
			name: "Name is required",
			lastname: "Please enter your lastname",
			username: {
				required: "Please enter a username",
				minlength: "Your username must consist of at least 2 characters"
			},
			password: {
				required: "Please provide a password",
				minlength: "Your password must be at least 5 characters long"
			},
			confirm_password: {
				required: "Please provide a password",
				minlength: "Your password must be at least 5 characters long",
				equalTo: "Please enter the same password as above"
			},
			email: "Valid email address required",
			agree: "Please accept our policy"
		}

    });


    $("#reset").click(function(event){
        event.preventDefault();
        $("#contactform").clearForm();
    
     
    });
    $("#send").click(function(event){
        
        

        });

});
