var addressHelper = {
    geocodeAndThenSubmitForm: function(location, formId, geoPointId) {
        var geocoder = new GClientGeocoder();
        if (geocoder == null)
            return false;

        geocoder.getLatLng(
            location,
            function(point) {
                if (point != null) {
                    var p = point.lat() + ',' + point.lng();
                    document.getElementById(geoPointId).value = p;
                }
                document.forms[formId].submit();
            }
        );
        return true;
    }
    ,isZipValid: function(zip) {
        zip = zip.replace(/ /, "");

        var valid = "0123456789-";
        var hyphencount = 0;

        if (zip.length != 5 && zip.length != 10)
            return false;

        for (var i=0; i < zip.length; i++) {
            var temp = "" + zip.substring(i, i+1);
            if (temp == "-")
                hyphencount++;
            if (valid.indexOf(temp) == "-1")
                return false;
        }
        if ((hyphencount > 1) || ((zip.length==10) && "" + zip.charAt(5) != "-") || (zip.length == 5 && hyphencount > 0))
            return false;

        return true;
    }
};

function go_link_tp(page,width,height){
	if ((width < 1000) && (height < 1000)){
	window.open(page,"go_link", "scrollbars=no,width=" + width + ",height=" + height + ",resizable=no")
	}
}

function go_link(page,width,height){
	if ((width < 1000) && (height < 1000)){
	window.open(page,"go_link", "scrollbars=yes,width=" + width + ",height=" + height + ",resizable=no")
	}
}

function go_link2(page,width,height){
        if ((width < 1000) && (height < 1000)){
                window.open(page,"go_link", "scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes")
        }
}

function go_link3(page,width,height){
        if ((width < 1000) && (height < 1000)){
                window.open(page,"go_link", "toolbar=yes,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes")
        }
}

function go_link_noscroll(page,width,height){
	if ((width < 1000) && (height < 1000)){
	window.open(page,"go_link", "scrollbars=no,width=" + width + ",height=" + height + ",resizable=no")
	}
}

function go_link_normal(page,width,height){
	if ((width < 1000) && (height < 1000)){
	window.open(page,"go_link", "menubar=yes,location=yes,toolbar=yes,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes")
	}
}