/* Run for the Cure - www.runforthecure.org/
   popup.js
--------------------------------------------------------- */
////////// ie6
var ua = navigator.userAgent.toLowerCase();
var ie6 = ua.indexOf('msie 6.0')>0 && ua.indexOf('opera')<0 && ua.indexOf('safari')<0 ? true : false;

////////// Small Window (with black transparent background)
function popin(url,size) {
	$('#popframe').removeClass().addClass(size);
	
	var width = document.documentElement.clientWidth;
	var pwidth = $('#pop').width();
	
	var height = $('body:first').height();
	var wheight = document.documentElement.clientHeight;
	var pheight = $('#pop').height();
	var sheight = document.body.scrollTop  || document.documentElement.scrollTop;
	
	$('#overlay').height(height).width(width).css({'opacity':'0.8'}).fadeIn('slow');
	$('#overlay').click(function() {
		popout();
	});
	$('#pop').css({
		"top": wheight/2-pheight/2+sheight, 
		"left": width/2-pwidth/2
		
	}).fadeIn('slow');
	
	if (ie6) $("select").css("visibility","hidden");
	
	// iframe detect
	n = $("#sponsor-form").length;
	if (n==0) frames[0].location.href = url;
	else frames[1].location.href = url;

}
function popout() {
	$('#pop').fadeOut('slow');
	$('#overlay').fadeOut('slow',function() {
		if (ie6) $("select").css("visibility","visible");
		
		// iframe detect (for schedule payment iframe)
		n = $("#sponsor-form").length;
		if (n==0) frames[0].document.body.innerHTML = "";
		else frames[1].document.body.innerHTML = "";
	});
	$(".popcontents").css("background","transparent");
}