﻿/////////////////// SSL 보안사이트 적용 ///////////////////////////////
mylocation = location.href;
mypath = location.pathname;
pagename = mypath.split("/");
ssl_url= "https://www.stxconst.co.kr";
web_url= "http://www.stxconst.co.kr";
var fullpath;

if ( ( (pagename[2]=="customer")&&(pagename[3]=="customer_0201.asp")) ) // -->https(SSL SITE)로 접속해야 하는 페이지
{
	webgubun = /http:/;
	if (location.protocol=="http:"){ //http로 접속시 https로 강제 이동시킴
		fullpath= mylocation.split(web_url);
		location.href=ssl_url + fullpath[1];
	}else{//https로 접속시 
	}
	
}else if( ((pagename[1]=="eng")&&(pagename[2]=="customer")&&(pagename[3]=="customer_01.asp")) ) // -->https(SSL SITE)로 접속해야 하는 페이지
{
	webgubun = /http:/;
	if (location.protocol=="http:"){ //http로 접속시 https로 강제 이동시킴
		fullpath= mylocation.split(web_url);
		location.href=ssl_url + fullpath[1];
	}else{//https로 접속시 
	}
}else{ // -->http(보통웹)로 접속해야 하는 페이지
	webgubun = /https:/;
	if (location.protocol=="https:"){ //https로 접속시 http로 강제 이동시킴
		fullpath= mylocation.split(ssl_url);
		location.href=web_url + fullpath[1];
	}else{//http로 접속시 
	}
}

/////////////////// SSL 보안사이트 적용///////////////////////////////
	





var NS = (document.layers);
var IE = (document.all);

function windowo(targetURL,wName,w,h,tscrollbars,matrixL,matrixT,tstatus,resizable,direction,tlocation,tmenubar,ttoolbar,titlebar,fullscreen) {
	var wOption="width="+w+",height="+h;
	if(tscrollbars == null) { wOption = wOption+",scrollbars=no"; } else { wOption = wOption+",scrollbars=yes"; }
	if(matrixL == null) { wOption = wOption+",left=0"; } else { wOption = wOption+",left="+matrixL }
	if(matrixT == null) { wOption = wOption+",top=0"; } else { wOption = wOption+",top="+matrixL }
	wOption = wOption + "status=no, resizable=no,direction=no,location=no,menubar=no,toolbar=no,titlebar=no,fullscreen=no";
	// alert(wOption);
	window.open(targetURL,wName,wOption);
}

// OBJECT 통합생성 스크립트
function makeobject(type,path,w,h,id,vars,transparent,bg) {

	this.type = type; // flash, applet, movie
	this.id = id;
	this.path = path;
	this.w = w;
	this.h = h;
	this.vars = (vars) ? vars : '';
	this.trnasparent = (transparent) ? transparent : 'transparent';
	this.bg = (bg) ? bg : '#ffffff';
	
	this.gettag =
		function() {
			switch(this.type) {
				case 'flash' :
					this.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
					this.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
					this.tag = "<object classid='"+this.classid+"' codebase='"+this.codebase+"' id='"+this.id+"' width='"+this.w+"' height='"+this.h+"'>";
					this.tag += "<param name='movie' value='"+this.path+"' />";
					this.tag += "<param name='allowScriptAccess' value='always' />";
					if(this.vars) this.tag += "<param name='FlashVars' value='"+this.vars+"' />";
					if(this.trnasparent) this.tag += "<param name='wmode' value='"+this.trnasparent+"' />";
					this.tag += "<param name='menu' value='false' />";
					this.tag += "<param name='quality' value='high' />"
					this.tag += "<param name='bgcolor' value='"+this.bg+"' />";
					this.tag += "<param value='"+this.path+"'>";
					this.tag += "<param name='base' value='.'>";
					this.tag += "<embed src='"+this.path+"'";
					if(this.vars) this.tag += " FlashVars='"+this.vars+"'";
					if(this.trnasparent) this.tag += " wmode='"+this.trnasparent+"'";
					this.tag += " width='"+this.w+"'";
					this.tag += " height='"+this.h+"'";
					this.tag += " bgcolor='"+this.bg+"'";
					this.tag += " name='"+this.id+"'";
					this.tag += " menu='false'";
          this.tag += " base='.'";
					this.tag += " quality='high'";
					this.tag += " allowScriptAccess='always'";
					this.tag += " type='application/x-shockwave-flash'";
					this.tag += " pluginspage='http://www.macromedia.com/go/etflashplayer'";
					this.tag += " />";
					this.tag += "</object>";
					return this.tag;
					break;
			}

		}	

	this.writetag =
		function() {
			document.write(this.gettag());
			//Flash의 ExternalInterface가 Form Tag내에서 오류나는 버그를 해결하는 코드
			eval("window." + this.id + " = document.getElementById('" + this.id + "');");
		}
}


