// JavaScript Document

function toggle( targetId )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
		if (target.style.display == "none")
		{
			target.style.display = "";
		}
		else
		{
			target.style.display = "none";
		}
	}
}

function openPrivacy()
{
	window.open('http://www.polyandproud.com/join/privacy.php','privacy','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=420');
}

function openRatings()
{
	window.open('http://www.polyandproud.com/learn/ratings.php','ratings','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=300,height=420');
}

function openCart(page)
{
	window.open(page,'cart','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=780,height=560');
}

// tell a friend

var initialsubj="Look what I found ..."
var initialmsg="You should see this site!  http://www.polyandproud.com/"
var good;

function checkEmailAddress(field)
{
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
	if (goodEmail)
	{
		good = true;
	}
	else
	{
		alert('Please enter a valid address.');
		field.focus();
		field.select();
		good = false;
	}
}

function mailThisUrl()
{
	good = false
	checkEmailAddress(document.eMailer.email);
	if (good)
	{
		window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
	}
}

