$(document).ready(function() {

	$('#contact_btn')
		.click(function() {
			$('#contact_top').slideToggle("slow");
			return false;
		});

	$('#contact_close')
		.click(function() {
			$('#contact_top').slideUp('slow');
			return false;
		});

	$('#rss a')
		.append('<img src="/images/nge_rss_v2.0.png" alt="RSS Icon" '
			+ 'class="rss_icon" />');

	getTwitters('twitter-status', { 
		id: 'nategreen03', 
		count: 4, 
		enableLinks: true, 
		clearContents: true,
		template: '%text%'
	});

	$(".thumbbox").thumbBox({
		"previewWidth" : 50,
		"previewHeight" : 50,
		"fullWidth" : 524,
		"showCaption" : false
	});

  	$('a[rel="external"]').attr('target', '_blank');

    if ( $.cookie('nge_newsletter')==undefined )
    {
        $overlay = $('<div>')
			.addClass("thumbbox-overlay")
			.css({"opacity":"0"})
			.bind("click", function(){
					$(".thumbbox-overlay, .thumbbox-main")
						.fadeOut(300, function(){ $(this).remove(); });
				})
			.appendTo('body')
			.fadeTo(300, .5),
		$thumbbox = $('<div>')
			.addClass("thumbbox-main")
			.css({
				"top":$(window).scrollTop()+100+"px",
				"width":"400px",
				"height":"auto",
				"margin-left":"-200px"
			})
			.html('<div class="thumbbox-main-modal"><h1>Become Your Own Hero</h1>'
                    + '<p>Put your name and email in below to download the '
                    + 'report and sign up for the Nate Green Experience '
                    + 'newsletter.</p>'
					+ '<ul><li>5 Ways Your Training Program Is Screwing You</li>'
                    + '<li>17 Tips for Getting the Life You Want</li></ul>'
                    + '<p>PLUS: You\'ll be entered in a monthly drawing for a '
                    + 'limited edition Humblecock&trade; t-shirt!</p>'
                    + '<form action="http://www.getresponse.com/cgi-bin/add.cgi"'
                    + 'method="post" accept-charset="UTF-8">'
					+ '<fieldset id="overlay-nl-capture">'
                    + '<label for="subscriber_name">Name</label>'
                    + '<input id="subscriber_name" name="subscriber_name" '
                    + 'type="text" value="" />'
                    + '<label for="subscriber_email">Email</label>'
                    + '<input id="subscriber_email" name="subscriber_email" '
                    + 'type="text" value="" />'
                    + '<input type="submit" value="Sign Up" />'
                    + '<input type="hidden" name="error_url" id="error_url" '
                    + 'value="" />'
                    + '<input type="hidden" name="confirmation_url" '
                    + 'id="confirmation_url" value="http://thenategreenexperience.com#signedup" />'
                    + '<input type="hidden" name="campaign_name" '
                    + 'id="campaign_name" value="nategreenfitness" />'
                    + '<input type="hidden" name="custom_ref" id="custom_ref" '
                    + 'value="" />'
                    + '<span class="no-spam"><strong>Spam Free Zone</strong> Your '
                    + 'email address will not be shared or solicited</span>'
                    + '</fieldset></form>'
                    + '<a href="#" class="thumbbox-close-btn">CLOSE</a></div>')
			.bind("click", function(){
					$(".thumbbox-overlay, .thumbbox-main")
						.fadeOut(300, function(){ $(this).remove(); });
					return false;
				})
			.appendTo("body");
        $(".thumbbox-main-modal input").bind("click", function(e){e.stopPropagation();});
        $.cookie('nge_newsletter', 1, { "path":"/", "expires":365 });
    }

  	if(document.location.hash=="#signedup")
  	{
  		$overlay = $('<div>')
			.addClass("thumbbox-overlay")
			.css({"opacity":"0"})
			.bind("click", function(){
					$(".thumbbox-overlay, .thumbbox-main")
						.fadeOut(300, function(){ $(this).remove(); });
				})
			.appendTo('body')
			.fadeTo(300, .5),
		$thumbbox = $('<div>')
			.addClass("thumbbox-main")
			.css({
				"top":$(window).scrollTop()+100+"px",
				"width":"400px",
				"height":"auto",
				"margin-left":"-200px"
			})
			.html('<div class="thumbbox-main-modal"><h1>Your Reports Are on the Way!</h1>'
					+'<p>You made a great choice. To show my appreciation, here\'s a '
					+'picture of a hot chick.</p><p><img '
					+'src="/images/nge_subscribed-hot-girl.jpg" alt="A Hot Chick" /></p>'
					+'<h2>Thank You - Please Confirm Your Email Address!</h2><p>Thank you '
					+'for your registering to receive your special report, <strong>"17 Tips '
					+'For Getting the Life You Want"!</strong></p><p>To maintain a high '
					+'quality mailing list, we need to verify that you are a REAL personal '
					+'with a REAL email address (and not a robot), so we\'ll need you to '
					+'confirm your email address by clicking on the link in the email we '
					+'just sent to the address you signed up with.</p><p>Once you confirm '
					+'your email address by clicking on the link in that email, you will '
					+'have immediate access to download your free stuff.</p><p>If you do '
					+'not see the email, please be sure to check your spam/junk folder as '
					+'the confirmation emails are sometimes mistakenly filtered as such.</p>'
					+'<p>Also, if you have any kind of spam blocking software or internet '
					+'service provider (ISP) filters, add nategreenfitness@getresponse.com '
					+'to your list of approved senders (also known as a "Whitelist" or '
					+'"safelist").</p><p>Because of spam problem these days, less and less '
					+'email actually reaches its intended destination due to over-aggressive '
					+'spam blocking measures. If you subscribed from a work email, you might '
					+'want to consider re-subscribing from your home or personal account, '
					+'since corporate email security is more likely to block our email '
					+'messages...which you don\'t want to miss.</p><p>For support, email '
					+'<a href="mailto:answers@ennuidesign.com">answers@'
					+'ennuidesign.com</a></p><a href="#" class="thumbbox-close-btn">CLOSE</a></div>')
			.bind("click", function(){
					$(".thumbbox-overlay, .thumbbox-main")
						.fadeOut(300, function(){ $(this).remove(); });
					return false;
				})
			.appendTo("body");
  	}

});

var formId = "contact";
var reqFields2 = new Array('cf_m','cf_n','cf_e');
if ( document.getElementById(formId) ) {
  prettyForms(formId, reqFields2);
}