﻿//image swap
if (document.images) {
    image1 = new Image
    image2 = new Image
    image1.src = 'images/donate.png'
    image2.src = 'images/donate2.png'

    image3 = new Image
    image4 = new Image
    image3.src = 'images/sponsor.png'
    image4.src = 'images/sponsor2.png'

    image5 = new Image
    image6 = new Image
    image5.src = 'images/volunteer.png'
    image6.src = 'images/volunteer2.png'

}



// request form check

function chkfrm() {

    var nm = document.reqfrm.name.value
    if (nm == "") {
        alert("Please enter your name")
        document.reqfrm.name.focus()
        return;
    }
    var cm = document.reqfrm.phone.value
    if (cm == "") {
        alert("Please enter your phone Number")
        document.reqfrm.phone.focus()
        return;
    }
    
   document.reqfrm.submit()
}

// Reset Form
function resetfrm() {
    document.reqfrm.reset()
    document.reqfrm.name.focus()
}


//thumbnail pop-ups
var popbackground = "#000000" //specify backcolor or background image for pop window
var windowtitle = "Dominion Power Washing | Gallery"  //pop window title

function detectexist(obj) {
    return (typeof obj != "undefined")
}

function popimage(imgpath, popwidth, popheight, popres, textdescription) {

    function getpos() {
        leftpos = (detectexist(window.screenLeft)) + 50
        toppos = (detectexist(window.screenTop)) + 50
        if (window.opera) {
            leftpos -= screenLeft
            toppos -= screenTop
        }
    }

    getpos()
    var winattributes = 'width=' + popwidth + ',height=' + popheight + ',location=no, menubar=no, status=no, toolbar=no ,scrollbars=yes,left=' + leftpos + ',top=' + toppos
    var bodyattribute = (popbackground.indexOf(".") != -1) ? 'background="' + popbackground + '"' : 'bgcolor="' + popbackground + '"'
    if (typeof jkpopwin == "undefined" || jkpopwin.closed)
        jkpopwin = window.open("", "", winattributes)
    else {
        //getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
        //jkpopwin.moveTo(leftpos, toppos)
        jkpopwin.resizeTo(popwidth, popheight + 30)
    }
    jkpopwin.document.open()
    jkpopwin.document.write('<html><title>' + windowtitle + '</title><body ' + bodyattribute + '><center><img src="' + imgpath + '" style="margin-bottom: 0.5em"><br />' + textdescription + '</center></body></html>')
    jkpopwin.document.close()
    jkpopwin.focus()
}

function wclose() {
    window.close()
}
