function specialOffer() {
	var formHtml = '<form method="POST" id="popform" action="/sirrichard/popup/includes/add_email.php" onsubmit="checkForm(this)">';
	formHtml	+= '<input type="hidden" name="format" value="h" />';
	formHtml	+= '<input type="text" id="email_bar" name="email" value="EMAIL" onblur="if(this.value==\'\') this.value=\'EMAIL\';" onfocus="if(this.value==\'EMAIL\') this.value=\'\';"/>';
	formHtml	+= '<input type="image" id="email_button" src="popup/img/clr.gif" width="220" height="30" 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":"shadowBox"}).appendTo(shadow);
	var close = jQuery(document.createElement("div")).attr({"id":"closeBox"}).appendTo(box).click(function () {
		closeOffer();
	});
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(600);
	
	window.onresize = positionShadowBox;
	positionShadowBox();

//	alert("end1");
}

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

function positionShadowBox() {
	var shadowTop = jQuery(window).height() / 2 - jQuery("#shadowBox").outerHeight() / 2;
	jQuery("#shadowBox").css({"margin-top": shadowTop + "px"});
}
/*
function checkForm(form) {
//	alert("check1");
	if(form.email.value == '' || form.email.value == "EMAIL") {
		alert('Please enter your email address');
//		specialOffer();
		closeOffer();
		return false;
	}
	return true;
	
//	alert(form.email.value);
}
*/


function before_you_vote_method() {
	var formHtml = '<form method="POST" id="before_you_vote" action="/popup/includes/check_form.php">';
	formHtml	+= '<input type="hidden" name="format" value="h" />';
	formHtml	+= '<input type="hidden" name="page" value="';
	formHtml	+= document.getElementById('page').innerHTML;
	formHtml	+= '" />';
	formHtml	+= '<input type="text" id="firstname_bar" name="firstname" value="First Name" onblur="if(this.value==\'\') this.value=\'First Name\';" onfocus="if(this.value==\'First Name\') this.value=\'\';"/>';
	formHtml	+= '<input type="text" id="lastname_bar" name="lastname" value="Last Name" onblur="if(this.value==\'\') this.value=\'Last Name\';" onfocus="if(this.value==\'Last Name\') this.value=\'\';"/>';
	formHtml	+= '<input type="text" id="email_bar" name="email" value="Email" onblur="if(this.value==\'\') this.value=\'Email\';" onfocus="if(this.value==\'Email\') this.value=\'\';"/>';
	formHtml	+= '<input type="image" id="submit_before" src="/popup/img/clr.gif" width="220" height="30" onclick="this.submit();" />';
	formHtml	+= '</form>';
	var shadowHeight = jQuery(document).height()+"px";
	
	var shadow = jQuery(document.createElement("div")).attr({"id":"shadow"}).appendTo("body").click(function () {
	}).css({"height":shadowHeight});
	var box = jQuery(document.createElement("div")).attr({"id":"before_you_vote"}).appendTo(shadow);
	var close = jQuery(document.createElement("div")).attr({"id":"close_before_you_vote"}).appendTo(box).click(function () {
		closeOffer();
	});
	
	jQuery(box).append(formHtml);
	jQuery(shadow).fadeIn(600);
	
	window.onresize = position_before_you_vote;
	position_before_you_vote();

}

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

function check_your_email() {
	var formHtml = '<a onclick="check_your_email_close()"><img src="/popup/img/clr.gif" width="406" height="372" style="cursor:pointer;"></a>';
	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":"thank_you"}).appendTo(shadow);
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(600);
	
	window.onresize = position_check_your_email;
	position_check_your_email();
}

function position_check_your_email() {
	var shadowTop = 170;
	jQuery("#thank_you").css({"margin-top": shadowTop + "px"});
}

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


function vote() {
//	var formHtml = '<a onclick="vote_close()"><img src="/popup/img/clr.gif" width="406" height="336" style="cursor:pointer;"></a>';
	var formHtml = '<form method="POST" id="vote" action="/popup/includes/record_vote.php">';
	formHtml	+= '<input type="hidden" name="format" value="h" />';
	formHtml	+= '<input type="hidden" name="page" value="';
	formHtml	+= document.getElementById('page').innerHTML;
	formHtml	+= '" />';
	formHtml	+= '<input type="image" id="submit_vote" src="/popup/img/clr.gif" width="406" height="336" 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":"thank_you_voting"}).appendTo(shadow);
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(600);
	
	window.onresize = position_vote;
	position_vote();
}

function position_vote() {
	var shadowTop = 170;
	jQuery("#thank_you_voting").css({"margin-top": shadowTop + "px"});
}

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

function already_voted() {
	var formHtml = '<a onclick="already_voted_close()"><img src="/popup/img/clr.gif" width="406" height="336" style="cursor:pointer;"></a>';
	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":"sorry"}).appendTo(shadow);
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(600);
	
	window.onresize = position_already_voted;
	position_already_voted();
}

function position_already_voted() {
	var shadowTop = 170;
	jQuery("#sorry").css({"margin-top": shadowTop + "px"});
}

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


function goldenPopup() {
	var formHtml = '<a onclick="closegoldenPopup()"><img src="img/clr.png" width="538" height="480" style="cursor:pointer;"></a>';
	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":"golden"}).appendTo(shadow);
	
	jQuery(box).append(formHtml);
	
	jQuery(shadow).fadeIn(600);
	
	window.onresize = positionShadowBox;
	positiongoldenPopup();

//	alert("end1");
}

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

function positiongoldenPopup() {
	var shadowTop = 120;
	jQuery("#golden").css({"margin-top": shadowTop + "px"});
}

