/**
 * トップページのメインビジュアルを時間によって変化させる
 * 
 * @param	void
 */
function switchMainVisual()
{
	var element = document.getElementById("topPageMainVisual");
	var myD = new Date();
	var myHours = myD.getHours();
	var hourMorning = 7, hourSunset = 16, hourNight = 18, imgFile;
	
	if (hourMorning <= myHours && myHours < hourSunset)
		imgFile = "images/h1-day.jpg";
	 else if (hourSunset <= myHours && myHours < hourNight)
		imgFile = "images/h1-sunset.jpg";
	 else
		imgFile = "images/h1-night.jpg"; 
	
	element.style.backgroundImage = "url('" + imgFile + "')";
}

/**
 * グローバルナビゲーションを記述する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function drawGlobalNavigation(category, page)
{
	var gn = document.getElementById("globalNav"), gnstr = "<ul>\n";
	var globalNavItem = [
		{	"id":	"Home",		"category":	"",			"path":	"./",			"title":	"Home"},
		{	"id":	"Company",	"category":	"company",	"path":	"company/",		"title":	"Company Info"},
		{	"id":	"Business",	"category":	"business",	"path":	"business/",	"title":	"Business Summary"},
		{	"id":	"Ir",		"category":	"ir",		"path":	"ir/",			"title":	"Investor Relations"},
		{	"id":	"News",		"category":	"news",		"path":	"news/",		"title":	"News Releases"},
		{	"id":	"Contact",	"category":	"contact",	"path":	"contact/",		"title":	"Contact Us"}
		];
	
	for (var i = 0; i < globalNavItem.length; i++) {
		var linkClass = "";
		
		if (globalNavItem[i]["category"] == category && !(category == "" && page != "index"))
			linkClass = "globalNavItemCurrent";
		
		gnstr += "<li id=\"globalNavItem" + globalNavItem[i]["id"] + "\">" + generateLink(getBackPath(category, page), globalNavItem[i]["path"], globalNavItem[i]["title"], "", linkClass, "") + "</li>\n";
	}
	
	gnstr += "</ul>\n";
	gn.innerHTML += gnstr;
}

/**
 * カテゴリごとのカバー画像を記述する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function drawCategoryCover(category, page)
{
	var cc = document.getElementById("categoryCover"), ccstr = "", depth = getBackPath(category, page);
	
	switch (category) {
		case "business":
			ccstr = "Business Summary";
			break;
		
		case "ir":
			ccstr = "Investor Relations";
			break;
		
		case "news":
			ccstr = "News Releases";
			break;
		
		case "contact":
			ccstr = "Contact Us";
			break;
		
		default:
			if (page != "notfound") {
				category = "company";
				ccstr = "Company Info";
			} else {
				category = "notfound";
				ccstr = "Page Not Found";
			}
			
			break;
	}
	
	cc.className = "categoryCover" + (category.substring(0, 1).toUpperCase() + category.substring(1).toLowerCase());	
	cc.innerHTML += ccstr;
}

/**
 * パンくずメニューを記述する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function drawTopicPath(category, page)
{
	var tp = document.getElementById("topicPath"), topicPath = "<ul>\n<li><a href=\"http://www.geonet.co.jp/english/\" title=\"GEO HOLDINGS CORPORATION\">Home</a></li>\n";
	var tree = [
		{	"category":	"company",
			"children":	[
					{	"page": 	"index",
						"elements":	[
								{	"path":		"company/",	"title":	"Company Info"}
							]},
					{	"page":		"profile/index",
						"elements":	[
								{	"path":		"company/",			"title":	"Company Info"},
								{	"path":		"company/profile/",	"title":	"Corporate Profile"}
							]},
					{	"page":		"profile/access",
						"elements": [
								{	"path":		"company/",						"title":	"Company Info"},
								{	"path":		"company/profile/",				"title":	"Corporate Profile"},
								{	"path":		"company/profile/access.html",	"title":	"Access"}
							]},
					{	"page":		"structure",
						"elements": [
								{	"path":		"company/",					"title":	"Company Info"},
								{	"path":		"company/structure.html",	"title":	"Organization Chart"}
							]},
					{	"page":		"timeline",
						"elements":	[
								{	"path":		"company/",					"title":	"Company Info"},
								{	"path":		"company/timeline.html",	"title":	"GEO Group Timeline"}
							]}
				]},
		{	"category":	"business",
			"children":	[
					{	"page":		"index",
						"elements":	[
								{	"path":		"business/",	"title":	"Business Summary"}
							]},
					{	"page":		"companies",
						"elements":	[
								{	"path":		"business/",				"title":	"Business Summary"},
								{	"path":		"business/companies.html",	"title":	"GEO Group Companies"}
							]},
					{	"page":		"companies/geo",
						"elements":	[
								{	"path":		"business/",				"title":	"Business Summary"},
								{	"path":		"business/companies.html",	"title":	"GEO Group Companies"},
								{	"path":		"business/companies/geo.html",	"title":	"GEO CORPORATION Profile"}
							]}
				]},
		{	"category":	"ir",
			"children":	[
					{	"page":		"index",
						"elements":	[
								{	"path":		"ir/",	"title":	"Investor Relations"}
							]},
					{	"page":		"management/index",
						"elements":	[
								{	"path":		"ir/",				"title":	"Investor Relations"},
								{	"path":		"ir/management/",	"title":	"Management Policy"}
							]},
					{	"page":		"management/topmessage",
						"elements":	[
								{	"path":		"ir/",								"title":	"Investor Relations"},
								{	"path":		"ir/management/",					"title":	"Management Policy"},
								{	"path":		"ir/management/topmessage.html",	"title":	"Message from Top Management"}
							]},
					{	"page":		"management/governance",
						"elements":	[
								{	"path":		"ir/",								"title":	"Investor Relations"},
								{	"path":		"ir/management/",					"title":	"Management Policy"},
								{	"path":		"ir/management/governance.html",	"title":	"Corporate Governance"}
							]},
					{	"page":		"financial/index",
						"elements":	[
								{	"path":		"ir/",				"title":	"Investor Relations"},
								{	"path":		"ir/financial/",	"title":	"Financial Data"}
							]},
					{	"page":		"financial/highlight",
						"elements":	[
								{	"path":		"ir/",							"title":	"Investor Relations"},
								{	"path":		"ir/financial/",				"title":	"Financial Data"},
								{	"path":		"ir/financial/highlight.html",	"title":	"Financial Highlight"}
							]},
					{	"page":		"financial/shopdata",
						"elements":	[
								{	"path":		"ir/",							"title":	"Investor Relations"},
								{	"path":		"ir/financial/",				"title":	"Financial Data"},
								{	"path":		"ir/financial/shopdata.html",	"title":	"GEO Group Shop Data"}
							]},
					{	"page":		"library/index",
						"elements":	[
								{	"path":		"ir/",			"title":	"Investor Relations"},
								{	"path":		"ir/library/",	"title":	"IR Library"},
								{	"path":		"ir/library/",	"title":	"Latest IR Materials"}
							]},
					{	"page":		"library/financial/index",
						"elements":	[
								{	"path":		"ir/",						"title":	"Investor Relations"},
								{	"path":		"ir/library/",				"title":	"IR Library"},
								{	"path":		"ir/library/financial/",	"title":	"Financial Results"}
							]},
					{	"page":		"library/presentation/index",
						"elements":	[
								{	"path":		"ir/",						"title":	"Investor Relations"},
								{	"path":		"ir/library/",				"title":	"IR Library"},
								{	"path":		"ir/library/presentation/",	"title":	"Presentation Materials"}
							]},
					{	"page":		"library/monthly/index",
						"elements":	[
								{	"path":		"ir/",					"title":	"Investor Relations"},
								{	"path":		"ir/library/",			"title":	"IR Library"},
								{	"path":		"ir/library/monthly/",	"title":	"Monthly Retail Data"}
							]},
					{	"page":		"stock/index",
						"elements":	[
								{	"path":		"ir/",			"title":	"Investor Relations"},
								{	"path":		"ir/stock/",	"title":	"Stock Information"}
							]},
					{	"page":		"stock/dividend",
						"elements":	[
								{	"path":		"ir/",						"title":	"Investor Relations"},
								{	"path":		"ir/stock/",				"title":	"Stock Information"},
								{	"path":		"ir/stock/dividend.html",	"title":	"Stock Price and Dividend"}
							]},
					{	"page":		"stock/benefits/index",
						"elements":	[
								{	"path":		"ir/",					"title":	"Investor Relations"},
								{	"path":		"ir/stock/",			"title":	"Stock Information"},
								{	"path":		"ir/stock/benefits/",	"title":	"Shareholder Special Benefit Program"}
							]},
					{	"page":		"schedule/index",
						"elements":	[
								{	"path":		"ir/",			"title":	"Investor Relations"},
								{	"path":		"ir/schedule/",	"title":	"IR Schedule"}
							]},
					{	"page":		"irpolicy",
						"elements":	[
								{	"path":		"ir/",				"title":	"Investor Relations"},
								{	"path":		"ir/irpolicy.html",	"title":	"IR Policy"}
							]}
				]},
		{	"category":	"news",
			"children":	[
					{	"page":		"index",
						"elements":	[
								{	"path":		"news/",	"title":	"News Releases"}
							]},
					{	"page":		"2009",
						"elements":	[
								{	"path":		"news/",	"title":	"News Releases"},
								{	"path":		"news/2009.html",	"title":	"FY 2009"}
							]},
					{	"page":		"2010",
						"elements":	[
								{	"path":		"news/",	"title":	"News Releases"},
								{	"path":		"news/2010.html",	"title":	"FY 2010"}
							]},
					{	"page":		"mailmagazine",
						"elements":	[
								{	"path":		"news/",					"title":	"News Releases"},
								{	"path":		"news/mailmagazine.html",	"title":	"The Registration of the IR News Email"}
							]}
				]},
		{	"category":	"contact",
			"children":	[
					{	"page":		"index",
						"elements":	[
								{	"path":		"contact/",	"title":	"Contact Us"}
							]}
				]},
		{	"category":	"other",
			"children":	[
					{	"page":		"attention",
						"elements":	[
								{	"path":		"attention.html",	"title":	"Site Policy"}
							]},
					{	"page":		"privacy",
						"elements":	[
								{	"path":		"privacy.html",	"title":	"Privacy Policy"}
							]},
					{	"page":		"sitemap",
						"elements":	[
								{	"path":		"sitemap.html",	"title":	"Site Map"}
							]},
					{	"page":		"notfound",
						"elements":	[
								{	"path":		"notfound.html", "title":	"Page Not Found"}
							]}
				]}
		];
	
	for (var i = 0; i < tree.length; i++)
		if (tree[i]["category"] == category || (tree[i]["category"] == "other" && category == "")) {
			for (var j = 0; j < tree[i]["children"].length; j++)
				if (tree[i]["children"][j]["page"] == page) {
					for (var k = 0; k < tree[i]["children"][j]["elements"].length; k++)
						if (k == tree[i]["children"][j]["elements"].length - 1)
							topicPath += "<li class=\"lastItem\"><strong>" + tree[i]["children"][j]["elements"][k]["title"] + "</strong></li>\n";
						 else
							topicPath += "<li>" + generateLink(getBackPath(category, page), tree[i]["children"][j]["elements"][k]["path"], tree[i]["children"][j]["elements"][k]["title"], "", "", "") + "</li>\n";
					
					break;
				}
			
			break;
		}
	
	topicPath += "</ul>\n";
	tp.innerHTML += topicPath;
	
}

/**
 * カテゴリ内ローカルナビゲーションを記述する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function drawLocalNavigation(category, page)
{
	var ln = document.getElementById("localNav"), lnstr = "<ul>\n", depth = getBackPath(category, page);
	var localNavItem = [
			{	"category":	"company",	"header":	"Company Info",			"title":	"Company Info",
				"children":	[
						{	"page":	"index",				"title":	"Company Info"},
						{	"page":	"profile/index",		"title":	"Corporate Profile"},
						{	"page":	"profile/access",		"title":	"Access"},
						{	"page":	"structure",			"title":	"Organization Chart"},
						{	"page":	"timeline",				"title":	"GEO Group Timeline"}
					]},
			{	"category":	"business",	"header":	"Business Summary",		"title":	"Business Summary",
				"children":	[
						{	"page":	"index",		"title":	"Business Summary"},
						{	"page":	"companies",	"title":	"GEO Group Companies"}
					]},
			{	"category":	"ir",		"header":	"Investor Relations",	"title":	"Investor Relations",
				"children":	[
						{	"page":	"index",			"title":	"Investor Relations"},
						{	"page":	"management/index",	"title":	"Management Policy",
							"children": [
									/* {	"page":	"management/topmessage",	"title":	"Message"}, */
									{	"page":	"management/governance",	"title":	"Corporate Governance"}
								]},
						{	"page":	"financial/index",	"title":	"Financial Data",
							"children": [
									{	"page":	"financial/highlight",	"title":	"Financial Highlight"},
									{	"page":	"financial/shopdata",	"title":	"GEO Group Shop Data"}
								]},
						{	"page":	"library/index",	"title":	"IR Library",
							"children": [
									{	"page":	"library/financial/index",		"title":	"Financial Results"},
									{	"page":	"library/presentation/index",	"title":	"Presentation Materials"},
									{	"page":	"library/monthly/index",		"title":	"Monthly Retail Data"}
								]},
						{	"page":	"stock/index",		"title":	"Stock Information",
							"children": [
									{	"page":	"stock/dividend",		"title":	"Dividend"},
									{	"page":	"stock/benefits/index",	"title":	"Special Benefit Program"}
								]},
						{	"page":	"schedule/index",	"title":	"IR Schedule"}
					]},
			{	"category":	"news",		"header":	"News Releases",		"title":	"News Releases",
				"children":	[
						{"page":	"index",		"title":	"FY 2011"},
						{"page":	"2010",		"title":	"FY 2010"},
						{"page":	"2009",		"title":	"FY 2009"},
						{"page":	"mailmagazine",	"title":	"News Mail Registration"}
					]},
			{	"category":	"contact",	"header":	"Contact",				"title":	"Contact Us",
				"children":	[
						{"page":	"index",	"title":	"Contact Us"},
						{"page":	"privacy",	"title":	"Privacy Policy", "isGlobal": true}
					]}
		];
	var localNav2Item = [
			{	"category":	"news",		"page":	"mailmagazine",	"title":	"The Registration of the IR News Email"},
			{	"category":	"contact",	"page":	"index",		"title":	"Contact Us"},
			{	"category":	"ir",		"page":	"irpolicy",		"title":	"IR Policy"}
		];
	
	if (page != "notfound") {
		for (var i = 0; i < localNavItem.length; i++)
			if (localNavItem[i]["category"] == category || (localNavItem[i]["category"] == "company" && category == "")) {
				if (category == "ir")
					lnstr += "<li id=\"localNavItem" + localNavItem[i]["category"].substring(0, 1).toUpperCase() + localNavItem[i]["category"].substring(1).toLowerCase() + "\" class=\"localNavItemOpen localNavItemOpenIr\"><p class=\"localNavItemHeader\">" + localNavItem[i]["header"] + "</p><p class=\"localNavItemTitle\">" + localNavItem[i]["title"] + "</p>\n<ul>\n";
				 else
					lnstr += "<li id=\"localNavItem" + localNavItem[i]["category"].substring(0, 1).toUpperCase() + localNavItem[i]["category"].substring(1).toLowerCase() + "\" class=\"localNavItemOpen\"><p class=\"localNavItemHeader\">" + localNavItem[i]["header"] + "</p><p class=\"localNavItemTitle\">" + localNavItem[i]["title"] + "</p>\n<ul>\n";
				
				for (var j = 0; j < localNavItem[i]["children"].length; j++) {
					var path = localNavItem[i]["children"][j]["page"], liClass = "level1", isChildActive;
					
					if (category == "")
						path = "company/" + path;
					 else if (!localNavItem[i]["children"][j]["isGlobal"])
						path = category + "/" + path;
					
					if (/\/index$/.test(path))
						path = path.slice(0, -5);
					 else
						path += ".html";
					
					if (localNavItem[i]["children"][j]["children"] && localNavItem[i]["children"][j]["page"].split("/", 1)[0] == page.split("/", 1)[0])
						isChildActive = true;
					 else
						isChildActive = false;
					
					if (j == localNavItem[i]["children"].length - 1 && !isChildActive) {
						if (localNavItem[i]["children"][j]["page"] == page)
							liClass += " level1LastItem level1CurrentPage";
						 else
							liClass += " level1LastItem";
					} else {
						if (localNavItem[i]["children"][j]["page"] == page)
							liClass += " level1CurrentPage";
					}
					
					//window.alert(page);
					
					lnstr += "<li class=\"" + liClass + "\">" + generateLink(depth, path, localNavItem[i]["children"][j]["title"], "", "", "");
					
					if (isChildActive) {
						lnstr += "\n<ul>";
						
						for (var k = 0; k < localNavItem[i]["children"][j]["children"].length; k++) {
							var path2 = category + "/" + localNavItem[i]["children"][j]["children"][k]["page"], li2Class = "level2";
							
							if (/\/index$/.test(path2))
								path2 = path2.slice(0, -5);
							 else
								path2 += ".html";
							
							if (j == localNavItem[i]["children"].length - 1 && k == localNavItem[i]["children"][j]["children"].length - 1) {
								if (localNavItem[i]["children"][j]["children"][k]["page"] == page)
									li2Class += " level2LastItem level2CurrentPage";
								 else
									li2Class += " level2LastItem";
							} else {
								if (localNavItem[i]["children"][j]["children"][k]["page"] == page)
									li2Class += " level2CurrentPage";
							}
							
							lnstr += "<li class=\"" + li2Class + "\">" + generateLink(depth, path2, localNavItem[i]["children"][j]["children"][k]["title"], "", "", "") + "</li>\n";
						}
						
						lnstr += "</ul>\n";
					}
					
					lnstr += "</li>\n";
				}
				
				lnstr += "</ul>\n</li>\n";
				break;
			}
		
		if (category == "ir") {
			lnstr += "<li id=\"localNavItem2\">\n<ul>";
			
			for (i = 0; i < localNav2Item.length; i++) {
				path = localNav2Item[i]["page"];
				
				if (localNav2Item[i]["category"] != "")
					path = localNav2Item[i]["category"] + "/" + path;
				
				if (/\/index$/.test(path))
					path = path.slice(0, -5);
				 else
					path += ".html";
				
				lnstr += "<li>" + generateLink(depth, path, localNav2Item[i]["title"], "", "", "") + "</li>\n";
			}
			
			lnstr += "</ul>\n</li>\n";
		}
		
		lnstr += "<li id=\"localNavItemPDF\">" + generateLink(depth, "../company/corporate_profile.pdf", "Corporate Profile (PDF)", "", "", "_blank") + "</li>\n</ul>\n";
		ln.innerHTML += lnstr;
	} else {
		ln.innerHTML = "<div style=\"height:300px;\">&nbsp;</div>";
	}
}

