var setLang="2";//en
//m0="2";
//m1="";
//m2="";
//-- s: browser check
var appNum=null;//for ie 6.0
setBrowser = function (){//IE=0,FF=1,OPERA=2,etc=0;
	var wna = window.navigator.userAgent;
	if(wna.indexOf('MSIE')!=-1){
		this.browser=0;
		appNum = eval(navigator.appVersion.substr(navigator.userAgent.indexOf("MSIE") - 3,3));
	}else if(wna.indexOf('Firefox')!=-1){
		this.browser=1;
	}else  if(wna.indexOf('Opera')!=-1){
		this.browser=2;
	}else if(document.all){//etc = 0;
		this.browser=0;
	}else{
		this.browser=null;
	}
	return this.browser;
}

var app = setBrowser();
//-- e: browser check
//-- s: isId
function getEid(n,f) {	
	try{
		if(f){			
			var isObj = parent.main.document.getElementById(n);
		}else{
			var isObj = document.getElementById(n);
		}

		if(document.getElementById(n) != null){
			return isObj;
		}else{
			return null;
		}		
	}catch(err){
		return null;
	}
}
//-- e: isId
//-- s: set path
var pageTitle = "";
function setDepths(){
	var sep1="##", sep2="||";
	var pathStr = "<a href='../main.asp' title='HOME' class='linkType0'>HOME</a> > ";
	var pathAry = arguments[0].split(sep1);
	for(var a=0; a<pathAry.length; a++){
		var tmpAry = pathAry[a].split(sep2);
		if(a==0){
			pathStr += "<a href='"+tmpAry[1]+"' title='"+tmpAry[0]+"' class='linkType0'>"+tmpAry[0]+"</a> > ";
		}else{
			pathStr += "<a href='/"+tmpAry[1]+"' title='"+tmpAry[0]+"' class='linkType0'><span class='end_path'>"+tmpAry[0]+"</span></a>";
			//if(pageTitle == "")pageTitle = tmpAry[0];
		}
	}	 
	//alert(pathStr);
	document.getElementById("cpath").innerHTML = pathStr;
}
//-- e: set path

//-- s: page Title
function setTitle(){
	writeSwf ("pagetitle.swf", "titleswf", 692, 51,2,1,'titlearea',1,1);
}
//-- e: page Tile

//-- s:swf pickup [file name, id, width, height, transparent or opaque(true, false), control name for mozilla (true, false), use innerHTML, langCode, auto Title]
function writeSwf (obj, objId, width, height, winmode, mozid, divName, langCode, title) {
	var ewinmode, objName, pageSbj, pageSbjAttr;
	
	if(langCode == 1 || (title == 1)) obj += "?";
	
	if(title == 1){//auto title
		try{
			
			if(pageTitle != ""){//bug
				alert(pageTitle);
				pageSbj = pageTitle;
			}else{
				var titleObj = document.getElementById('titlearea');
				var titleCnt = 0;
				var partStr = "";
				for(var i=0; i< titleObj.childNodes.length;i++){
					if(titleObj.childNodes[i].nodeType == 1) {
						//alert(titleObj.childNodes[i].childNodes[0].nodeValue);
						if(titleCnt == 0){
							pageSbj = titleObj.childNodes[i].childNodes[0].nodeValue + "||";
						}else{
							if(setLang != "2"){
								pageSbj += titleObj.childNodes[i].childNodes[0].nodeValue;
								partStr = " ";
							}
						}
						//pageSbjAttr
						titleCnt++;
					}
				}
				pageSbjAttr = pageSbj.replace("||",partStr);
				//alert(pageSbj + " , " + pageSbjAttr);
			}
			document.getElementById('titlearea').attributes['title'].value = pageSbjAttr;
			obj += "sbj="+encodeURIComponent(pageSbj)+"&";//ff patch!
			//if(setLang == 2){
				//obj = obj.replace("%20","").replace("%20","");
			//}
		}catch(err){
			pageSbj = "untitled!";
			obj += "sbj="+pageSbj+"&";
			document.getElementById('titlearea').attributes['title'].value = pageSbj;
		}
	}
	
	if(langCode == 1){
		try{
			if(typeof(m0) == "undefined" || typeof(m1) == "undefined") {
				obj += "setLang=" + setLang;
			}else{
				obj += "setLang=" + setLang +"&m0="+m0+"&m1="+ m1 +"&";//tmp url
			}
		}catch(langErr){
			//
		}
	}
	
	var swfObj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width + '" height="'+ height + '" id="'+ objId  + '" align="top">'
		+ '<param name="allowScriptAccess" value="always" />'
		+ '<param name="movie" value="' + obj + '" />'
		+ '<param name="menu" value="false" />'
		+ '<param name="quality" value="high" />';	
		+ '<param name="scale" value="noscale" />';		
	if(winmode == 1){//transparent
		swfObj += '<param name="wmode" value="transparent" />';
		ewinmode = ' wmode="transparent"';		
	}else if(winmode==2){//opaque
		swfObj += '<param name="wmode" value="opaque" />';
		ewinmode = ' wmode="opaque"';
	}else{
		ewinmode = '';
	}
	if(mozid){//swfObject control name for mozilla
		objName = ' name="'+objId+'"';
	}else{
		objName = '';	
	}
	swfObj += '<embed src="' + obj + '" menu="false"' + ewinmode + objName + ' scale="noScale" quality="high" bgcolor="#ffffff" width="' + width + '" height="'+ height  +'" id="' + objId + '" align="top" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect="true" /></object>';
	if(divName){
		//alert(swfObj);
		document.getElementById(divName).innerHTML = swfObj;
	}else{
		document.write (swfObj);
	}
}
//-- e: swf pickup

//-- s: swap tab func

