// JavaScript Document
$(document).ready(function(){ 
	
	$('.cancel_bid').click(function() {
		if (confirm('Are you sure you want to cancel this bid? This cannot be undone')) {
			var prodid = $(this).val();
			$.ajax({  
				type: "POST",  
				url: "ajax.php",  
				dataType: "text",
				data: "action=delete_bid&prodid="+prodid,  
				success: function(result)
					{ 
						if(result=='1') {
							$('tr#row_'+prodid).fadeOut(300, function() {
								$(this).remove();
								}
							);

							//$('tr#row_'+bidid).remove();
						} else {
							alert(result);
						}
					}  
			});
		}
	});
	
	
	$("form#loginform").submit(function(){
		$.ajax({  
			type: "POST", 
			cache: false, 
			url: "ajax.php",  
			dataType: "text",
			data: ({
				'action':'login',
				'email': $('#email').val(),
				'password':$('#password').val()
			}),  
			success: function(result)
				{ 
					if(result === '1') {
						if($(location).attr('pathname') == '/forgot.php') {
						    window.location.replace("https://www.channons.com/my_home.php");
						} else {
						    location.reload();
						}
					} else {
						alert(result);
					}
				}  
		});
		return false;
	});
	
});
