﻿/* Function changes the text size of the current page */
function setTextSize(iSize)
{
    switch (iSize)
    {
        case 2:
            document.body.style.fontSize = "0.8em"; 
        break;
        case 3:
            document.body.style.fontSize = "1em"; 
        break;
        default:
            document.body.style.fontSize = "0.6em"; 
    }
    
    setUsersSession(iSize);
}

/* Calls a page to set the users text size choice 
in their asp.net session */
function setUsersSession(iSize)
{
    var url = 'http://' + window.location.hostname + '/CMSTemplates/SoftLanding/textsize.aspx?size=' + iSize + '&date=' + escape(Date());

    // branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}

/* Normally would process the AJAX response but don't really 
need any response in this instance. */
function processReqChange() 
{
	// only if req shows "complete"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			if (req.responseText == 'True')
			{
				//doNothing();
			}
		}
	}
}
