<!--
var name = 'home';
var myNewsletter = 0;
var myFloater;
var checkOK	= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`)(_-0123456789 $*@\.\:\/\,";
var numOnly	= "0123456789";
var myTITLE	= "none";
var pattern1	=/'/g;
var pattern2	=/\"/g;
var ScrnSize	= screen.availWidth;
var myLEFT		= 0;
var myTOP			= 0;
//'

maximizeWin() 

function maximizeWin() { 
 if (ScrnSize >= 1024) { /* check for 1024 x 768 resolution or greater */ 
  myLeft = 10
 } else { 
  if (ScrnSize < 1024) { /* check for 800 x 600 resolution or smaller */ 
   myLeft = 50
  } 
 } 
}

function CheckData(myString) {
	var mitch
	mitch = myString.replace(pattern1,"`");
	mitch = mitch.replace(pattern2,"&#8221;");
	return mitch;
}

function clear_textbox(myBox) {
//alert("Datafile is; "+utilVar);
	myBox.value = "";
}

function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.asp","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}

function popup(myFile,myLoc) {
	//alert("myFile: "+myFile+"\nmyLoc: "+myLoc);
	myH = 700
	myW = 750
	myFloater = window.open("","popup","scrollbars=yes,status=no,width=" + myW + ",height=" + myH + ",screenX=100,screenY=30,left=100,top=30");
	myFloater.location.href = "PopUp.htm?f="+myFile+"&l="+myLoc;
}

function MortgagePopup() {
	myFloater = window.open("","MortgageCalculator","scrollbars=yes,status=no,width=550,height=600,screenX=200,screenY=30,left=200,top=30");
	myFloater.location.href = "../calculator/MortgagePopup.html";
}

function NewsPopup(h,w,fname,p,fldname,butt) {
	var myNum = 2;
	//alert("height: "+h+"\nwidth: "+w);
	//if (h.len > 0) {
		myH = h+20;
	//} else {
	//	myH = 600
	//}
	//if (w.len > 0) {
		myW = w+20;
	//} else {
	//	myW = 700
	//}
	if (fname == "icons") {
		myFloater = window.open("","Newsletter","scrollbars=yes,status=no,width=" + myW + ",height=" + myH + ",screenX=450,screenY=30,left=450,top=30");
		myFloater.location.href = "../include/ShowIcons.htm?icon="+p+"&f="+fldname+"&b="+butt;
		return false;
	} else {
		myFloater = window.open("","Newsletter","scrollbars=yes,status=no,width=" + myW + ",height=" + myH + ",screenX=200,screenY=30,left=200,top=30");
		myFloater.location.href = "../NewsPopup.htm?file="+myNewsletter+"&fname="+fname;
	}
}

function GetNewFileNumber(fname) {
	myNewsletter = document.form1.myFile.options[document.form1.myFile.selectedIndex].value;
	myTable      = document.form1.which_tbl.options[document.form1.which_tbl.selectedIndex].value;
	mySubject    = document.form1.subject.text = document.form1.subject.value;
	//alert(myNewsletter+"\n"+fname);
	document.anchors[0].href = "javascript: myNewsletter="+myNewsletter+"; NewsPopup(600,700,'"+fname+"')";
	document.anchors[1].href = "../include/MailingListSend.htm?file="+myNewsletter+"&fname="+fname+"&table="+myTable+"&subject="+mySubject;
	document.anchors[2].href = "../include/EditNewsletter.htm?file="+myNewsletter+"&fname="+fname;
}

function ValidateEmail(theField){
	var emailValid  = (false);
	var pat = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/gi;
	var arrEmail = new Array();
	
	var strEmail = theField.value;
	//alert(strEmail);
	arrEmail = strEmail.match(pat);
	
	if (arrEmail == null){
		myAlerts += "The email address you entered [" + theField.value + "] is invalid.\nIt must contain a \'.\' and an \'@\'.\n\n"
		//theField.focus();
		return (false);
	} else return (true);
}

function ValidateEmail2(email1,email2){
	if (email2.value != "") {
		if (email1.value != email2.value){
			myAlerts += "Email addresses do not match.\n"
			email2.value = "";
			email2.focus();
			return (false);
		} else {
			return (true);
		}
	}
}

function ValidatePassword(pass1){
	if (pass1.value == ""){
		myAlerts += "Please enter a password. 5 to 10 Characters.\n"
		pass1.focus();
		return (false);
	} else return (true);
}