/**
 * フッタエリアを記述する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function drawPublication(category, page)
{
	var pub = document.getElementById("publication"), depth = getBackPath(category, page), pubstr = "<div id=\"footerNav\">\n<ul>\n", maxItemCount = 0, today = new Date();
	var footerNavItem = [
		{	"title":	"About GEO",			"id":	"About",
			"children":	[
				{	"path":	"company/profile/",					"title":	"Corporate Profile"},
				{	"path":	"company/profile/access.html",		"title":	"Access"},
				{	"path":	"company/structure.html",			"title":	"Organization Chart"},
				{	"path":	"company/timeline.html",			"title":	"GEO Group Timeline"},
				{	"path":	"../company/corporate_profile.pdf",	"title":	"Corporate Brochure [PDF]"}
				]},
		{	"title":	"Business Summary",		"id":	"Business",
			"children":	[
				{	"path":	"business/",				"title":	"Business Summary"},
				{	"path":	"business/companies.html",	"title":	"GEO Group Companies"}
				]},
		{	"title":	"Investor Relations",	"id":	"Ir",
			"children":	[
				{	"path":	"ir/",					"title":	"Investor Relations"},
				{	"path":	"ir/management/",		"title":	"Management Policy"},
				{	"path":	"ir/financial/",		"title":	"Financial Data"},
				{	"path":	"ir/library/",			"title":	"Latest IR Materials"},
				{	"path":	"news/",				"title":	"News Releases"},
				{	"path":	"ir/stock/",			"title":	"Stock Information"},
				{	"path":	"ir/stock/benefits/",	"title":	"Special Benefit Program"}
				]},
		{	"title":	"Support",				"id":	"Support",
			"children":	[
				{	"path":	"news/mailmagazine.html",	"title":	"IR News Email Registration"},
				{	"path":	"contact/",					"title":	"Contact Us"},
				{	"path":	"../",					"title":	"Japanese"}
				]}
		];
	
	for (var i = 0; i < footerNavItem.length; i++)
		if (maxItemCount < footerNavItem[i]["children"].length)
			maxItemCount = footerNavItem[i]["children"].length;
	
	for (i = 0; i < footerNavItem.length; i++) {
		pubstr += "<li id=\"footerNavItem" + footerNavItem[i]["id"] + "\" class=\"level1 png\">\n<h2>" + footerNavItem[i]["title"] + "</h2>\n<ul style=\"height:" + (maxItemCount * 20) + "px;\">";
		
		for (j = 0; j < footerNavItem[i]["children"].length; j++)
			pubstr += "<li class=\"level2\">" + generateLink(depth, footerNavItem[i]["children"][j]["path"], footerNavItem[i]["children"][j]["title"], "", "", "") + "</li>\n";
		
		pubstr += "</ul></li>\n";
	}
	
	pubstr
			+= "</ul>\n"
		+ "</div>\n"
		+ "<div id=\"footer\">\n"
			+ "<p id=\"backToTop\"><a href=\"#top\">Back to top</a></p>\n"
			+ "<div id=\"publicationNav\">\n"
				+ "<ul>\n"
					+ "<li><a href=\"" + depth + "privacy.html\">Privacy Policy</a></li>\n"
					+ "<li><a href=\"" + depth + "ir/irpolicy.html\">IR Policy</a></li>\n"
					+ "<li><a href=\"" + depth + "attention.html\">Site Policy</a></li>\n"
				+ "</ul>\n"
				+ "<address>Copyright &copy; " + today.getFullYear() + " GEO HOLDINGS CORPORATION. All rights reserved.</address>\n"
			+ "</div>\n"
		+ "</div>";
	pub.innerHTML += pubstr;
}

/**
 * リンクタグを生成する
 * 
 * @param	string	depth		現在のページからルートディレクトリまでのバックパス
 * @param	string	page		リンク先のパス
 * @param	string	title		リンク文字列
 * @param	string	linkId		リンクに指定するID属性
 * @param	string	linkClass	リンクに指定するCLASS属性
 * @param	string	linkTarget	リンクに指定するTARGET属性
 */
