function signUp() {
	var formHtml = '<form method="POST" action="http://mediaopz.com/emailmarketer/form.php?form=1" id="frmSS1" onSubmit="return CheckForm1(this);">';
	formHtml	+= '<input type="hidden" name="format" value="h" />';
	formHtml	+= '<input type="text" name="CustomFields[11]" id="CustomFields_11_1" value="Name" onblur="if(this.value==\'\') this.value=\'Name\';" onfocus="if(this.value==\'Name\') this.value=\'\';"/>';
	formHtml	+= '<input type="text" id="email" name="email" value="Email" onblur="if(this.value==\'\') this.value=\'Email\';" onfocus="if(this.value==\'Email\') this.value=\'\';"/>';
	formHtml	+= '<input type="image" id="submit_button" src="/template/popup/img/clr.gif" width="64" height="28" style="border:none; background:transparent;" onclick="this.submit();" />';
	formHtml	+= '</form>';
	var shadowHeight = jQuery(document).height()+"px";
	
	var shadow = jQuery(document.createElement("div")).attr({"id":"shadow"}).appendTo("body").click(function () {
		//closeOffer();
	}).css({"height":shadowHeight});
	var box = jQuery(document.createElement("div")).attr({"id":"signUp"}).appendTo(shadow);
	var close = jQuery(document.createElement("div")).attr({"id":"closeBox"}).appendTo(box).click(function () {
		closeOffer();
	});
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(400);
	
	window.onresize = positionsignUp;
	positionsignUp();
}

function closeOffer () {
	jQuery("#shadow").fadeOut(400);//.remove();	
}

function positionsignUp() {
	var shadowTop = jQuery(window).height() / 2 - jQuery("#signUp").outerHeight() / 2;
	jQuery("#signUp").css({"margin-top": shadowTop + "px"});
}

function CheckForm1(f) {
	if (document.getElementById('CustomFields_11_1').value == "" || document.getElementById('CustomFields_11_1').value == "Name") {
		closeOffer();
		return false;
	}
	if (f.email.value == "" || f.email.value == "Email") {
		closeOffer();
		return false;
	}
	thankYou();
	return true;
};

function getUrlVars() { 
	var map = {}; 
	var parts = window.location.search.replace(/[?&]+([^=&]+)(=[^&]*)?/gi, function(m,key,value) { map[key] = (value === undefined) ? true : value.substring(1); });
	return map;
}

function thankYou() {
	var formHtml = '<div id="thankYou"><a style="cursor:pointer;" onclick="closeOffer();"><img src="/popup/img/thanks.jpg" width="434" height="441" style="border:0px solid #000;"></a></div>';
	var shadowHeight = jQuery(document).height()+"px";
	
	var shadow = jQuery(document.createElement("div")).attr({"id":"shadow"}).appendTo("body").click(function () {
		//closeOffer();
	}).css({"height":shadowHeight});
	var box = jQuery(document.createElement("div")).attr({"id":"thankYou"}).appendTo(shadow);
	
	jQuery(box).append(formHtml);
	jQuery(shadow).fadeIn(400);
	
	window.onresize = positionThankYou;
	positionThankYou();
}

function positionThankYou() {
	var shadowTop = jQuery(window).height() / 2 - jQuery("#alreadyRegistered").outerHeight() / 2;
	jQuery("#alreadyRegistered").css({"margin-top": shadowTop + "px"});
}

