﻿function createNode(tag) {
	return document.createElement(tag);
}


function createTxt(str){
	return document.createTextNode(str);
}


function addNav(parent,navArray,i) {
	if(navArray[i] && navArray[i+2] && typeof navArray[i] == "string") {
		var liElem = createNode("li");
		var aElem = createNode("a");
		var txt = createTxt(navArray[i]);
		if(navArray[i+1] == "#") {//无链接的话
			if(navArray[i+2] == "b")
				aElem.style.backgroundColor = "#F5F5F5";
			aElem.onmouseover = function() {
				this.style.cursor = "default";
				if(navArray[i+2] == "b") 
					this.style.backgroundColor = "#F5F5F5";
				this.style.color = "#333";
				this.style.textDecoration = "none";
			}
			
			aElem.onclick = function() {
				return false;
			}
			
		} else {
			aElem.href = navArray[i+1];
		}
			
		if(navArray[i+2] == "b") {
			var B = createNode("b");
			B.appendChild(txt);
			aElem.appendChild(B);
		} else {
			aElem.appendChild(txt);
		}
		
		liElem.appendChild(aElem);
		parent.appendChild(liElem);
		
		if(navArray[i+3] && typeof navArray[i+3] == "object" ) {
			var ulElem = createNode("ul");
			liElem.appendChild(ulElem);
			addNav(ulElem, navArray[i+3], 0);
			if(navArray[i+4] && typeof navArray[i+4] == "string"){
				addNav(parent,navArray, i+4);
			}
		} else if(navArray[i+3] && typeof navArray[i+3] == "string") {
			addNav(parent,navArray,i+3);
		}
		return false;
	}
	else return false;
}

function do_nav_html(title) {
	//三维数组，每一项有站四个标号，第四个标号为下级菜单数组。
	var navArray = [
		"解决方案","http://www.fuxinsoftware.com.cn/solutions/","none",
		["概述","http://www.fuxinsoftware.com.cn/solutions/","none",
		 "Foxit DRM","http://www.fuxinsoftware.com.cn/solutions/drm/","none",
		 "移动解决方案","http://www.fuxinsoftware.com.cn/solutions/mobile.htm","none",
		 "开发者解决方案","http://www.fuxinsoftware.com.cn/solutions/developer.htm","none",
		 "联合品牌","http://www.fuxinsoftware.com.cn/solutions/cobranding.htm","none",
		 "PDF项目定制","http://www.fuxinsoftware.com.cn/solutions/customization.htm","none"
		],
		"产品信息","http://www.fuxinsoftware.com.cn/products/","none",
		[
			"普通用户","#","b",
			//" - 消费电子(电子书)","http://www.fuxinsoftware.com.cn/ebook/","none",
			" - 软件工具 >>","#","none",
			[
			 //"福昕风腾PDF电子文档套件","http://www.fuxinsoftware.com.cn/pdf/fengteng/","none",
			 "Foxit Reader系列","#","b",
			 "- Foxit Reader for Windows","http://www.fuxinsoftware.com.cn/products/reader/","none",
				"- Foxit Reader for Windows Mobile","http://www.fuxinsoftware.com.cn/pdf/mobile/winmobile.htm","none",
				"- Foxit Reader for Symbian UIQ 3.X","http://www.fuxinsoftware.com.cn/pdf/symbian/symbianuiq3_x.html","none",
				"- Foxit Reader for Embedded Linux","http://www.fuxinsoftware.com.cn/pdf/mobile/embeddedlinux.htm","none",
				"- Foxit Reader for Desktop Linux","http://www.fuxinsoftware.com.cn/pdf/desklinux/","none",
				"- Foxit Reader for U3","http://www.fuxinsoftware.com.cn/pdf/u3/","none",
			 "Foxit PDF 系列","#","b",
				"- 福昕风腾PDF电子文档套件","http://www.fuxinsoftware.com.cn/pdf/fengteng/","none",
				//"- Foxit PDF Page Organizer","http://www.fuxinsoftware.com.cn/pdf/po_intro.php","none",
				//"- Foxit Form Designer","http://www.fuxinsoftware.com.cn/pdf/designer/","none"
			 ],
			"风腾PDF电子文档套件","http://www.fuxinsoftware.com.cn/pdf/fengteng/","b",
			"中小型企业","#","b",
			" - 福昕PDF套件","http://www.fuxinsoftware.com.cn/products/phantomPDF/","none",
			" - Foxit Reader系列 >>","#","none",
			["- Foxit Reader for Windows","http://www.fuxinsoftware.com.cn/products/reader/","none",
				"- Foxit Reader for Windows Mobile","http://www.fuxinsoftware.com.cn/pdf/mobile/winmobile.htm","none",
				"- Foxit Reader for Symbian UIQ 3.X","http://www.fuxinsoftware.com.cn/pdf/symbian/symbianuiq3_x.html","none",
				"- Foxit Reader for Embedded Linux","http://www.fuxinsoftware.com.cn/pdf/mobile/embeddedlinux.htm","none",
				"- Foxit Reader for Desktop Linux","http://www.fuxinsoftware.com.cn/pdf/desklinux/","none",
				"- Foxit Reader for U3","http://www.fuxinsoftware.com.cn/pdf/u3/","none"
			 ],
			" - Foxit PDF IFilter","http://www.fuxinsoftware.com.cn/pdf/ifilter/","none",
			"大型企业","#","b",
			" - 福昕PDF套件","http://www.fuxinsoftware.com.cn/products/phantomPDF/","none",
			" - Foxit PDF IFilter","http://www.fuxinsoftware.com.cn/pdf/ifilter/","none",
			"开发工具","#","b",
			" - PhantomPDF Plug-in SDK ","http://www.fuxinsoftware.com.cn/products/sdk/phantomPDF_plugin/","none",
			" - Foxit PDF SDK >>","#","none",
			["Foxit PDF SDK (ActiveX)","http://www.fuxinsoftware.com.cn/products/sdk/activex/","none",
				"Foxit PDF SDK (DLL)","http://www.fuxinsoftware.com.cn/products/sdk/dll/","none",
				"Foxit Embedded SDK","http://www.fuxinsoftware.com.cn/pdf/sdk/embedded/","none"
			],
			" - Foxit Windmill","http://www.fuxinsoftware.com.cn/pdf/windmill/","none",
			"在线服务","#","b",
			" - 佳印网印刷服务","http://www.joyinker.com","none",
			" - On Demand Content Management","http://www.ondemandcm.com/","none"
		 ],
		"下载中心","http://www.fuxinsoftware.com.cn/downloads/","none",
		["下载中心","http://www.fuxinsoftware.com.cn/downloads/","none"],
		"销售与购买","http://www.fuxinsoftware.com.cn/purchase/pricing.htm","none",
		[
			"代理商","http://www.fuxinsoftware.com.cn/reseller_chn.htm","none",
		 "产品单价表","http://www.fuxinsoftware.com.cn/purchase/pricing.htm","none",
		 "诚招代理","http://www.fuxinsoftware.com.cn/reseller.htm","none"
		 ],
		"服务与支持","http://www.fuxinsoftware.com.cn/support/","none",
		["概述","http://www.fuxinsoftware.com.cn/support/","none",
		 "常见技术问题","http://www.fuxinsoftware.com.cn/support/techsupport/","none",
		 "安全报告提交","http://www.fuxinsoftware.com.cn/support/security_advisories.html","none",
		 "用户手册","http://www.fuxinsoftware.com.cn/support/usermanuals/","none",
		 "在线技术支持","http://www.fuxinsoftware.com.cn/support/ticket/","none",
		 "视频教程","http://www.fuxinsoftware.com.cn/support/video/","none"
		],
		"公司概况","http://www.fuxinsoftware.com.cn/company/","none",
		["公司简介","http://www.fuxinsoftware.com.cn/company/","none",
		 "公司活动","http://www.fuxinsoftware.com.cn/company/activity.html","none",
		 "公司历史","http://www.fuxinsoftware.com.cn/company/history.htm","none",
		 "奖项与荣誉","http://www.fuxinsoftware.com.cn/company/awards.html","none",
		 "联系我们","http://www.fuxinsoftware.com.cn/company/contact.htm","none"
		 ],
		"诚聘英才","http://www.fuxinsoftware.com.cn/company/jobsfz.htm","none",
		[ "福州","http://www.fuxinsoftware.com.cn/company/jobsfz.htm","none",
			"北京","http://www.fuxinsoftware.com.cn/company/jobs.htm","none"
		 ]
		];
		var top = document.getElementById("pageHeaderNav");
		var ulElem = createNode("ul");
		ulElem.className = "contain";
		top.appendChild(ulElem); 
		addNav(ulElem, navArray, 0);
		
		var subElem = ulElem.childNodes;
		for(var i = 0; i < subElem.length; i++)
		{
				var txt = subElem[i].getElementsByTagName("A")[0].lastChild.nodeValue
				if(txt == "title")
						subElem[i].className = "active";
				else subElem[i].className = "top";
		}
		subElem[1].lastChild.className = "products";
		subElem[1].lastChild.childNodes[12].getElementsByTagName("A")[0].setAttribute("target","_blank");
		subElem[1].lastChild.lastChild.getElementsByTagName("A")[0].setAttribute("target","_blank");
}


