window.onload = function(){
navList();
tabNav("tabId",0);
chgDownload();
}

function navList(){
	var navItem = document.getElementById("nav").getElementsByTagName("li");
	for(var i=0;i<navItem.length;i++){
		if(navItem[i].className == "parentNav"){
			navItem[i].onmouseover = function(){showSubNav(this)};
			navItem[i].onmouseout = function(){hideSubNav(this)};
		}
	}
}
function showSubNav(li){li.getElementsByTagName("ul")[0].style.display = "block";li.getElementsByTagName("ul")[0].getElementsByTagName("li")[0].style.borderTop = "8px solid #000";}
function hideSubNav(li){li.getElementsByTagName("ul")[0].style.display = "none";}

/*-----------------------------------------------------------*/

function $(){
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string'){
			if(document.getElementById(element)){
				element = document.getElementById(element);}
			else{
				element = document.getElementsByName(element);
			}
			if (arguments.length == 1){
				return element;
			}
		}
		elements.push(element);
	}
	return elements;
 };


function tabNav(navObj,d){
	if(!document.getElementById(navObj)) return false;
	var tabli = $(navObj).getElementsByTagName("li");
	tabli[d].className = "focus";
	for(var i=0;i<tabli.length;i++){
		var tabA = tabli[i].firstChild;
		tabA.onclick = function(){trunTab(this);return false;}
	}
	function trunTab(btn){
		var target = btn.href.split("#")[1];
		var targetObj = target.substr(0,target.length-1);
		for(var j=0;j<tabli.length;j++){
			tabli[j].className = "";
			var n = j+1;
			$(targetObj+n).style.display = "none"

		}
		btn.parentNode.className = "focus";
		$(target).style.display = "block";

	}
}
/*
function chgDownload(){
	var lang = navigator.language || navigator.userLanguage;
	if(lang.substr(0, 3) == "zh-"){
		$("proBtn").href = $("proBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-video-converter-pro.exe";
		$("ipodBtn").href = $("ipodBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-ipod-video-converter.exe";
		$("iphoneBtn").href = $("iphoneBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-iphone-video-converter.exe";
		$("pspBtn").href = $("pspBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-psp-video-converter.exe";
		$("mp4Btn").href = $("mp4Btn_m").href = "http://202.101.62.6/Dominoconvert/domino-mp4-video-converter.exe";
		$("gp3Btn").href = $("gp3Btn_m").href = "http://202.101.62.6/Dominoconvert/domino-3gp-video-converter.exe";
		$("flvBtn").href = $("flvBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-flv-video-converter.exe";
		$("zuneBtn").href = $("zuneBtn_m").href = "http://202.101.62.6/Dominoconvert/domino-zune-video-converter.exe";
	}
}
*/