// OBJECT 통합생성 스크립트
function sslmakeobject(type,path,w,h,id,vars,transparent,bg) {

	this.type = type; // flash, applet, movie
	this.id = id;
	this.path = path;
	this.w = w;
	this.h = h;
	this.vars = (vars) ? vars : '';
	this.trnasparent = (transparent) ? transparent : 'transparent';
	this.bg = (bg) ? bg : '#ffffff';
	
	this.gettag =
		function() {
			switch(this.type) {
				case 'flash' :
					this.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
					this.codebase = 'https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
					this.tag = "<object classid='"+this.classid+"' codebase='"+this.codebase+"' id='"+this.id+"' width='"+this.w+"' height='"+this.h+"'>";
					this.tag += "<param name='movie' value='"+this.path+"' />";
					this.tag += "<param name='allowScriptAccess' value='always' />";
					if(this.vars) this.tag += "<param name='FlashVars' value='"+this.vars+"' />";
					if(this.trnasparent) this.tag += "<param name='wmode' value='"+this.trnasparent+"' />";
					this.tag += "<param name='menu' value='false' />";
					this.tag += "<param name='quality' value='high' />"
					this.tag += "<param name='bgcolor' value='"+this.bg+"' />";
					this.tag += "<param value='"+this.path+"'>";
					this.tag += "<param name='base' value='.'>";
					this.tag += "<embed src='"+this.path+"'";
					if(this.vars) this.tag += " FlashVars='"+this.vars+"'";
					if(this.trnasparent) this.tag += " wmode='"+this.trnasparent+"'";
					this.tag += " width='"+this.w+"'";
					this.tag += " height='"+this.h+"'";
					this.tag += " bgcolor='"+this.bg+"'";
					this.tag += " name='"+this.id+"'";
					this.tag += " menu='false'";
          this.tag += " base='.'";
					this.tag += " quality='high'";
					this.tag += " allowScriptAccess='always'";
					this.tag += " type='application/x-shockwave-flash'";
					this.tag += " pluginspage='https://www.macromedia.com/go/etflashplayer'";
					this.tag += " />";
					this.tag += "</object>";
					return this.tag;
					break;
			}

		}	

	this.writetag =
		function() {
			document.write(this.gettag());
			//Flash의 ExternalInterface가 Form Tag내에서 오류나는 버그를 해결하는 코드
			eval("window." + this.id + " = document.getElementById('" + this.id + "');");
		}
}


function addLoadEvent(funct) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = funct;
  } else {
    window.onload = function() {
      oldonload();
      funct();
    }
  }
}

function imgover(img) {
	img.src = img.src.replace('.gif','_over.gif');
}

function imgrecover(img) {
	img.src = img.src.replace('_over.gif','.gif');
}


/* obj : 객체, active : 활성화 코드 */
function initTabControllerType01(obj,active) {
	tabobj = document.getElementById(obj);
	tabobjList = tabobj.getElementsByTagName('li');


	for(i=0;i<tabobjList.length;i++) {
		tabobjList[i].getElementsByTagName('a').item(0).onclick = function() {
			return false;
		}
		tabobjList[i].onclick = function() {
			clear();
			getObj = this.getElementsByTagName('a').item(0);
			document.getElementById(getObj.href.split('@')[1]).style.display="block";
			getObj.getElementsByTagName('img').item(0).src = getObj.getElementsByTagName('img').item(0).src.replace('.gif','_on.gif');

			if(this.previousSibling) {
				preobj = (this.previousSibling.nodeType != '1') ? this.previousSibling.previousSibling.getElementsByTagName('a').item(0): this.previousSibling.getElementsByTagName('a').item(0);
				preobj.getElementsByTagName('img').item(0).src = preobj.getElementsByTagName('img').item(0).src.replace('.gif','_over.gif');
			}
			if(this.nextSibling && this.className != 'first') {
				nextobj = (this.nextSibling.nodeType != '1') ? this.nextSibling.nextSibling.getElementsByTagName('a').item(0): this.nextSibling.getElementsByTagName('a').item(0);
				nextobj.getElementsByTagName('img').item(0).src = nextobj.getElementsByTagName('img').item(0).src.replace('.gif','_over.gif');
			}

			return false;
		}
	}

	function clear() {

		for(i=0;i<tabobjList.length;i++) {
			objname = tabobjList[i].getElementsByTagName('a').item(0);
			imgreset = objname.getElementsByTagName('img').item(0);
			imgreset.src = imgreset.src.replace('_on.gif','.gif');
			imgreset.src = imgreset.src.replace('_over.gif','.gif');
			document.getElementById(objname.href.split('@')[1]).style.display="none";
		}
	}

	if(active) { tabobjList[active-1].onclick(); } else { tabobjList[0].onclick(); }
}

