
function changeFsize(fontSize)
{
	if (document.getElementById)
	{
		if (aryCSSFiles.length > 0)
		{
			if (browser.nav != "MSIE" || browser.plf.major == "MacOSX") { location.reload(); return; }
			if (window.location.pathname == "/index.html")              { location.reload(); return; }
		}
		
		for (i = 0; i < aryCSSFiles.length; i++)
		{
			if (document.getElementById(aryCSSFilesID[i]))
			{
				document.getElementById(aryCSSFilesID[i]).href = aryCSSFiles[i] + fontSize + ".css";
			}
		}
	}
}

function setCookie(strKey, strVal)
{
	var strDefVal = "m";
	
	if ( ! is_FsizeExist(strKey) )
	{
		strVal = strDefVal;
		setFsize(strKey, strVal);
	}
	
	var blFsizeChanged = is_FsizeChanged(strKey, strVal);
	
	if ( blFsizeChanged )
	{
		setDate = new Date();
		setDate.setTime(setDate.getTime() + (7*60*60*24));
		expDate = setDate.toGMTString();
		
		strNewCookie    = strKey + "=" + escape(strVal) + "; path=/;expires=" + expDate;
    	document.cookie = strNewCookie;
    }
	
	changeFsizeBtn(strVal, blFsizeChanged);
}

function changeFsizeBtn(strVal, blFsizeChanged)
{
	var strPath   = '../../new_img2/';
	
	if      (typeof strVal == "undefined")
	{
    	if (document.getElementById ("Image901")) document.Image901.src=strPath+"fsize_s.gif";
		if (document.getElementById ("Image902")) document.Image902.src=strPath+"fsize_m_on.gif";
		if (document.getElementById ("Image903")) document.Image903.src=strPath+"fsize_b.gif";
		if (blFsizeChanged) changeFsize('');
	}
	else if (strVal.match("s"))
    {
    	if (document.getElementById ("Image901")) document.Image901.src=strPath+"fsize_s_on.gif";
		if (document.getElementById ("Image902")) document.Image902.src=strPath+"fsize_m.gif";
		if (document.getElementById ("Image903")) document.Image903.src=strPath+"fsize_b.gif";
		if (blFsizeChanged) changeFsize("_" + strVal);
    }
   	else if (strVal.match("m"))
    {
    	if (document.getElementById ("Image901")) document.Image901.src=strPath+"fsize_s.gif";
		if (document.getElementById ("Image902")) document.Image902.src=strPath+"fsize_m_on.gif";
		if (document.getElementById ("Image903")) document.Image903.src=strPath+"fsize_b.gif";
		if (blFsizeChanged) changeFsize('');
    }
    else if (strVal.match("b"))
   	{
    	if (document.getElementById ("Image901")) document.Image901.src=strPath+"fsize_s.gif";
		if (document.getElementById ("Image902")) document.Image902.src=strPath+"fsize_m.gif";
		if (document.getElementById ("Image903")) document.Image903.src=strPath+"fsize_b_on.gif";
		if (blFsizeChanged) changeFsize("_" + strVal);
    }
    
}

function setFsize(strKey, strVal)
{
	setDate = new Date();
	setDate.setTime(setDate.getTime() + (7*60*60*24));
	expDate = setDate.toGMTString();
	
	strNewCookie    = strKey + "=" + escape(strVal) + "; path=/;expires=" + expDate;
    document.cookie = strNewCookie;
}

function is_FsizeExist(strKey)
{
    strCurrCookie    = document.cookie + ";";
    intIsCookieExist = strCurrCookie.indexOf(strKey, 0);
    
    if(intIsCookieExist == -1) return false;
    else                       return true;
}

function is_FsizeChanged(strKey, strCurrVal)
{
    strCurrCookie    = document.cookie + ";";
    intIsCookieExist = strCurrCookie.indexOf(strKey, 0);
    
    if (intIsCookieExist != -1)
    {
    	strTargetCookie = strCurrCookie.substring(intIsCookieExist, strCurrCookie.length);
    	intTargetKey    = strTargetCookie.indexOf("=", 0);
    	intTargetVal    = strTargetCookie.indexOf(";", intTargetKey);
    	strTargetVal    = strTargetCookie.substring(intTargetKey + 1, intTargetVal);
    	
    	if (strTargetVal.match(strCurrVal)) return false;
    	else                                return true;
    }
    return false;
}

function rollOutForFsize(strKey, strCurrVal, objImg)
{
	var strPath      = '../../new_img2/';
	var strCookieVal = getFCookie(strKey);
	
	if      (typeof strCookieVal == "undefined")
	{
		objImg.src = strPath + "fsize_" + strCurrVal + ".gif";
	}
    else if (strCookieVal.match(strCurrVal))
    {
    	return;
    }
   	else
    {
    	objImg.src = strPath + "fsize_" + strCurrVal + ".gif";
    }
}

function rollOverForFsize(strKey, strCurrVal, objImg)
{
	var strPath      = '../../new_img2/';
	var strCookieVal = getFCookie(strKey);
	
	if      (typeof strCookieVal == "undefined")
	{
		objImg.src = strPath + "fsize_" + strCurrVal + "_on.gif";
	}
    else if (strCookieVal.match(strCurrVal))
    {
    	return;
    }
   	else
    {
		objImg.src = strPath + "fsize_" + strCurrVal + "_on.gif";
	}
}

function getFCookie(strKey)
{
    strCurrCookie    = document.cookie + ";";
    intIsCookieExist = strCurrCookie.indexOf(strKey, 0);
	
    if (intIsCookieExist != -1)
    {
    	strTargetCookie = strCurrCookie.substring(intIsCookieExist, strCurrCookie.length);
    	intTargetKey    = strTargetCookie.indexOf("=", 0);
    	intTargetVal    = strTargetCookie.indexOf(";", intTargetKey);
    	
    	return strTargetCookie.substring(intTargetKey + 1, intTargetVal);
    }
}

var strCurrFSizeCookie = getFCookie('fsize');

if      (typeof strCurrFSizeCookie == "undefined")
{
	for (intGNumAry = 0; intGNumAry < aryCssStylesM.length; intGNumAry++)
	{
		document.write(aryCssStylesM[intGNumAry]);
	}
	setCookie('fsize', 'm');
}
else if (strCurrFSizeCookie.match("s"))
{
	for (intGNumAry = 0; intGNumAry < aryCssStylesS.length; intGNumAry++)
	{
		document.write(aryCssStylesS[intGNumAry]);
	}
}
else if (strCurrFSizeCookie.match("m"))
{
	for (intGNumAry = 0; intGNumAry < aryCssStylesM.length; intGNumAry++)
	{
		document.write(aryCssStylesM[intGNumAry]);
	}
}
else if (strCurrFSizeCookie.match("b"))
{
	for (intGNumAry = 0; intGNumAry < aryCssStylesB.length; intGNumAry++)
	{
		document.write(aryCssStylesB[intGNumAry]);
	}
}

