
	var lotd_html = '';
	var newsletterCookieName = 'lookoftheday';
var get_cookie_contents = getCookie(newsletterCookieName);

	if (get_cookie_contents == 'alreadyOffered') {
		var lotd_html = "<div class='clear'></div>";
	}
	if (get_cookie_contents != 'alreadyOffered') {
		var lotd_html = "<form method='post' name='myForm' onsubmit='return validate(this);' action='http://ebm.cheetahmail.com/r/regf2'><input type='hidden' name='n' value='1'><input type='hidden' name='aid' value='146317287'><input type='hidden' name='id' value='%%id%%'><input type='hidden' name='a' value='2'><input type='hidden' name='re' value='http://www.instyle.com/instyle/about/newsletter/thankyou'><input type='hidden' name='sub' value='419761701'><div class='signup'>			<h4>Get Look of the Day E-mail</h4>			Be the first to see what the stars are wearing &mdash; every day. Subscribe to our Look of the Day e-mail.			<table class='join' border='0' cellpadding='0' cellspacing='0'>			<tr>				<td><input class='txtbox' name='email' type='text' onFocus='clearText(this);' value='enter your e-mail' title='Enter your email address to subscribe to our Look of the Day e-mail.' />&nbsp;</td>				<td><input class='btnaction' value='submit' name='Submit' type='submit'></td>			</tr>			</table>		</div></form>";
	}
function validate(myForm) {
	var flag = 0;
  	e = myForm.elements;
	for (i=0; i < myForm.length; i++) {
		if ((e[i].name == 'email') && (ValidEmail(e[i].value) == false)) {
			alert('Please provide a valid email address.');
			e[i].focus();
			e[i].select();
			return false;
		}
	}
	var set_cookie_contents = setCookie(newsletterCookieName, 'alreadyOffered');
	
	/*
	var newPath = 'https://www.timeinc.net/instyle/secure/sweeps/lookoftheday/index.html' + '?email_address=' + myForm.email.value;
	msgWindow=open(newPath, 'window2', 'height=500,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes'); return false;
	if (msgWindow.opener == null) msgWindow.opener = self;
	*/
	 return true;
}

function ValidEmail(s) {
    var Count;
    var s2;

    // empty or blank email
    if (EmptyString(s) == true) return (false);
	// email with whitespace
	if (s.indexOf(' ') != -1) return (false);
    // email without @
    if (s.indexOf('@') == -1) return (false);
    // email with @ as the 1st char
    if (s.indexOf('@') == 0) return (false);
    // email with @ as the last char
    if ((s.indexOf('@')+1) == s.length) return (false);
    // email without .
    if (s.indexOf('.') == -1) return (false);
    // email with . as the 1st char
    if (s.indexOf('.') == 0) return (false);
    // email with . as the last char
    if ((s.indexOf('.')+1) == s.length) return (false);

    // Now look for the first . after the first @
    // s2 = string after the first @
    s2=s.substring(s.indexOf('@')+1,s.length);
    // email without a dot after the first @
    if (s2.indexOf('.') == -1) return (false);
    // email dot right after the first @
    if (s2.indexOf('.') == 0) return (false);
    return (true);
}

function EmptyString(s) {
    var Count;
    var Nblank = 0;
    if (s.length == 0) return (true); // empty string
    // count the number of blank chars
    for (Count = 0; Count < s.length; Count++) {
            if (s.charAt(Count) == ' ') Nblank++;
    }
    if (Nblank == s.length)
            return (true);
    else
            return (false);
}

function setCookie (name, value) {
	document.cookie = name + "=" + escape(value);
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function clearText(theField) {
	theField.value = "";
}