﻿function setBrochureURL(url,absURL) {
    var brochureID = document.getElementById("BrochureURL");

    if(brochureID != null)
        document.getElementById("BrochureURL").href = url;

    if (UrlExists(absURL))
        setBrochureVisibility(true);
    else
        setBrochureVisibility(false);
}

function setBrochureVisibility(toggle) {
    var div = document.getElementById("divComparisonChart");

    if (div != null) {
        if (toggle == true)
            document.getElementById("divComparisonChart").className = "divComparison";
        else 
            document.getElementById("divComparisonChart").innerHTML = "";
            //document.getElementById("divComparisonChart").className = "Hide";        
    }
}

function jumpToAnchor(anchorID) {
    // document.location = document.location + "#13"    
    document.location = String(document.location).replace(/\#.*$/, "") + "#" + String(anchorID);
}

function UrlExists(url) {
    var http = new XMLHttpRequest();
    http.open('HEAD', url, false);
    http.send();

    if (http.status == 404)
        return false;
    else
        return true;    
}
