// Terms of Service for titanium-rings-ambigram.aspx page head

function loadXmlHttp(url, id) {
    var f = this;
    f.xmlHttp = null;
    /*@cc_on @*/ // used here and below, limits try/catch to those IE browsers that both benefit from and support it
    /*@if(@_jscript_version >= 5) // prevents errors in old browsers that barf on try/catch & problems in IE if Active X disabled
    try {f.ie = window.ActiveXObject}catch(e){f.ie = false;}
    @end @*/
    if (window.XMLHttpRequest&&!f.ie||/^http/.test(window.location.href))
        f.xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari, others, IE 7+ when live - this is the standard method
    else if (/(object)|(function)/.test(typeof createRequest))
        f.xmlHttp = createRequest(); // ICEBrowser, perhaps others
    else {
        f.xmlHttp = null;
        // Internet Explorer 5 to 6, includes IE 7+ when local //
        /*@cc_on @*/
        /*@if(@_jscript_version >= 5)
        try{f.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
        catch (e){try{f.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){f.xmlHttp=null;}}
        @end @*/
    }
    if(f.xmlHttp != null){
        f.el = document.getElementById(id);
        f.xmlHttp.open("GET",url,true);
        f.xmlHttp.onreadystatechange = function(){f.stateChanged();};
        f.xmlHttp.send(null);
    } else {
        eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=500,left = 470,top = 200');");
    }
}

loadXmlHttp.prototype.stateChanged=function () {
    if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
    this.el.innerHTML = this.xmlHttp.responseText;
}

function displayTerms(bShow) {
    var terms = document.getElementById('LegalTerms');
    terms.style.display = ((bShow) ? 'block' : 'none');
    if (bShow)
    {
        new loadXmlHttp('http://www.cascadiadesignstudio.com/termsandconditions.txt', 'LegalTerms');
        return false;
    } else {
        //User agrees
        document.getElementById('chkAgree').checked = true;
    }
}
    
