window.addEvent('domready', function() {

	if($('optOutMoreInfoDiv')!=null){
		var optOutSlide = new Fx.Slide('optOutMoreInfoDiv');
		optOutSlide.hide();
		$('moreOptOutInfo').addEvent('click', function(e){
			optOutSlide.slideIn();
			$('moreOptOutInfo').parentNode.removeChild($('moreOptOutInfo'));
		});
	}

});

function popup(filename, width, height)
{
	window.open(filename,"PopUpPage","toolbar=no,height="+height+",width="+width+",screenX=1,screenY=1,resizable,scrollbars");
}

function popupscroll(filename, width, height)
{
	window.open(filename,"PopUpPage","toolbar=no,height="+height+",width="+width+",screenX=1,screenY=1,resizable,scrollbars");
}

var isIE = document.all ? true : false;
var isDOM = document.getElementById ? true : false;
var isNS4 = document.layers ? true : false;


function changeCountry() {
	document.regSignupform.chcountry.value="true";
	document.regSignupform.submit();
}

function choosePricingSelection( id )
{
	document.regSignupform.pricingselectionid.value=id;
}

function getPricingSelection(buttons)
{
	if(buttons==null)
		return "error";
	if(buttons.type=="hidden")
	{
		return buttons.value;
	}
	for (var i = 0; i < buttons.length; i++)
	{
		if (buttons[i].checked)
			return buttons[i].value;
	}
	return buttons[0].value;
}

function handlePricingSelection()
{
	if($("freetrialtext")==null)
		return;
	var ps = getPricingSelection(document.regSignupform.pricingselectionid);
	if (ps == "PS-REG-PSI-99CENTS-1MO" || ps.substr(0,10) == "PS-SUB-PSI")
	{
		$("freetrialtext").style.visibility = "hidden";
	}
	else
	{
		$("freetrialtext").style.visibility = "visible";
	}
}

function setupPage()
{
	daForm = document.regSignupform;
	ccTypeSelect = daForm.ccType;
	handlePricingSelection();
}
