$(document).ready(function() {
	$('#n1').lavaLamp({
    	fx: 'backout', 
        speed: 700
    });
});
$(document).ready(function(){
	$(".signIn").colorbox({inline:true, href:"#loginbox"});
	$(".forgetPass").colorbox({inline:true, href:"#loginbox2"});
	$(".fadeup").colorbox();
	$(".fadeiframe").colorbox({iframe:true, innerWidth:570, innerHeight:400});
	$(".fadeiframe2").colorbox({width:"80%", height:"80%", iframe:true});
});
$(document).ready(function() {
	$('#sendPass').click(function () {		
		var name = $('input[name=PWname]');
		//Simple validation
		if (name.val()=='') {
			name.addClass('hightlight');
			return false;
		} else name.removeClass('hightlight');

		var data = 'PWname=' + name.val();
		var bname = name.val();
		//disabled all the text fields
		$('.text').attr('disabled','true');	
		$.ajax({
			url: "sendpw.php",						
			type: "GET",				
			data: data,						
			cache: false,				
			success: function (html) {				
				//if sendpw.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.PWform').fadeOut('slow');					
					//show the success message
					$('.done').fadeIn('slow');
					$('.namemsg').html(bname); //show html	

				//if sendpw.php returned 0/false (send mail failed)
				} else alert('ERROR! Please try again later');				
			}		
		});
		return false;
	});	
});
$(document).ready(function() {
	$('#cmdLogin').click(function () {		
		var uname = $('input[name=txtUserID]');
		var upass = $('input[name=txtPassword]');
		//Simple validation
		if (uname.val()=='') {
			uname.addClass('hightlight');
			$('.msg').html('Please enter your USERNAME!');
			//error=1;
			return false;
		} else uname.removeClass('hightlight');
					
		if (upass.val()=='') {
			upass.addClass('hightlight');
			$('.msg').html('Please enter your PASSWORD!');
			//error=1;
			return false;
		} else upass.removeClass('hightlight');

		var data = 'txtUserID=' + uname.val() + '&txtPassword=' + upass.val();
		var nname = uname.val();
		$('.text').attr('disabled','true');	//disabled all the text fields	
		$.ajax({
			url: "signin.php",						
			type: "GET",				
			data: data,									
			success: function (html) {	
				if(html == 'OK') {  
					$('.msg').html('<img src="images/icons/accept.png" alt="success" /> SIGN IN Successful!');	
					$('.loading').show();				
					setTimeout('go_to_private_page()', 3000); // redirect after 3 sec
					} else {  
						var login_response = html;
						$('.msg').html(login_response);
					}						
			}		
		});
		return false;
	});	
});
function go_to_private_page() {
	//window.location = 'index.php';
	//history.go(0)
	window.location.reload(true);
}