function ValidatePasswords(pass1,pass2){
	var passValid = true;
	
	if (pass1.value == ""){
		myAlerts += "Please enter a password. 5 to 10 Characters.\n"
		pass1.focus();
		passValid = false;
	} else {
		if (pass1.length < 5){
			myAlerts += "Password must be at least 5 Characters.\n"
			pass1.focus();
			passValid = false;
		}
		if (pass1.length > 10){
			myAlerts += "Password must be no more than 10 Characters.\n"
			pass1.focus();
			passValid = false;
		}
		if (pass1.value != pass2.value){
			myAlerts += "Passwords do not match.\n"
			pass2.value = "";
			pass1.focus();
			passValid = false;
		}
	}
	if (!passValid){
		return (false);
	} else return (true);
}

function ValidateNames(fname,lname){
	var namesValid = true;
	
	if (fname.value == ""){
		myAlerts += "Please enter a First name.\n"
		fname.focus();
		namesValid = false;
	} else namesValid = ValidateText(fname);
	if (lname.value == ""){
		myAlerts += "Please enter a Last name.\n"
		lname.focus();
		namesValid = false;
	} else namesValid = ValidateText(lname);
	 
	if (!namesValid){
		return (false);
	}
}

function ValidateText(myString){
	var allValid = true;
	var checkStr = myString.value;

	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length) {
			allValid = false;
			break;
		}
	}
	if (!allValid) {
		myAlerts += "Please enter only letter and numeric characters in the " + myString.name + " field.\n"
	//myString.focus();
		return (false);
	} else return (true);
}

