<!--//
var nExpTime = 30*24*60*60*1000;
var styleKey = "http://usagi-js.com@style";
function InitStyle()
{
	var styleName = GetCookie(styleKey);
	if (styleName != "")
	{
		ApplyStyle(styleName);
	}
}
function InitBlogStyle()
{
	var styleName = GetCookie(styleKey);
	if (styleName != "")
	{
		ApplyBlogStyle(styleName);
	}
}
function ApplyStyle(styleName)
{
	if (styleName == "none")
	{
		return;
	}
	if (document.all)
	{
		document.all.tags("link").item(1).href = "http://usagi-js.com/" + styleName + ".css";
	}
	if (document.getElementByTagName)
	{
		document.getElementByTagName("link").items(1).href = "http://usagi-js.com/" + styleName + ".css";
	}
}
function ApplyBlogStyle(styleName)
{
	if (styleName == "none")
	{
		return;
	}
	if (document.getElementById)
	{
		document.getElementById("usagistyle").href = "http://usagi-js.com/" + styleName + "_blog.css";
	}
	
}
function ChangeSamplePage(pageNumber)
{
	if (pageNumber == "0")
	{
		return;
	}
	nextUrl = "http://usagi-js.com/sample/jssample" + pageNumber + ".htm";
	location.href = nextUrl;
}
function ChangeFunctionPage(pageNumber)
{
	if (pageNumber == "0")
	{
		return;
	}
	nextUrl = "http://usagi-js.com/jslecture/Function" + pageNumber + ".htm";
	location.href = nextUrl;
}
function ApplyStyleWithCookie(styleName)
{
	if (styleName == "none")
	{
		return;
	}
	SetCookie(styleKey, styleName);
	if (document.all)
	{
		document.all.tags("link").item(1).href = "http://usagi-js.com/" + styleName + ".css";
	}
	if (document.getElementByTagName)
	{
		document.getElementByTagName("link").items(1).href = "http://usagi-js.com/" + styleName + ".css";
	}
}
function ApplyBlogStyleWithCookie(styleName)
{
	if (styleName == "none")
	{
		return;
	}
	SetCookie(styleKey, styleName);
	if (document.getElementById)
	{
		document.getElementById("usagistyle").href = "http://usagi-js.com/" + styleName + "_blog.css";
	}
	
}
function GetCookie(strName)
{
	var strReturn = "";
	var nLoop = 0;
	var nLength = 0;
	var strNameEx = strName + "=";
	var strTemp = "";
	while (nLoop < document.cookie.length)
	{
		nLength = nLoop + strNameEx.length;
		if (document.cookie.substring(nLoop, nLength) == strNameEx)
		{
			strTemp = document.cookie.indexOf(";", nLength);
			if (strTemp == -1)
			{
				strReturn = document.cookie.substring(nLength, document.cookie.length);
			}
			else
			{
				strReturn = document.cookie.substring(nLength, strTemp);
			}
			break;
		}
		nLoop = document.cookie.indexOf(" ", nLoop) + 1;
		if (nLoop == 0)
		{
			break;
		}
	}
	return strReturn;
}
function SetCookie(strName, strValue)
{
	var dtExpire = new Date();
	dtExpire.setTime(dtExpire.getTime() + nExpTime);
	document.cookie = strName + "=" + strValue + "; expires=" + dtExpire.toGMTString();
}
-->

