function openPopupWithID(intPopUpID, intHeight, intWidth, intTop, intLeft, blnLocation, blnMenuBar, blnResizable, blnScrollbars, blnStatus, blnTitlebar, blnToolbar) {
	//
	//	right now, just use the simplest JS commands
	//
	window.open("/includes/pop_up.asp?fldPopUpID=" + intPopUpID, null, "height=" + intHeight +  ",width=" + intWidth + ",top=" + intTop + ",left=" + intLeft + ",location=" + blnLocation + ",menubar=" + blnMenuBar + ",resizable=" + blnResizable + ",scrollbars=" + blnScrollbars + ",status=" + blnStatus + ",titlebar=" + blnTitlebar + ",toolbar=" + blnToolbar);
}
var externWin, externWin2

function openPopup(strURL, intHeight, intWidth, intTop, intLeft, blnLocation, blnMenuBar, blnResizable, blnScrollbars, blnStatus, blnTitlebar, blnToolbar) {
	//
	//	right now, just use the simplest JS commands
	//
	if(!externWin2 || externWin2.closed){
		externWin2 = window.open(strURL, "myWindow", "height=" + intHeight +  ",width=" + intWidth + ",top=" + intTop + ",left=" + intLeft + ",location=" + blnLocation + ",menubar=" + blnMenuBar + ",resizable=" + blnResizable + ",scrollbars=" + blnScrollbars + ",status=" + blnStatus + ",titlebar=" + blnTitlebar + ",toolbar=" + blnToolbar);
	}
	else{
		externWin2.location = strURL;
		externWin2.focus();
	}
}

function openPopupName(strName, strURL, intHeight, intWidth, intTop, intLeft, blnLocation, blnMenuBar, blnResizable, blnScrollbars, blnStatus, blnToolbar) {
	if(!externWin || externWin.closed){
		externWin = window.open(strURL, strName, "height=" + intHeight +  ",width=" + intWidth + ",top=" + intTop + ",left=" + intLeft + ",location=" + blnLocation + ",menubar=" + blnMenuBar + ",resizable=" + blnResizable + ",scrollbars=" + blnScrollbars + ",status=" + blnStatus + ",toolbar=" + blnToolbar);
	}
	else{
		externWin.location = strURL;
		externWin.focus();
	}
}

//Check for enter press on form fields
function enterKeyPressed(e) {
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return false;

    if (keycode == 13) return true;
    else return false;
}

function checkIfShouldClearTextBox(objTheTB, strCompareValue){
	if (objTheTB.value == strCompareValue){
		objTheTB.value = "";	
	}
}

function submitLocator(){
	if (document.getElementById("ddlProximity").selectedIndex == 0){
		alert('Please select a mileage radius to search within.');
	} else if(document.getElementById("tbPostal").value.length < 5 || document.getElementById("tbPostal").value == "ZIP CODE"){
		alert('Please specify a zip code/postal code.');
	}else{
		//alert("/maps/locator.aspx?postal=" + document.getElementById("tbPostal").value + "&radius=" + document.getElementById("ddlProximity")[document.getElementById("ddlProximity").selectedIndex].value);
		window.location.href = "/maps/locator.aspx?postal=" + document.getElementById("tbPostal").value + "&radius=" + document.getElementById("ddlProximity")[document.getElementById("ddlProximity").selectedIndex].value
	}

}

function swapTipsImage(imageId, imageName, boolOn) {
    if (boolOn) {
        document.getElementById(imageId).src = '/images/tips/over/' + imageName;
    } else {
        document.getElementById(imageId).src = '/images/tips/' + imageName;
    }
}