function Form_Validator(theForm){
	var Valid = false;
	myAlerts = "";

	if (theForm.value == "Send me my password"){
		Valid = ValidateEmail(document.forms[1].emailaddress);
	} else if (theForm.value == "Login"){
		Valid = ValidateEmail(document.forms[1].emailaddress);
		Valid = ValidatePassword(document.forms[1].password);
	} else if (theForm.name == "Form0"){
		Valid = ValidateEmail(theForm.email);
	} else if (theForm.name == "Form1"){
		//alert("you made it here.");
		if (theForm.custname.value != ""){
			if (theForm.custname.value == " "){
				myAlerts += "Please enter your name.\n"
			} else
			Valid = ValidateText(theForm.fname);
		}
		if (theForm.myEmail.value != ""){
			if (theForm.myEmail.value == " "){
				myAlerts += "Please enter your email address.\n"
			} else
			Valid = ValidateEmail(theForm.myEmail);
		}
		Valid = ValidatePasswords(theForm.pass1,theForm.pass2);
		alert(theForm.interests);
	} else if (theForm.name == "Form2"){
		//alert("you made it here.");
		if (theForm.custname.value == "" || theForm.custname.value == " " || theForm.custname.value == "Your Name"){
			//alert("custname: ["+theForm.custname.value+"]");
			myAlerts += "Please enter your name.\n"
		} else {
			Valid = ValidateText(theForm.custname);
		}
		if (theForm.email.value == "" || theForm.email.value == " " || theForm.email.value == "Your Email"){
			//alert("email: ["+theForm.email.value+"]");
			myAlerts += "Please enter your email address.\n"
			} else
			Valid = ValidateEmail(theForm.email);

		if (theForm.comments.value == "" || theForm.comments.value == " " || theForm.comments.value == "Your Comments"){
			//alert("comments: ["+theForm.comments.value+"]");
			myAlerts += "Please enter some comments.\n"
		}
	} else if (theForm.name == "Form3" || theForm.name == "Form4"){
		Valid = ValidatePassword(theForm.pass1);
	} else if (theForm.name == "Form5"){
		Valid = ValidateMyDate(theForm.myDate);
	} else if (theForm.name == "Form7"){
		Valid = ValidateSitters(theForm);
	} else if (theForm.name == "Form8"){
		Valid = ValidateChildren(theForm);
		Valid = ValidateEmail(theForm.emailaddress);
		Valid = ValidateEmail2(theForm.emailaddress,theForm.newemailaddress);
		Valid = ValidatePassword(theForm.password);
		if (theForm.newpassword.value != ""){
			Valid = ValidatePasswords(theForm.password,theForm.newpassword);
		}
		for (var i = 0;  i < theForm.length;  i++){
			if (theForm.elements[i].name != "emailaddress" && theForm.elements[i].name != "newemailaddress" && theForm.elements[i].name != "password" && theForm.elements[i].name != "newpassword" && theForm.elements[i].name != "newzipplus4" && theForm.elements[i].name != "newRedCross" && theForm.elements[i].name != "newstate" && theForm.elements[i].name != "newnotes") {
				if (theForm.elements[i].value == ""){
					myAlerts += "You cannot have an empty field for " + theForm.elements[i].name +".\n";
				}
				//alert("theForm.elements["+i+"].value: "+theForm.elements[i].value);
				Valid = ValidateText(theForm.elements[i]);
			} else if (theForm.elements[i].name == "newnotes"){
				var h
				var checkStr = theForm.elements[i].value;
				for (h = 0;  h < checkStr.length;  h++) {
					//
				}
				//alert("h: "+h+"\n");
				if (h >= 255) {
					myAlerts += "Please limit your notes to 255 characters. Your current note is " + h +" characters long.\n";
					//alert("theForm.elements["+i+"].name: "+theForm.elements[i].name);
				}
			}
		}
	} else if (theForm.name == "Form9"){
		Valid = ValidateNames(theForm.firstname,theForm.lastname);
		Valid = ValidateEmail(theForm.emailaddress);
	} else if (theForm.name == "Form10"){
		Valid = ValidateRegNum(theForm.regnum);
	} else if (theForm.name == "Form11"){
		Valid = ValidatePasswords(theForm.pass1,theForm.pass2);
		if (Valid) {
			theForm.password.value = theForm.pass1.value;
		}
		if (theForm.age.value == "yyyy/mm/dd") {
			myAlerts += "age must contain a value.\n";
		}
		for (var i = 0;  i < theForm.length;  i++){
			if (theForm.elements[i].name == "state" || theForm.elements[i].name == "redCross" || theForm.elements[i].name == "origpassword" || theForm.elements[i].name == "pass1" || theForm.elements[i].name == "pass2" || theForm.elements[i].name == "zipplus4" || theForm.elements[i].name == "age" || theForm.elements[i].name == "regnum" || theForm.elements[i].name == "reference" || theForm.elements[i].name == "submit" || theForm.elements[i].name == "myID" || theForm.elements[i].name == "myType" || theForm.elements[i].name == "password" || theForm.elements[i].name == "children" || theForm.elements[i].name == "email" || theForm.elements[i].name == "emailaddress") {
				//Do nothing
			} else {
				if (theForm.elements[i].value == "" || theForm.elements[i].value == "$" || theForm.elements[i].value == "Experience Details:") {
					myAlerts += theForm.elements[i].name + " must contain a value.\n";
				}
			}
		}
	}
	
	if (myAlerts != "") {
		myAlerts += "\nPlease try again.\n\n";
		alert(myAlerts);
		return (false);
	} else {
		return (true);
	}
}	

function zzz(){
  var t = document.Form1.elements.length
  var c = 0;
  if (document.Form1.all.checked){
		c = 1;
  }
  for (var i=0; i < t; i++){
		if (document.Form1.elements[i].title == "lists") {
	    document.Form1.elements[i].checked = c;
		}
	}
}

function yyy(){
	if (document.Form1.all.checked){
		document.Form1.all.checked = 0;
	}
}

function DeleteObject(fileType,whichOne,adminName) {
	var returnValue, myMsg;
if (fileType == "Newsletter" && whichOne == "1") {
		myMsg = adminName+", you cannot DELETE "+fileType+" number "+whichOne+" .\n\nRemember, this "+fileType+" is delivered to all new subscribers of your "+fileType+".\n\nFeel free to edit and enhance this letter."
		returnValue = alert(myMsg);
		return false;
	} else {
		myMsg = adminName+", are you sure you want to;\n\nDELETE "+fileType+" number "+whichOne+" ?\n\nRemember, this operation cannot be undone."
		if (fileType == "Subject") {
			myMsg += "\n\nNOTE: You will still be able to add a new section to this newsletter at a later time."
		} else if (fileType == "Newsletter") {
			myMsg += "\n\nNOTE: Deleting this newsletter will also DELETE all of the subjects."
		}
		returnValue = confirm(myMsg);
		return returnValue;
	}
}
//-->

