function signUp() {
	var win = window.open('../app/signup.php', "signupWindow", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=640,height=800");
	win.focus();
}
function updateMyInfo() {
	var win = window.open('../app/updatemyinfo.php', "updateMyInfoWindow", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=640,height=800");
	win.focus();
}
function requestQuote() {
	var win = window.open('../app/request_quote.php', "quoteWindow", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=640,height=800");
	win.focus();	
}
function viewQuote(order_no) {
	var win = window.open('../app/view_quote.php?order_no=' + order_no, "quoteviewWindow", "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=640,height=800");
	win.focus();		
}
function logIn(form, success_message, fail_message) {
	new Ajax.Request('../app/login_process.php', {
		method:'post',
		parameters: $('loginwin').serialize(true),
		onSuccess : function(transport) {
			var response = transport.responseText;
			if (response == 'SUCCESS') {
				alert(success_message);
				if (form.saveid.checked) {
					createCookie('saved_login_email', form.login_email.value, 30);
				} else {
					createCookie('saved_login_email', '', -100);	
				}
				document.location.reload();				
			} else {
				alert(fail_message);
				form.reset();
			}
		}
		
	});
}
function logOut(success_message, fail_message) {
	new Ajax.Request('../app/login_process.php', {
		method:'post',
		parameters: {mode : 'logout'},
		onSuccess : function(transport) {
			var response = transport.responseText;
			if (response == 'SUCCESS') {
				alert(success_message);
				document.location.reload();				
			} else {
				alert(fail_message);
			}
		}
	});		
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+escape(value)+expires+"; path=/;";
}
