var setLang="2";//en
//m0="2";
//m1="";
//m2="";
//-- s: browser check
var appNum=null;//for ie 6.0

var titleAtrObj = null;

function setTitleAlt()
{
	//window.status = 'x'+event.x +' y'+event.y;
	try
	{		
		if(event.srcElement.id == 'gnbswf')
		{
			if(event.x > 12 && event.x < 118 && event.y > 22 && event.y < 64)
			{
				if(titleAtrObj == null)
				{
					str = "";
					str += "<div id=\"tlayer\" style=\"visibility:visible; z-index: 999;position: absolute;top:33;left:55; width: 300; height: 11; border: black 1px solid; background-color: white; color: #000000; font-size:9pt\">"
					str += "FIRE FIGHTING SYSTEMS AND SAFTY EQUIPMENT";
					str += "</div>";
					obj = document.getElementById('header');
					obj.innerHTML += str;
					titleAtrObj = document.getElementById('tlayer');
				/*
					str = "";
					str += "<div id=\"tlayer\" style=\"position:absolute;visibility:visible;top:40;height:100;left:5;z-index:3;border:0\">";
					str += "<table width=300 height=30 cellpadding=0 cellspacing=0 border=0>";
					str += " <tr>";
					str += " <td style=\"padding:0 7 0 0;font-size:11;color:#00589c;line-height:2ex;letter-spacing:-.1em\">";
					str += " Established in 1975, Hyewang Engineering Co., Ltd has been grown to be leading manufacturer of specialized tools and device for ship builder products such as Rudder Propeller Carrier, Boring Machine, Lug Milling Machine, High Pressure Cleaner, Vacuum Recovery and Explosion Proof Fan.";
					str += " </td>";
					str += " </tr>";
					str += "</table>";
					str += "</div>";
					obj = document.getElementById('header');
					obj.innerHTML += str;
				*/
				}
				else
				{
					titleAtrObj.style.visibility = 'visible';
				}
			}
			else
			{
				if(titleAtrObj == null)
				{
					titleAtrObj = document.getElementById('tlayer');
					titleAtrObj.style.visibility = 'hidden';
				}
				else
				{
					titleAtrObj.style.visibility = 'hidden';
				}
			}
		}
	}catch(e)
	{
	}
}


document.onmousemove = setTitleAlt;
function printLink()
{

	document.write("<div align=\"center\">");
	document.write("<style type=\"text/css\">");
	document.write(".text_link { font-size:9px; color:#CECECE; TEXT-DECORATION: none; FONT-FAMILY: \"Tahoma\"; line-height:14px}");
	document.write(".text_link a:link{ font-size:9px; color:#CECECE; TEXT-DECORATION: none; FONT-FAMILY: \"Tahoma\"; line-height:14px}");
	document.write(".text_link a:active{ font-size:9px; color:#CECECE; TEXT-DECORATION: none; FONT-FAMILY: \"Tahoma\"; line-height:14px}");
	document.write(".text_link a:hover{ font-size:9px; color:#CECECE; TEXT-DECORATION: none; FONT-FAMILY: \"Tahoma\"; line-height:14px}");
	document.write(".text_link a:visited{ font-size:9px; color:#CECECE; TEXT-DECORATION: none; FONT-FAMILY: \"Tahoma\"; line-height:14px}");
	document.write("</style>");
	document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> ");
	document.write(" <tr>");
	document.write("		<td align=\"center\" class=\"text_link\"> ");
	document.write("			<a href=\"/en/systems/sys_info.html?code=systems01\">High Pressure Co2 System</a>£ü");
	document.write("			<a href=\"/en/systems/sys_info.html?code=systems02\">Local Water Mist System</a>£ü");
	document.write("			<a href=\"/en/systems/sys_info.html?code=systems05\">Deck Foam System</a>£ü");
	document.write("			<a href=\"/en/products/prdt_info.html?code=product01\">Fire Fighting Extinguishers</a>£ü");
	document.write("			<a href=\"/en/products/prdt_info.html?code=product03\">Fire Fighting Equipment</a>£ü");
	document.write("			<a href=\"/en/products/prdt_info.html?code=product06\">Chemical Protection</a>£ü");
	document.write("			<a href=\"/en/main/main.html\">English</a>£ü");
	document.write("			<a href=\"/kr/main/main.html\">Korean</a>");
	document.write("		</td>	");
	document.write("  </tr>");
	document.write("</table>");
	document.write("</div>");
	
}

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: addEvent Model
function addEvtFnc(f,types) {
	var evtFnc = window[types];
	if(typeof evtFnc != 'function'){
		window[types] = function(){eval(f);}
	}else{
		var setFnc = function(){eval(f);}
		window[types] = function(){
			if(evtFnc){
				evtFnc();	
			}
			try{
				setFnc();
			}catch(err){
				//	
			}
		}
	}
}
//-- e: addEvent Model

