// JavaScript Document
var dopopup		= true;
var alertmsg	= null;

$(function() {	
	alertmsg = $("#alertmsg").html();
	
	window.onbeforeunload = exitPopup; // COMMENT OUT TO DISABLE EXIT POPUP
    
	$("a").click( function(event) {
		dopopup = false;
	});
	
	$("form").submit( function(event) {
		dopopup = false;
	});
	
});

function exitPopup() {
	
	if(dopopup) {
		dopopup = false;
		
		window.location.href = 'http://fastsafepills.com'; 

		alert('MagnaRXTRA erection herbal pills were created by a board-certified urologist who has treated over 70,000 patients with erectile problems, Dr. George Aguilar, M.D. is also a member of the College of Urology, director of over 40 urologists, and a past resident of his state society of urologists. Over seven years ago he made the amazing discovery now known as the world\'s number one male performance pill. Now his new advanced, extra-strength formula is even more powerful and faster acting with exclusive Tri-Level Release. Millions sold. Doctor endorsed! Easy, Fast, Effective!'+"\n\nhttp://www.fastsafepills.com");

		//alertmsg = "STOP! STOP! STOP!\n\nNone of our competitors offer:\n\n";
		//alertmsg += "1. 90 DAY guarantee\n2. MagnaRXTRA sold in 5,000 stores and 38 countries world-wide\n3. DISCREET billing and shipping, saying iMERCHANT only\n4. 24/7 customer service with EMAIL and PHONE SUPPORT w/DIRECT NUMBER\n5. STRONG ENCRYPTION - Completely safe\n\n"
		alertmsg = "";
		//alertmsg += "SPECIAL! SPECIAL! SPECIAL!\n\nMagnaRXTRA Penis enlargement patch sells for $64.95 MagnaRXTRA Penis pills sell for $64.95.\nAlways NATURAL ingredients!\n\n";
		alertmsg += "SPECIAL! SPECIAL! SPECIAL!\n\nAlways NATURAL ingredients!\n\n";
		//alertmsg += "HUNDREDS of THOUSANDS of UNITS of MagnaRXTRA already SOLD!\n\nAll major credit cards accepted - Visa, Mastercard, Discover, AMEX Completely SAFE, EFFECTIVE, PRIVATE, SECURE\n\n15 YEARS ONLINE! Order here: "+website_url+"order\n\nClick on order link NOW!";
		alertmsg += "HUNDREDS of THOUSANDS of UNITS of MagnaRXTRA already SOLD!\n\nAll major credit cards accepted - Visa, Mastercard, Discover, AMEX Completely SAFE, EFFECTIVE, PRIVATE, SECURE\n\nClick on order link NOW!";
		alertmsg += "\n\nhttp://www.fastsafepills.com";


		return alertmsg;


		return "*****************************************************\n\n"+alertmsg+"\n\n*****************************************************";
	}
}
$(function() {
	$('#fulfill-your-destiny').submit( function() {
		return checkSideForm();
	});
});

function checkSideForm () {	
	if( $('#fyd-firstname').val() == '' ) {
		alert('Please fill in your name.');
		$('#fyd-firstname').focus();
		return false;
	}
	if( $('#fyd-email').val() == '' ) {
		alert('Please fill in your email address.');
		$('#fyd-email').focus();
		return false;
	} else {
		if(window.validEmail) {
			if( !validEmail( $('#fyd-email').val() ) ) {
				alert('Please provide a valid email address (example: your-name@some-domain.com).');
				$('#fyd-email').focus();
				return false;
			}
		}
	}
	return true ;
}
