$(document).ready(function() { 
	$("a[@rel=popup]").click(function(){
		popupWindow = window.open(this.href,this.title,'menu=no,toolbar=no,width=500,height=400,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=48,left=48');
		popupWindow.focus()
		return false;
	})
	$('.guidelines_link').click(function(){
				window.open("index.tbapp?page=guidelines","guidelines","menu=no,toolbar=no,width=500,height=500,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=88,left=124");
				return false;
	})
	$("a[@rel=external]").click(function(){
		popupWindow = window.open(this.href,this.title,'width=800,height=600,toolbar=yes,status=yes,location=yes,menubar=yes,directories=yes,resizable=yes,scrollbars=yes');
		popupWindow.focus()
		return false;
	})
	$("a[@rel=board]").click(function(){
		popupWindow = window.open(this.href,this.title,'width=776,height=486,toolbar=no,status=no,location=no,menubar=no,directories=no,resizable=no,scrollbars=no');
		popupWindow.focus()
		return false;
	})

	if($.browser.safari) {
		$(function(){
			$('#birth_date').css("position", "absolute").css("bottom", "22px").css("left", "98px");
		});
	}
});



window.onunload = metrics_end;

// Metrics tracking for pathing, dwell time and drop off
//failing in IE, we need to pause execution before end
function metrics_end() {
	if(document.images['metrics']) {
		var endMetrics = new Image();
		endMetrics.src = document.images['metrics'].src.replace(/(page_id=)([^&]*)/, '$1$2&action=end');  ;
	}
	metrics_end_delay(endMetrics);
}
function metrics_end_delay(endMetrics) {
	return endMetrics.src;
}
// Rules Pop-Up
function rules() {
	window.open("index.tbapp?page=rules","rules","menu=no,toolbar=no,width=450,height=400,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=88,left=124");
}

// Offer Pop-Up
function offer() {
	window.open("index.tbapp?page=offer_popup","offer","menu=no,toolbar=no,width=450,height=400,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=88,left=124");
}

// FAQ Pop-Up
function faq() {
  window.open("index.tbapp?page=contact_form","faq","menu=no,toolbar=no,width=450,height=400,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=48,left=48");
}

//Forgot password
function forgot(session_id) {
  window.opener.location="index.tbapp?page=forgot_form&session_id="+session_id;
  window.close(); 
}	

// Image Security Information Pop-Up
function img_security() {
	window.open("index.tbapp?page=img_security_info","imgsec","menu=no,toolbar=no,width=450,height=340,scrollbars=0,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=132,left=196");
}

// Generic Pop-Up
// ex: <a href="javascript:openThis('http://www.eprize.com');">Click here</a>
function openThis(URL) {
  window.open(URL);
}

// New Window

function openWindow(link) {
  window.open(link, '_blank', 'width=800,height=600,toolbar=yes,status=yes,location=yes,menubar=yes,directories=yes,resizable=yes,scrollbars=yes');
}




// No Cookies Popups

function cookies_faq() {
	window.open("index.tbapp?page=cookies_faq","cookies_faq","menu=no,toolbar=no,width=450,height=400,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=88,left=124");
}