//-- s: set path
pageTitle = "";
function setDepths(){
	var sep1="##", sep2="||", pathStr;
	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> &gt; ";
		}else{
			pathStr+= "<a href='../"+tmpAry[1]+"' title='"+tmpAry[0]+"' class='linkType0'><span class='end_path'>"+tmpAry[0]+"</span></a>";
			if(pageTitle == "") pageTitle = tmpAry[0];			
			writeSwf ("../../common/swf/pagetitle.swf", "titleswf", 664, 39,2,1,'titlearea',1,1);
			//alert(pageTitle);
			//delete local connection code
		}
	}	 
	
	document.getElementById("cpath").innerHTML = pathStr;
}
//-- e: set path

//-- s: page Title
function setTitle(){		
	writeSwf ("../../common/swf/leftmenu.swf", "leftswf", 204, 550,1,1,'dleft',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;
	if(langCode == 1 || (title == 1)) obj += "?";
	if(title == 1){//auto title
		try{
			
			if(pageTitle != ""){
				pageSbj = pageTitle;
				//alert("1 : " + pageSbj);
			}else{
				pageSbj = document.getElementById('titlearea').firstChild.nodeValue;
				//alert("2 : " + pageSbj);
			}
			document.getElementById('titlearea').attributes['title'].value = pageSbj;
			document.getElementById('titlearea').value=pageSbj;
			obj += "sbj="+encodeURIComponent(pageSbj)+"&";//ff patch!
		}catch(err){
			pageSbj = "untitled!";
			obj += "sbj="+pageSbj+"&";
			document.getElementById('titlearea').attributes['title'].value = pageSbj;
		}
		
	}
	
	if(langCode == 1){
		try{
			obj += "setLang=" + setLang +"&m0="+m0+"&m1="+ m1 +"&";//tmp url
			//alert(langCode);
		}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" />';	
		swfObj += '<param name="wmode" value="transparent" />';
		ewinmode = ' wmode="transparent"';	
/*		
	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 + ' quality="high" scale="noscale" 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 == 'dvisual')
	{
		swfObj += "<div id=\"doorst\" style=\"position:absolute;top:105px;height:100px;left:48px;z-index:99;border:0\"> ";
		swfObj += "<table width=400 height=30 cellpadding=0 cellspacing=0 border=0>";
		swfObj += "  <tr>";
		swfObj += "    <td  style=\"padding:0 7 0 0;font-size:11px;color:#ffffff;line-height:2ex;letter-spacing:-.1em\">";
		swfObj += "	FAIN CO., LTD has been providing Fire and Safety solution since 1087, and specializes in High Pressure Co2 System, Local Water, Mist System, Deck Foam System, Fire Fighting Extinguishers, Fire Fighting Equipment and Chemical Protection.";
		swfObj += "	</td>";
		swfObj += "  </tr>";
		swfObj += "</table>";
		swfObj += "</div>";	
	}
	
	if(divName){
		//alert(swfObj);
		document.getElementById(divName).innerHTML = swfObj;		
	}else{
		document.write (swfObj);
	}
}
//-- e: swf pickup

//-- s: swap tab func
function tabLink(a,b){
	if(b == undefined){
		//alert(saveTabObj[3][a]);
		self.location.href = saveTabObj[3][a];
	}else{
		window.open(saveTabObj[3][a],'childwin');
	}
}
//var saveTabObj = [], tmpTabObj = [];//swapTap func variable
var tabGrpIdx = [];
var saveTabObj = [[],[],[],[]], tmpTabObj = [[],[],[]];//swapTap func variable
function tabSwap(a,b,c,d,e,f,g,h,i){
	/***
	arg0: id, arg1:change img, arg2: mouse event(1:over,2:out,3:click), arg3:prePath , arg4: change div Name arrary, 
	arg5: div Name array idx, arg6: length; ,arg7: grp idx (for multi), arg8: urlPath
	***/
	//var tab_idx = tabGrpIdx[h] = h;
	var tab_idx =  h;
	var obj = document.getElementById(a);
	//alert(obj.id);
	var isDir = getFileName(obj.src, 0);
	//alert(isDir);
	var isName = getFileName(obj.src, 1);
	if(d != undefined){
		var path = d+isDir + '/';
	}else{
		var path = isDir + '/';	
	}
	//alert(path);
	if(saveTabObj[0][h] == undefined){
		//alert('no data');		
		saveTabObj[0][tab_idx] = obj;
		saveTabObj[1][tab_idx] = b;
		saveTabObj[2][tab_idx] = isName;
	}
		
	if(c==3){
		if(i != undefined){
			//alert(i);
			//alert('no data');
			saveTabObj[3][tab_idx] = i;
		}
		if(obj != saveTabObj[0][tab_idx]){//save isClick
			saveTabObj[0][tab_idx] = obj;
			saveTabObj[1][tab_idx] = tmpTabObj[1][tab_idx];
			saveTabObj[2][tab_idx] = tmpTabObj[2][tab_idx];
		}else{
			var chkimg = getFileName(saveTabObj[0][tab_idx].src, 1);
			if(chkimg != saveTabObj[1][tab_idx]){
				obj.src = path + saveTabObj[1][tab_idx];
			}
		}
	}
	//alert(saveTabObj);
	if(c == 1){	
		tmpTabObj[0][tab_idx] = obj;
		tmpTabObj[1][tab_idx] = b;
		tmpTabObj[2][tab_idx] = isName;
		//alert(tmpTabObj[2][tab_idx].id);
		if(obj != saveTabObj[0][tab_idx]){
			obj.src = path + b;
			saveTabObj[0][tab_idx].src = path + saveTabObj[2][tab_idx];
		}
	}else if(c == 2){
		if(obj != saveTabObj[0][tab_idx]){
			obj.src = path +b;
			saveTabObj[0][tab_idx].src = path + saveTabObj[1][tab_idx];
		}
	}
	
	if(e != undefined){
		//alert(e);
		var idStr = String(e);
		var isObj = idStr + f;
		for(var k=0; k<g; k++){
			tObj = idStr + k;
			var dvObj = document.getElementById(tObj);
			//alert(dvObj);
			if(tObj == isObj){
				dvObj.style.display = "block";
				dvObj.focus();
			}else{
				dvObj.style.display = "none";
			}
		}
	}
	
	
}
//-- e: swap tab func
//-- s: get file name for URLPATH
function getFileName(){//arg0: file url path, arg1: get file name or file's dir name[true, false]
	var objName = "";
	if(arguments[0]){
		var tmpAry = (arguments[0].replace("/ /gi","%20").replace("/\/gi","/")).split("/");
		//alert("arr : " + tmpAry);
		var preDir = tmpAry[tmpAry.length-2];
		var preName = tmpAry[tmpAry.length-1];
		//alert(preDir);
		if(arguments[1]){
			var chkChar = ['?','#'], objName = preName;
			for(var i=0; i<chkChar.length; i++){
				var chkQryStr = objName.lastIndexOf(chkChar[i]);
				if(chkQryStr>=0){
					objName = objName.substr(0,chkQryStr);
				}else{
					objName = objName;
				}
			}
		}else{
			objName = preDir;
		}
		return objName;
	}else{
		return false;
	}
}
//-- e: get file name for URLPATH
//-- s: setlanguage
function changeLang(a){
	var obj, frm, inp;
	if(!a) a = "en";
	obj=document.body;
	frm = document.createElement("form");
	frm.setAttribute("name","langFrm");
	frm.setAttribute("action","../../index.html");
	frm.setAttribute("method","POST");
	frm.setAttribute("enctype","application/x-www-form-urlencoded");	
	inp = document.createElement("input");
	inp.setAttribute("type","hidden");
	inp.setAttribute("name","setFrtLang");
	inp.setAttribute("value",a);
	frm.appendChild(inp);
	obj.appendChild(frm);
	frm.submit();
}
//-- e: setlanguage
//-- s: select value
function inputSelect(a,b){
	try{
		if(b!=undefined){
			//obj = parent[b].a;
			obj = parent[b].document.getElementById(a);
			//alert(parent[b].document.getElementById(a.id));
		}else{
			obj = document.getElementById(a);
		}
		if(obj.value.length > 0){		
			obj.select();		
		}
	}catch(e){
		alert("object : undefined");
	}
}
//-- e: select value

/** pre code **/
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
	var toolbar_str = toolbar ? 'yes' : 'no';
	var menubar_str = menubar ? 'yes' : 'no';
	var statusbar_str = statusbar ? 'yes' : 'no';
	var scrollbar_str = scrollbar ? 'yes' : 'no';
	var resizable_str = resizable ? 'yes' : 'no';
	
	var cookie_str = document.cookie;
	cookie_str.toString();
	
	var pos_start  = cookie_str.indexOf(name);
	pos_start  = cookie_str.indexOf('=', pos_start);
	var pos_end    = cookie_str.indexOf(';', pos_start);
	
	if (pos_end <= 0) pos_end = cookie_str.length;
	
	var cookie_val = cookie_str.substring(pos_start + 1, pos_end);
	
	if (cookie_val  == "done") {
		return;
	}	
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function openMsg(){
	//var msgW = "window.open('http://form.gabia.co.kr/form_mail.php?tbl=fainkorea_com','msgwin','width=600,height=500,left=0,top=0')";
	//na_open_window('win', 'http://form.gabia.co.kr/form_mail.php?tbl=fainkorea_com', 0, 0, 600, 500, 0, 0, 0, 0, 1);
	window.open('http://form.gabia.co.kr/form_mail.php?tbl=fainkorea_com','msgwin','width=600,height=500,left=0,top=0');	
}