function do_header_html() {
	var header_str = '\
		<h1><a href="http://www.fuxinsoftware.com.cn/"><img src="http://www.fuxinsoftware.com.cn/images/foxit.gif" width="323" height="47" alt="福昕软件" /></a></h1> \
		<ul id="topnav"> \
			<li><a href="http://foxit.tmall.com" target="_blank">福昕淘宝商城</a>|</li> \
			<li><a href="http://t.sina.com.cn/foxitsoftware" target="_blank">上福昕微博</a>|</li> \
			<li><a href="http://www.fuxinsoftware.com.cn/support/techsupport">常见技术问题</a>|</li> \
			<li><a href="http://bbs.fuxinsoftware.com.cn/" target="_blank">论坛</a>|</li> \
			<li><a href="http://www.fuxinsoftware.com.cn/company/contact.htm">联系我们</a>|</li> \
			<li><a href="http://www.foxitsoftware.com/">English</a></li> \
		</ul>';
	
	if (navigator.appName=='Microsoft Internet Explorer') {
		pageHeader.innerHTML=header_str;
	} else {
		document.write(header_str);
	}
}

function do_footer_html() {
	var footerstr = ' \
		<p>&copy; 2011 Foxit Corporation. All rights reserved<br /><br /> \
			许可证号:闽ICP备07502172号-1&nbsp;&nbsp;版权所有 福昕软件开发有限公司<br /><br /> \
			技术支持热线:0591-88003261<br /><br /> \
			工作时间：8:00-21:00 </p>';
	
	if (navigator.appName=='Microsoft Internet Explorer') {
		footer.innerHTML=footerstr;
	} else {
		document.write(footerstr);
	}
}


