/*
Copyright 2004, Active Media Architects, Inc. - www.activema.com
Usage of these scripts is limited to their original intent as developed and deployed for diyhomesellers.com by Active Media Architects. 
Copying, selling or distributing of these scripts, in whole or in part, is strictly prohibited.
*/



	///////////////////////////////////////
	// Frame Buster
	///////////////////////////////////////

if (window != window.top)
  top.location.href = location.href;



	///////////////////////////////////////
	// Header Rolls
	///////////////////////////////////////

function imgovernav(imgname){

if(imgovernav.arguments.length == 2)
{
	imgovernav.arguments[0].src = imgover.arguments[1];
}
else
{
	imgovernav.arguments[0].src = "images/navigation/UnderNav.gif";
}
}
//imgname.src="images/navigation/UnderNav.gif" }
function imgoutnav(imgname){
imgname.src="images/1x1spacer.gif" }


	///////////////////////////////////////
	// Row-Over Effect
	///////////////////////////////////////
	// Blue: #E1EBFA
	// Tan: #E6E2DA

	function mouseOverWhite(i) {
		i.style.backgroundColor='#E6E2DA';
	}
	function mouseOutWhite(i) {
		i.style.backgroundColor='#FFFFFF';
	}
	
	function mouseOverGray(i) {
		i.style.backgroundColor='#E6E2DA';
	}
	function mouseOutGray(i) {
		i.style.backgroundColor='#F2F2F2';
	}
	


	///////////////////////////////////////
	// On-Click-Pop-Center
	///////////////////////////////////////
	// Requires "onClick="NewWindow(this.href,'title','400','300','no');return false;"" in the A HREF tag
	// Example: <a href="doc.html" onClick="NewWindow(this.href,'title','400','300','no');return false;">LINK</a>

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=yes'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}




	///////////////////////////////////////
	// Auto-Select Field
	///////////////////////////////////////
	// Requires "onLoad=ready()" in the BODY tag
	// Example: <body onLoad=ready()>
	// Requires form name to match where it reads "form" in script
	// Example: <form name="form">
	// Requires form field name to match where it reads "field" in script
	// Example: <input name="field">

function ready(){document.form.field.focus();}


	///////////////////////////////////////
	// Form Validation
	///////////////////////////////////////



function validateID(form) {
	return (
				 checkSelect(form.elements["id"],"V","","Please enter the DIY Home Number you're looking for.",false));
}