function faqinit_type01(obj) {
	getObj = document.getElementById(obj);
	getDt = getObj.getElementsByTagName('dt');
	for(i=0;i<getDt.length;i++) {
		getDt[i].onclick = function() {
			if(this.className == "select") { 
				this.setAttribute('class','');
				this.className = '';
				if(this.nextSibling.nodeType != '1') this.nextSibling.nextSibling.style.display = "none";
				else this.nextSibling.style.display = "none";
			} 
			else {
				getDd = this.parentNode.getElementsByTagName('dd');
				getDt = this.parentNode.getElementsByTagName('dt');
				for(j=0;j<getDd.length;j++) {
					getDt[j].className = "";
					getDd[j].style.display = "none";
				}
      	
				this.setAttribute('class','select');
				this.className = 'select';
				if(this.nextSibling.nodeType != '1') this.nextSibling.nextSibling.style.display = "block";
				else this.nextSibling.style.display = "block";
			}

		}
	}
}

function makeTagDesign(type,obj,styleoption) {

/*
	Type = "file" 일 경우 태그는
	<div id="filetag01" class="filetag"><input type="file" style="width:300px;" class="/front/images/btn/btn_filefind.gif" /></div>
	class명으로 버튼경로 넣습니다. filetag스타일시트 설정

	.filetag {
		filter:alpha(opacity: 0); outline: none;
		selector-dummy:expression(this.hideFocus=true);-moz-opacity:0;
		position:absolute;
		cursor:pointer;
	}
*/

	switch(type) {
		case 'file':
			var fileobj = document.getElementById(obj).getElementsByTagName('input').item(0);

			fileobjBtnName = fileobj.className;
			fileobjWidth = (fileobj.style.width=='') ? '300' : parseInt(fileobj.style.width);

			var newObj = document.createElement("input");
			newObj.setAttribute('type','text');
			newObj.setAttribute('width',fileobjWidth);

			var btnObj = document.createElement("img");
			btnObj.setAttribute('src',fileobjBtnName);

			document.getElementById(obj).appendChild(newObj);
			document.getElementById(obj).appendChild(btnObj);

			newObj.readOnly = true;

			fileobj.className = fileobj.className + " filetag";
			fileobj.style.width = "1";
			fileobj.style.marginLeft = fileobjWidth;

			fileobj.onchange = function() {
				newObj.value = fileobj.value;
			}

		break;

		case 'select':

			var selectobj = document.getElementById(obj);
			var newselectList = document.createElement("ul");


			for(i=0;i<selectobj.length;i++) {
				selectitem = document.createElement("li");
				selectitem.text = selectobj.options[i].text;
				newselectList.appendChild(selectitem);
			}

			selectobj.parentNode.replaceChild(newselectList,selectobj);
			tmpstr = '';
			tmpstr += 'style';

		break;

		default:
	}

}

function sitemap_replaceClassname(obj) {
	getobj = document.getElementById(obj);
	classobj = getobj.getElementsByTagName('a');
	for(i=0;i<classobj.length;i++) {
		getAlt = classobj[i].innerHTML;
		getClassName = classobj[i].className;
		newObj = document.createElement('img');
		newObj.setAttribute('src','/front/images/'+getClassName+'.gif');
		newObj.setAttribute('alt',getAlt);
		classobj[i].innerHTML='';
		classobj[i].appendChild(newObj);
	}
}


var stxOpen = function(skip) {
	lookobj = document.getElementById('lookaroundWrap');
	var lookaround = new makeobject('flash','/front/flash/LookAround/lookaround.swf','100%','550','lookaround');
	if(skip) lookaround.vars = "autoCode="+skip;
  lookaround.trnasparent = "window";
	lookobj.innerHTML = lookaround.gettag();
	lookobj.style.display="block";
	eval("window.lookaround = document.getElementById('lookaround');");
}

var stxClosed = function() {
	lookobj = document.getElementById('lookaroundWrap');
	lookobj.style.display="none";
	lookobj.innerHTML = '';
}