function generateLink(depth, page, title, linkId, linkClass, linkTarget)
{
	var linkStr = "<a";
	
	if (linkId != "")
		linkStr += " id=\"" + linkId + "\"";
	
	if (linkClass != "")
		linkStr += " class=\"" + linkClass + "\"";
	
	linkStr += " href=\"" + depth + page + "\"";
	
	if (linkTarget != "")
		linkStr += " target=\"" + linkTarget + "\"";
	 else if (/(\.pdf$|yellowpage)/i.test(page))
		linkStr += " target=\"_blank\"";
	
	linkStr += ">" + title + "</a>";
	return linkStr;
}

/**
 * 現在のページからルートディレクトリまでのバックパスを取得する
 * 
 * @param	string	category	現在のページのトップレベルカテゴリ
 * @param	string	page		現在のページ
 */
function getBackPath(category, page)
{
	if ( page == "notfound" ) {
		str = "http://www.geonet.co.jp/english/";
	} else {
		var depth = 0, str = "", idx = page.indexOf("/");
		
		if (category != "")
			depth = 1;
		
		while (idx != -1) {
			depth++;
			idx = page.indexOf("/", idx + 1);
		}
		
		for (var i = 0; i < depth; i++)
			str += "../";
	}
	return str;
}

function setActiveStyleSheet(a){var b;for(var c=0;b=document.getElementsByTagName("link")[c];c++)if(b.getAttribute("rel").indexOf("style")!=-1&&b.getAttribute("title")){b.disabled=true;if(b.getAttribute("title")==a)b.disabled=false;}}
function getActiveStyleSheet(){var a;for(var b=0;a=document.getElementsByTagName("link")[b];b++)if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")&&!a.disabled)return a.getAttribute("title");return null;}
function getPreferredStyleSheet(){var a;for(var b=0;a=document.getElementsByTagName("link")[b];b++)if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("rel").indexOf("alt")==-1&&a.getAttribute("title"))return a.getAttribute("title");return null;}
function createCookie(a,b,c){if(c){var d=new Date();d.setTime(d.getTime()+(c*24*60*60*1000));var e="; expires="+d.toGMTString();}else e="";document.cookie=a+"="+b+e+"; path=/";}
function readCookie(a){var b=a+"=",c=document.cookie.split(";");for(var d=0;d<c.length;d++){var e=c[d];while(e.charAt(0)==" ")e=e.substring(1,e.length);if(e.indexOf(b)==0)return e.substring(b.length,e.length);}return null;}
window.onload=function(e){var a=readCookie("style"),b=a?a:getPreferredStyleSheet();setActiveStyleSheet(b);}
window.onunload=function(e){var a=getActiveStyleSheet();createCookie("style",a,365);}
var a=readCookie("style"),b=a?a:getPreferredStyleSheet();
setActiveStyleSheet(b);