function validateSignin(form) {
	return (
				 checkSelect(form.elements["loginemail"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["loginemail"],false) &&
				 checkSelect(form.elements["loginemail"],"V","joe@example.com","Please supply valid E-mail Address.",false) &&				 
				 checkSelect(form.elements["password"],"V","","Please enter your Password.",false));
}

function validateSub(form) {
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter Your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply valid E-mail Address.",false));
}

function validateEmailme(form) {
	return (
				 checkSelect(form.elements["recipient"],"V","","Please enter the Recipient's Name.",false) &&
				 checkSelect(form.elements["to"],"V","","Please enter the Recipient's E-mail.",false) &&
				 checkEmail(form.elements["to"],false) &&
				 checkSelect(form.elements["to"],"V","joe@example.com","Please supply valid E-mail Address.",false) &&
				 checkSelect(form.elements["comments"],"V","","Please enter the Message to Recipient.",false) &&
				 checkSelect(form.elements["sender"],"V","","Please enter Your Name.",false) &&
				 checkSelect(form.elements["from"],"V","","Please enter Your E-mail.",false) &&
				 checkEmail(form.elements["from"],false) &&
				 checkSelect(form.elements["from"],"V","joe@example.com","Please supply valid E-mail Address.",false));
}

function validateSignup(form)
{
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
			    checkSelect(form.elements["password1"],"V","","Please create a Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please confirm your Password.",false) && 
				 checkPasswords(form.elements["password1"], form.elements["password2"], "Password do not match, please re-enter them") &&
				 checkSelect(form.elements["listing_contact"],"V","","Please enter the Contact Name.",false) &&
				 checkSelect(form.elements["address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["price"],"V","","Please enter a price for the property.",false) &&
				 checkSelect(form.elements["beds"],"V","","Please select the number of bedrooms.",false) &&
				 checkSelect(form.elements["baths"],"V","","Please select the number of baths for the property.",false) &&
				 checkSelect(form.elements["year_built"],"V","","Please select the year built.",false) &&
				 checkSelect(form.elements["squareFeet"],"V","","Please enter the square feet of the property.",false) &&
				 checkSelect(form.elements["description"],"V","","Please enter a property description.",false));
	
}


function validateContact(form) {
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["time"],"V","","Please tell us what's the best time to contact you.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["interest"],"V","","Please let us know your area of interest.",false));
}


function validateSignup2(form)
{
	return (
				 checkSelect(form.elements["listing_contact"],"V","","Please enter the Contact Name.",false) &&
				 checkSelect(form.elements["address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["price"],"V","","Please enter a price for the property.",false) &&
				 checkSelect(form.elements["beds"],"V","","Please select the number of bedrooms.",false) &&
				 checkSelect(form.elements["baths"],"V","","Please select the number of baths for the property.",false) &&
				 checkSelect(form.elements["year_built"],"V","","Please select the year built.",false) &&
				 checkSelect(form.elements["squareFeet"],"V","","Please enter the square feet of the property.",false) &&
				 checkSelect(form.elements["description"],"V","","Please enter a property description.",false));
	
}

function validateSignupOpenHouse(form)
{
	return (
				 checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
			    checkSelect(form.elements["password1"],"V","","Please create a Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please confirm your Password.",false) && 
				 checkPasswords(form.elements["password1"], form.elements["password2"], "Password do not match, please re-enter them") &&
				 checkSelect(form.elements["address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["price"],"V","","Please enter a price for the property.",false) &&
				 checkSelect(form.elements["beds"],"V","","Please select the number of bedrooms.",false) &&
				 checkSelect(form.elements["baths"],"V","","Please select the number of baths for the property.",false) &&
				 checkSelect(form.elements["squareFeet"],"V","","Please enter the square feet of the property.",false) &&
				 checkSelect(form.elements["shortDesc"],"V","","Please enter a short headline.",false));
	
}
function validateSignupOpenHouse2(form)
{
	return (
				 checkSelect(form.elements["address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["price"],"V","","Please enter a price for the property.",false) &&
				 checkSelect(form.elements["beds"],"V","","Please select the number of bedrooms.",false) &&
				 checkSelect(form.elements["baths"],"V","","Please select the number of baths for the property.",false) &&
				 checkSelect(form.elements["squareFeet"],"V","","Please enter the square feet of the property.",false) &&
				 checkSelect(form.elements["shortDesc"],"V","","Please enter a short headline.",false));
}

function validateNewLogin(form)
{
	return (
				checkSelect(form.elements["firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password1"],"V","","Please create a Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please confirm your Password.",false) && 
				 checkPasswords(form.elements["password1"], form.elements["password2"], "Password do not match, please re-enter them"));
	
}
function validateLogin(form)
{
	return (
				 checkSelect(form.elements["email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["email"],false) &&
				 checkSelect(form.elements["email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["password"],"V","","Please create a Password.",false));
	
}
function validateUpdate(form)
{
	return (
				 checkSelect(form.elements["contact_email"],"V","","Please enter your E-mail.",false) &&
				 checkEmail(form.elements["contact_email"],false) &&
				 checkSelect(form.elements["contact_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkPasswords(form.elements["contact_password"], form.elements["password2"], "Password do not match, please re-enter them") && 
				 checkSelect(form.elements["contact_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["contact_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["package"],"V","","Please Select A Package.",false) && 
				 checkSelect(form.elements["address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["state"],"V","","Please enter the property state.",false) &&
				 checkSelect(form.elements["city"],"V","","Please enter the property city.",false) &&
				 checkSelect(form.elements["zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["price"],"V","","Please enter a price for the property.",false) &&
				 checkSelect(form.elements["beds"],"V","","Please select the number of bedrooms.",false) &&
				 checkSelect(form.elements["baths"],"V","","Please select the number of baths for the property.",false) &&
				 checkSelect(form.elements["year_built"],"V","","Please select the year built.",false) &&
				 checkSelect(form.elements["square_feet"],"V","","Please enter the square feet of the property.",false) &&
				 checkSelect(form.elements["lot_size"],"V","","Please enter the lot size of the property.",false) &&
				 checkSelect(form.elements["description"],"V","","Please enter a property description.",false));
	
}

function validateLoan(form)
{
	if ( form.elements['loan_amount'].value == '' && form.elements['perc_down'].value == '' ) {
		alert("Please enter a desired loan amount of the percentage down payment.");
		form.elements['loan_amount'].focus();
		return false;	
		
	}
	
	if ( form.elements['found_out_select'].value == '' && form.elements['found_out_text'].value == '' ) {
		alert("Please tell us how you found out about us.");	
		form.elements['found_out_select'].focus();
		return false;
	}
	
	return (
				 checkSelect(form.elements["purpose_of_loan"],"V","","Please enter the purpose of the loan.",false) &&
				 checkSelect(form.elements["value"],"V","","Please enter the property value.",false) &&
				 checkSelect(form.elements["property_address"],"V","","Please enter the property address.",false) &&
				 checkSelect(form.elements["property_city"],"V","","Please enter the property city.",false) &&
				 checkSelect(form.elements["property_state"],"V","","Please enter the property state.",false) &&
				 checkSelect(form.elements["property_zip"],"V","","Please enter the property zip.",false) &&
				 checkSelect(form.elements["property_type"],"V","","Please enter the property top.",false) &&
				 checkSelect(form.elements["property_will_be"],"V","","Please enter the property will be.",false) &&
				 
				 checkSelect(form.elements["borrower_firstname"],"V","","Please enter your First Name.",false) &&
				 checkSelect(form.elements["borrower_lastname"],"V","","Please enter your Last Name.",false) &&
				 checkSelect(form.elements["borrower_phone1"],"V","","Please enter your first phone.",false) &&
				 checkEmail(form.elements["borrower_email"],false) &&
				 checkSelect(form.elements["borrower_email"],"V","joe@example.com","Please supply a valid E-mail Address.",false) &&
				 checkSelect(form.elements["borrower_best_time"],"V","","Please enter the best time to call.",false) &&
				 checkSelect(form.elements["borrower_address"],"V","","Please enter the Borrower Address.",false) &&
				 checkSelect(form.elements["borrower_city"],"V","","Please enter the Borrower City.",false) &&
				 checkSelect(form.elements["borrower_state"],"V","","Please enter the borrower state.",false) &&
				 checkSelect(form.elements["property_zip"],"V","","Please enter the borrower zip.",false) &&
				 checkSelect(form.elements["credit_history"],"V","","Please Select A Credit History.",false) );	
	
	
}

function validatePasswordUpdate(form)
{
	return (
				 checkSelect(form.elements["password1"],"V","","Please create a Password.",false) &&
				 checkSelect(form.elements["password2"],"V","","Please confirm your Password.",false) && 
				 checkPasswords(form.elements["password1"], form.elements["password2"], "Password do not match, please re-enter them"));	
	
}

function validateAllFields(form)
{
	for ( a in form.elements ) {
		if ( !checkSelect(form.elements[a], "V", "", "Please complete all fields.", false) ) {
			return false;
		}
	}//for	
	
	return true;
	
}

function checkPasswords(fieldOne, fieldTwo, msg)
{
	if ( fieldOne.value == fieldTwo.value ) {
		return true;
			
	} else {
		fieldOne.value = '';
		fieldTwo.value = '';
		fieldOne.focus();
		alert(msg);
		return false;		
	}
	
}//end checkPassword

function Morgcal()
{
	form = document.myform
	LoanAmount= form.LoanAmount.value
		
	DownPayment= "0"
	AnnualInterestRate = form.InterestRate.value/100
	Years= form.NumberOfYears.value
		MonthRate=AnnualInterestRate/12
	NumPayments=Years*12
	Prin=LoanAmount-DownPayment
	
	MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100
		form.NumberOfPayments.value=NumPayments
	form.MonthlyPayment.value=MonthPayment
}





document.write('<script src="\/sra\/js\/formcheck.js"><\/script>');

curpath = window.location.pathname;

function fadeout() {
	for (var iterator = 0; iterator < arguments.length; iterator++) {
		arguments[iterator].value = '';
		arguments[iterator].disabled = true;
	}
}

function fadein() {
	for (var iterator = 0; iterator < arguments.length; iterator++) {
		arguments[iterator].disabled = false;
	}
	arguments[0].focus();
	arguments[0].select();
}

function sra_check(boxes) {
	for (var iterator = 0; iterator <= boxes; iterator++) {
		document.forms['listing'].elements[iterator].checked = true;
	}
	return false;
}

function sra_clear(boxes) {
	for (var iterator = 0; iterator <= boxes; iterator++) {
		document.forms['listing'].elements[iterator].checked = false;
	}
	return false;
}

function modify_boxes(word,state){
	for (i=0,n=document.forms[0].elements.length;i<n;i++) {
		if (document.forms[0].elements[i].name.indexOf(word) !=-1) {
			if (state == 1) {
				document.forms[0].elements[i].checked = true;
			} else {
				document.forms[0].elements[i].checked = false;
			}
		}
	}//ends FOR
	return false;
}//ends function



function LeavingMsg(msg) {
if (confirm("You are now leaving the (Worthington Federal Bank) web site and going to a third party web site.\n\nWorthington Federal Bank does not host or endorse this site. We are merely providing the Internet link and are not responsible for its content.  The content of the site you are about to enter does not necessarily reflect the opinions, standards or policies of Worthington Federal Bank.  Because this is a third party web site, please review the privacy policy, security policy and encryption standards before completing a transaction. Any questions or comments concerning this external site should be directed to that company or institution.\n\nClick 'OK' to continue to this site, or 'Cancel' to return to the (Worthington Federal Bank) web site."))
 {
    return true;
  } else {
    return false;
  }
}//ends function



function did(string) {
	return document.getElementById(string);
}

function domcheck(elem) {
	if ( typeof(elem) == 'object' ) {
		return elem;
	}
	
	return did(elem);
}

function registerEvent(elem, event, callback, capture) {
	if ( typeof(capture) != 'undefined' ) {
		capture = true;
	}
	if ( event == 'allchange' ) {
		registerEvent(elem, 'change', callback, capture);
		registerEvent(elem, 'click', callback, capture);
		registerEvent(elem, 'keyup', callback, capture);
		return;
	}
	elem = domcheck(elem);
	
	if ( elem.addEventListener ) {
		elem.addEventListener(event, callback, capture);
	} else {
		elem.attachEvent('on'+event, callback, capture); 
	}
}

function unregisterEvent(elem, event, callback, capture) {
	if ( typeof(capture) != 'undefined' ) {
		capture = true;
	}
	if ( event == 'allchange' ) {
		unregisterEvent(elem, 'change', callback, capture);
		unregisterEvent(elem, 'click', callback, capture);
		unregisterEvent(elem, 'keyup', callback, capture);
		return;
	}
	elem = domcheck(elem);
	
	if ( elem.removeEventListener ) {
		elem.removeEventListener(event, callback, capture);
	} else {
		elem.detachEvent('on'+event, callback, capture); 
	}
}

String.prototype.ltrim = function()
{
	return this.replace(/^\s*/, '');
}

String.prototype.rtrim = function()
{
	return this.replace(/\s*$/, '');
}

String.prototype.trim = function()
{
	return this.rtrim().ltrim();
}

Array.prototype.find = function(targ)
{
	for(x in this) {
		if ( this[x] == targ ) {
			return x;
		}
	}
	return false;
}

Array.prototype.inArray = function(targ)
{
	if( this.find(targ) ) {
		return true;
	} else {
		return false;
	}
}

Array.prototype.remove = function(pos)
{
	if ( pos ) {
		this.splice(pos, 1);
	}
	
}

function createDelegate(oObject, sMethodName) {
	return function () {
		return oObject[sMethodName].apply(oObject, arguments);
	};
}
