// Yourdays.com Login Script
// Authored by Joshua Peterson

// Checks to see if the 'registration' cookie set when the user logs into their My Ovulation Calendar
// account is set; and if it is removes login form and displays button that when clicked takes the user
// back to their calendar.

$(document).ready(function(){
						   
if ($.cookie('YDS')==null) {
	$('#ydContentLogin').append("<form action=\"ovucal/checklogin.php\" method=\"post\"></form>");
	$('#ydContentLogin form').append("<h3>MY OVULATION CALENDAR</h3>");
	$('#ydContentLogin form').append("<input type=\"text\" id=\"ydLoginUsername\" name=\"login\" value=\"\" maxlength=\"75\" />")
	$('#ydContentLogin form').append("<input type=\"password\" id=\"ydLoginPassword\" name=\"password\" value=\"\" maxlength=\"20\" />");
	$('#ydContentLogin form').append("<input type=\"submit\" id=\"ydLoginSubmit\" name=\"validate\" value=\"LOGIN\" />");
	$('#ydContentLogin form').append("<input type=\"button\" id=\"ydForgotPass\" name=\"forgotPass\" value=\"FORGOT P/W?\" onclick=\"javascript:window.location='forgot.htm';\" />");
	$('#ydContentLogin form').append("<input type=\"button\" id=\"ydRegister\" name=\"regnewaccount\" value=\"REGISTER\" onclick=\"javascript:window.location='register.htm';\"  />");
	} else {
	$('#ydContentLogin').append("<form action=\"ovucal/logout.php\" method=\"post\" id=\"logout\"></form>");
	$('#ydContentLogin form').append("<h3>MY OVULATION CALENDAR</h3>");
	$('#ydContentLogin form').append("<input type=\"button\" id=\"ydGoToCalendar\" name=\"calendarLink\" value=\"VIEW MY OVULATION CALENDAR\" onclick=\"javascript:window.location='ovulation-calendar.htm';\" />");
	$('#ydContentLogin form').append("<input type=\"submit\" id=\"ydRegister\" value=\"LOGOUT\" />");
	}
						   });