<!--


// Auto-bookmark the website when the function is called.
function addToFavorites() {
	if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 4) {
		window.external.AddFavorite('http://www.valvanorealty.com/', 'Valvano Real Estate Agency');
	}
}


// Auto-bookmark Script
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


// close pop-up image windows
function closeImageWindow() {
	if (ImageWindow != null && !ImageWindow.closed) ImageWindow.close();
}


// open a new, formatted image window
var ImageWindow = null;
function openImage(imageURL,imageTitle,imageWidth,imageHeight) {
	// check if window is open: then close
	closeImageWindow();

	// create an Image Window
	ImageWindow = openCenteredWindow('','ImageWindow'+imageWidth+'_'+imageHeight,imageWidth,imageHeight,'no');
	// write to, and format, ImageWindow
	ImageWindow.document.open();
	ImageWindow.document.write("<HTML><HEAD><TITLE>" + imageTitle + "</TITLE></HEAD><BODY BGCOLOR=black LEFTMARGIN=0 TOPMARGIN=0 onClick=\"window.close()\" STYLE=\"margin: 0px;\"><TABLE WIDTH=100% HEIGHT=100% CELLSPACING=0 CELLPADDING=0><TR><TD ALIGN=CENTER VALIGN=MIDDLE><IMG SRC=\"" + imageURL + "\" BORDER=0></TD></TR></TABLE></BODY></HTML>");
	ImageWindow.document.close();
}


// open a content window (with consideration for screen size)
function openCenteredWindow(contentURL,contentTitle,contentWidth,contentHeight,scrollBars) {
	// center window on screen
	var winLeft = (screen.width - 1 - contentWidth) / 2;
	var winTop = (screen.height - 1 - contentHeight) / 2;

	if (winLeft < 0) {
		scrollBars = "yes";
		winLeft = 10;
		contentWidth = screen.width - 30;
	}
	if (winTop < 0) {
		scrollBars = "yes";
		winTop = 10;
		contentHeight = screen.height - 100;
	}

	var NewWindow = window.open(contentURL,contentTitle,'scrollbars='+scrollBars+',width='+contentWidth+',height='+contentHeight+',top='+winTop+',left='+winLeft+',screenX='+winLeft+',screenY='+winTop);
	NewWindow.focus();
	return NewWindow;
}


// Required Fields Script
function formCheck(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("realname", "email", "My telephone number");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Your Name", "Your Email Address", "Your Telephone Number");
	//3) Enter dialog message
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


//Popup Script
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=260,left = 490,top = 362');");
}


// Calculator Script
function bank(num)

{

   var1 = (num * 100) % 1;
   var2 = (num * 100) - var1;
   if (var1 > 0)
   {var2 += 1;}
   num = var2 / 100;
   return num;

}

function checkNumber(input, min, max, msg)

{

    msg = msg + " field has invalid data: " + input.value;
    var str = input.value;
    for (var i = 0; i < str.length; i++) {

        var ch = str.substring(i, i + 1)
        if ((ch < "0" || "9" < ch) && ch != '.') {

            alert(msg);
            return false;

        }

    }

    var num = 0 + str
    if (num < min || max < num) {

        alert(msg + " not in range [" + min + ".." + max + "]");
        return false;

    }

    input.value = str;
    return true;

}

function computeField(input)

{

    if (input.value != null && input.value.length != 0)

        input.value = "" + eval(input.value);

    computeForm(input.form);

}

function computeForm(form)

{

    if ((form.annum.value == null || form.annum.value.length == 0) ||

        (form.interest.value == null || form.interest.value.length == 0) ||
        (form.purchase.value == null || form.purchase.value.length == 0)) {
        return;

    }

    if ((form.down.value == null) || form.down.value.length == 0)

         {form.down.value = 0;}

    if (!checkNumber(form.annum, 1, 40, "# of years") ||

       !checkNumber(form.interest, .001, 99, "Interest") ||

        !checkNumber(form.purchase, 25, 100000000, "Purchase")) {
        form.payment.value = "Invalid";
        return;

    }

    var i = form.interest.value;
    if (i < 1.0)

      {

        i = i * 100;
        form.interest.value = i;

      }

    i = form.interest.value / 100;
    pow = 1 + (i/2);
    i = Math.pow(pow, 1/6) - 1;
    bot1 = (1 / (1 + i))
    bot2 = Math.pow(bot1, (form.annum.value * 12))
    form.payment.value = ((form.purchase.value - form.down.value)* i) / (1 - bot2);
    form.payment.value = bank(form.payment.value);

}

function clearForm(form)

{

    form.annum.value = "";
    form.interest.value = "";
    form.purchase.value = "";
    form.down.value = "";
    form.payment.value = "";

}

/***********************************************
/* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
/* This notice MUST stay intact for legal use
/* Visit http://www.dynamicdrive.com/ for full source code
/***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://denval.com/cgi-bin/exec/search.cgi?user_num=&shownew=&lfield27_keyword=Single+Family&search=++Search+Listings++&sort_order=5,123,forward">Single Family</a>'
menu1[1]='<a href="http://denval.com/cgi-bin/exec/search.cgi?user_num=&shownew=&lfield27_keyword=Multi+Family&search=++Search+Listings++&sort_order=5,123,forward">Multi Family</a>'
menu1[2]='<a href="http://denval.com/cgi-bin/exec/search.cgi?user_num=&shownew=&lfield27_keyword=New+Construction&search=++Search+Listings++&sort_order=5,123,forward">New Construction</a>'
menu1[3]='<a href="http://denval.com/cgi-bin/exec/search.cgi?user_num=&shownew=&lfield27_keyword=Apartments&search=++Search+Listings++&sort_order=5,123,forward">Apartments</a>'
menu1[4]='<a href="http://denval.com/cgi-bin/exec/search.cgi?user_num=&shownew=&lfield27_keyword=Commercial&search=++Search+Listings++&sort_order=5,123,forward">Commercial</a>'
menu1[5]='<a href="http://denval.com/cgi-bin/exec/search.cgi?search=1&sort_order=5,123,forward">View All</a>'
menu1[6]='<a href="http://www.denval.com/soldlistings.html">Sold Listings</a>'

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="http://www.denval.com/agents/h0002.html">Dennis Valvano</a>'
menu2[1]='<a href="http://www.denval.com/agents/h0004.html">Mark Valvano</a>'
menu2[2]='<a href="http://www.denval.com/agents/h0005.html">Shannon M. Stocker</a>'
menu2[3]='<a href="http://www.denval.com/agents/h0009.html">Everest Mulaj</a>'
menu2[4]='<a href="http://www.denval.com/agents/h0010.html">Lisa Miskiewicz</a>'
menu2[5]='<a href="http://www.denval.com/agents/h0012.html">Carlos M. Nunez</a>'
menu2[6]='<a href="http://www.denval.com/agents/h0014.html">Susanne Miskiewicz</a>'
menu2[7]='<a href="http://www.denval.com/agents/h0015.html">Jonathan Slater</a>'

//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="http://www.denval.com/contact.html">By Email</a>'
menu3[1]='<a href="http://www.denval.com/contact.html">By Telehone</a>'
menu3[2]='<a href="http://www.denval.com/contact.html">By Fax</a>'

//Contents for menu 4
var menu4=new Array()
menu4[0]='<a href="http://denval.com/cal.html">Mortgage Calculator</A>'
menu4[1]='<a href="http://www.denval.com/mortgageinfo.html">Mortgage Specialists</A>'
menu4[2]='<a href="http://www.denval.com/miscinfo.html">More Coming Soon</A>'
		
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=-5 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


//-->