function termsOpener(){
	window.open("terms.html","terms","width=585,height=600,scrollbars=yes,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");
}

function emailOpener(){
	window.open("email_friend.html","email","width=570,height=500,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");
}

function linkOpener(url){
	window.open(url,"Outside_Site","width=600,height=500,scrollbars=yes,toolbar=yes,resizable=yes,top=10,left=10,screenx=10,screeny=10");
}

function valEmailFriend(){
	if(document.emailFriend.name.value==''){
		alert("Please enter your NAME");
		document.emailFriend.name.focus();
		return false;}
		
	if(document.emailFriend.email.value==''){
		alert("Please enter your E-mail address");
		document.emailFriend.email.focus();
		return false;}
		
	if(!validEmail(document.emailFriend.email.value)){
		alert("The entered E-MAIL ADDRESS appears to be incorrect. \r Please re-enter your E-MAIL ADDRESS");
		document.emailFriend.email.focus();
		document.emailFriend.email.select();
		return false;};
		
	if(document.emailFriend.femail.value==''){
		alert("Please enter your friend's E-mail address");
		document.emailFriend.femail.focus();
		return false;}
		
	if(!validEmail(document.emailFriend.femail.value)){
		alert("The entered E-MAIL ADDRESS appears to be incorrect. \r Please re-enter your friend's E-MAIL ADDRESS");
		document.emailFriend.femail.focus();
		document.emailFriend.femail.select();
		return false;};
}

function validEmail(email){

	var invChar = " /:,;";							//Define Invalid Characters
	var atPos = email.indexOf("@",1)
	var atLast = email.lastIndexOf("@")
	var periodPos = email.lastIndexOf(".")
	
	//Look For Invalid Characters
	for(i=0; i<invChar.length; i++)
	{	var badChar = invChar.charAt(i)
		if(email.indexOf(badChar,0) > -1)
			{return false;}
	}
	
	if(atPos == -1){return false;}					//Check For Existence Of "@"
	if(atLast != atPos){return false;}				//Check For ONLY ONE "@"
	if(periodPos == -1){return false;}				//Check For Existence Of "."
	if(periodPos < atPos){return false;}			//Check For "." AFTER "@"
	if(periodPos+3 > email.length){return false;}	//Check For Minimum Of Two Characters AFTER "." 
	
	return true;
}

function fun_opener(picName,sizer){
	url="fun_popup.php?picName="+picName;
	if(sizer=='a'){
		window.open(url,"Fun_Stuff_Popup","width=585,height=500,scrollbars=yes,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");}
	else{
		window.open(url,"Fun_Stuff_Popup","width=585,height=375,scrollbars=yes,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");}
}

function showcase_opener(picName,sizer){
	url="showcase_popup.php?picName="+picName;
	if(sizer=='a'){
		window.open(url,"Showcase_Popup","width=585,height=700,scrollbars=yes,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");}
	else{
		window.open(url,"Showcase_Popup","width=585,height=550,scrollbars=yes,toolbar=no,resizable=no,top=10,left=10,screenx=10,screeny=10");}
}

function randomBottomImage(){
	imgNum=Math.floor(Math.random()*2);
	switch(imgNum){
		case 0:
			img = '<img src="images/bottom_right_wrench.gif" width="55" height="48" alt="" border="0">';
			break;
		case 1: 
			img = '<img src="images/bottom_right_outhouse.gif" width="36" height="48" alt="" border="0">';
			break;
		default:
			img = '<img src="images/bottom_right_outhouse.gif" width="36" height="48" alt="" border="0">';
			break;
	}
	document.write(img);
}
