// JavaScript Document

function decreaseTextSize()
{
    var mainBod = document.getElementById("maintextarea");
    var mainBodStyle = mainBod.style;
    var size;
    var sizeStr;
    size = mainBodStyle.fontSize.substr(0,2);

    if (size > 10){
        size-=2;
        sizeStr = size + "pt";
        mainBodStyle.fontSize = sizeStr;
    }

    if (size == 10) {
        document.getElementById("textSizeButtonDec").src = "../images/font-dec-off.gif";
    }
    if (size == 16) {
        document.getElementById("textSizeButtonInc").src = "../images/font-inc.gif";
    }

	//if (location.search.indexOf('textsize') == -1)
	//{
	//window.location = window.location + '?textsize=' + size;
	//}
	//else
	//{
	//broke in firefox window.location.search = '?textsize=' + size;
	//}
}


function increaseTextSize()
{
    var mainBod = document.getElementById("maintextarea");
    var mainBodStyle = mainBod.style;
    var size;
    var sizeStr;
    size = mainBodStyle.fontSize.substr(0,2)
    if (size < 18){
        size*=1;
        size+=2;
        sizeStr = size + "pt";
        mainBodStyle.fontSize = sizeStr;
    }

    if (size == 12) {
        document.getElementById("textSizeButtonDec").src = "../images/font-dec.gif";
    }
    if (size == 18) {
        document.getElementById("textSizeButtonInc").src = "../images/font-inc-off.gif";
    }
	
	//window.location.search = '?textsize=' + size;
	//var firstPart; var secondPart; var wholeThing;
	//wholeThing = window.location + '';
	//firstPart = wholeThing.split("?")[0];
	//secondPart = wholeThing.split("?")[1];
	//alert('firstPart ' + firstPart);
	//alert('secondPart ' + secondPart);
	//broke in firefox window.location = firstPart + '?textsize=' + size;
	}

function qstringTextSize()
{
	if (location.search.indexOf('textsize') != -1)
	{
	    var mainBod = document.getElementById("maintextarea");
	    var mainBodStyle = mainBod.style;
		//alert('boo');
		var size;
		var sizeStr;
		size = location.search.split("=")[1];
		sizeStr = size + "pt";
	    mainBodStyle.fontSize = sizeStr;
		
		if (size == 10) {
	        document.getElementById("textSizeButtonDec").src = "../images/font-dec-off.gif";
	    }
	    if (size == 18) {
	        document.getElementById("textSizeButtonInc").src = "../images/font-inc-off.gif";
	    }
	}
}

function passTextSize()
{
	//if (document.referrer&&document.referrer!="")
	//{
		//alert('referrer' + document.referrer);
		//alert('index of ? ' + document.referrer.indexOf('?'));
		lastLoc = document.referrer;
		if (lastLoc.indexOf('textsize') != -1)
		{
			//alert('text size was ' + lastLoc.split('=')[1]);
			currentLoc = window.location + '';
			window.location = currentLoc.split('?') + '?textsize=' + lastLoc.split('=')[1];
		}
		
	//}
}

