$(document).ready(function(){
	var sectionss = $("a#close");
		sectionss.click(function(){
                    $('#content').slideUp();
					$('#content_close').slideUp();
          });
		//loginform
    $("#loginform").submit(function()
	{
	//remove all the class add the messagebox classes and start fading
	$("#msgbox").removeClass().addClass('messagebox').text('Validating!').fadeIn(1);
	//check the username exists or not from ajax
	$.post("/login_go.asp",{
		   usrlogin:$('#usrlogin').val(),
		   usrpass:$('#usrpass').val(),
		   rand:Math.random() } ,
				function(data){
					if(data=='yes') //if correct login detail 
						{
							$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
							{
 								//add message and change the class of the box and start fading
							  	$(this).html('Logging in!').addClass('messageboxok').fadeTo(900,1,
                  					function() {
			  	  	     			//reload the page if user is logged in correctly
						 			window.location.reload();
		  								});
									});
	  							}
				  else
				  	{
	  					$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
						{
		  				//add message and change the class of the box and start fading
		  				$(this).html('No permission!').addClass('messageboxerror').fadeTo(900,1);
					});
        	  	}
       		});
       		return false;//not to post the  form physically
		});
	
        
		// headerslider
		$('#logo').cycle({ 
			fx:     'fade', 
			speed:   300, 
			timeout: 3000, 
			pause:   1 
		});
		
		//tabs
		$('#tabs div').hide(); 
		$('#tabs div:first').show(); 
		$('#tabs ul li:first').addClass('active'); 
		$('#tabs ul li a').click(function(){ 
		$('#tabs ul li').removeClass('active'); 
		$(this).parent().addClass('active'); 
		var currentTab = $(this).attr('href'); 
		$('#tabs div').hide(); 
		$(currentTab).show(); 
		return false; 
		});	
	});