﻿// Page Constraint - jscript

var blnConstraintValue;
var expiredays = 14;
var theCookie = "PageConstraint";

function TogglePageConstraint() {

    var objPage = document.getElementById("page");
    var objImg = document.getElementById("pageImg");    

    if (objPage.style.width == "98%") {
            objPage.style.width = "985px";
            objImg.src = "/images/float.png";
            SetPageConstraintCookie(false);
        }
    else {
            objPage.style.width = "98%";
            objImg.src = "/images/seal.png";
            SetPageConstraintCookie(true);
        }

}

function GetPageConstraintCookie(theCookie) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(theCookie + "=");
        if (c_start != -1) {
            c_start = c_start + theCookie.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            //return unescape(document.cookie.substring(c_start, c_end));
            if (document.cookie.substring(c_start, c_end) == "true") TogglePageConstraint();
        }
        else {
            TogglePageConstraint();

        }
    }
}
function SetPageConstraintCookie(value) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = theCookie + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());

}

GetPageConstraintCookie(theCookie);
