﻿// JavaScript Document
function FSWORKS(){}

FSWORKS.GetIeVersion = function()
{
    var reg = new RegExp("MSIE ([^;]*);", "i");
    if (reg.test(navigator.appVersion)) return parseInt(RegExp.$1);
    return 0;
};

FSWORKS.Init = function()
{
	FSWORKS.ieVersion = FSWORKS.GetIeVersion();
	FSWORKS.AppendCss();
	FSWORKS.CreateNav();
	FSWORKS.CheckVersion();
};

FSWORKS.AppendCss = function()
{
	with(document)
	{
	write("<style type=\"text/css\">");
	write("#Nav ul{display:none;position:absolute;left:-10px;top:23px;list-style-type:none;margin:0px;padding:0px;width:180px;border:1px solid #666666;}");
	write("#Nav li a{padding:3px;color:#000000;background-color:#dddddd;text-decoration:none;display:block;height:20px;line-height:20px;}");
	write("#Nav li a:hover{color:#ffffff;background-color:#666666;}");
	write("</style>");
	}
};

FSWORKS.AppendNav = function(name,url,ver)
{
	var o=document.createElement("li");
	if(url)o.innerHTML="<a href='"+url+"'>"+name+"</a>";
	else o.innerHTML="<a>"+name+"</a>";
	FSWORKS.nav.appendChild(o);
};

FSWORKS.AttachNav = function()
{
	eval("FSWORKS.navcase.onmouseover = function(e) { FSWORKS.nav.style.display='block';}");
	if(FSWORKS.ieVersion)
		eval("FSWORKS.navcase.onmouseleave = function(e) { FSWORKS.nav.style.display='none'; }");
	else
		eval("FSWORKS.navcase.onmouseout = function(e) { FSWORKS.nav.style.display='none';}");
};

FSWORKS.CreateNav = function()
{
	FSWORKS.navcase = document.getElementById("Nav");
	FSWORKS.nav=document.createElement("ul");
	FSWORKS.navcase.appendChild(FSWORKS.nav);
	FSWORKS.AppendNav("风声 ASP 无组件上传类","http://www.fonshen.com/UpLoadClass/","UpLoadClass_V2.11");
	FSWORKS.AppendNav("风声 ASP 上传组件","http://www.fonshen.com/FonshenASP/","FonshenASP_V2.01");
	FSWORKS.AppendNav("风声 ASP 列表分页类","http://www.fonshen.com/ListPager/","ListPager_V1.02");
	FSWORKS.AppendNav("风声 JS 菜单树","http://www.fonshen.com/MenuTree/","MenuTree_V1.00");
	FSWORKS.AppendNav("风声 JS 窗口","http://www.fonshen.com/Window/","Window_V1.00");
	FSWORKS.AttachNav();
};

FSWORKS.CheckVersion = function()
{
	var s = document.body.id.split("_");
	FSWORKS.codename = s[0];
	FSWORKS.version = s[1];
};

FSWORKS.AppendAD = function()
{
	var context = document.getElementById("Context");
	var header = document.createElement("div");
	var logo = document.createElement("div");
	logo.style.cssText = "float:left;padding:5px 0px 5px 0px;font-size:12px;width:200px;";
	logo.innerHTML = "<img src=\"http://www.fonshen.com/FonshenASP/images/logo.gif\" width=\"144\" height=\"50\" alt=\"fonshen\" />WORKS";
	/*
	var banner = document.createElement("div");
	banner.style.cssText = "text-align:right;";
	banner.innerHTML = "<a href=\"http://www.qiqir.com\" target=\"_blank\"><img src=\"http://www.fonshen.com/images/ad/qiqir.jpg\" width=\"468\" height=\"60\" alt=\"琪琪儿\" border=\"0\" /></a>";
	*/
	if(FSWORKS.ieVersion)
	{
		var banner = document.createElement("<iframe frameBorder=0 scrolling=no></iframe>");
	}
	else
	{
		var banner = document.createElement("iframe");
		banner.frameBorder="0";
		banner.scrolling="no";
	}
	banner.style.cssText = "width:480px;height:60px;";
	banner.src = "http://www.fonshen.com/scripts/AD_1.htm";
	var clear = document.createElement("div");
	clear.style.cssText = "clear:left;";
	header.appendChild(logo);
	header.appendChild(banner);
	header.appendChild(clear);
	context.insertBefore(header, FSWORKS.navcase);
};

FSWORKS.AppendCR = function()
{
	FSWORKS.copyright = document.getElementById("Copyright");
	FSWORKS.copyright.innerHTML += " <a href=\"http://www.fonshen.com/"+FSWORKS.codename+".htm\" target=\"_blank\">反馈建议</a>";
};

FSWORKS.Init();
FSWORKS.AppendAD();
FSWORKS.AppendCR();