function layerDisplay(objId, disType){
	var dis = document.getElementById(objId);
	(!disType ? disType = disType : disType = "block");
	if ( dis.style.display != 'inline' ) { dis.style.display = 'inline'; }
	else { dis.style.display = 'none'; }
}

function layerDisplay2(objId, disStyle){
	var dis = document.getElementById(objId);
	
	if ( disStyle ) { dis.style.display = disStyle; }
	else if ( dis.style.display != 'inline' ) { dis.style.display = 'inline'; }
	else { dis.style.display = 'none'; }
}

function layerDisplayDom(obj, disType){
	var dis = obj;
	(!disType ? disType = disType : disType = "block");
	if(dis.style.display != 'inline') dis.style.display = 'inline';
	else dis.style.display = 'none';
}

function allDisplayNone( arrElements ) {
	if ( arrElements && arrElements.length > 0 ) {
		for ( var i=0; i<arrElements.length; ++i ) {
			arrElements[i].style.display = "none";
		}
	}
}

function classOn(obj){
	var stats = obj.className;
	if (stats != 'on') obj.className='on';
	else obj.className='';
}

function addLoadEvent(funct) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = funct;
  } else {
    window.onload = function() {
      oldonload();
      funct();
    }
  }
}

/*
*
* multi object embed
* for standard
* Reflexion co.
*
*/
function setEmbed(){ 
	var objId = new String; 
	var parameter = new String; 
	var clsid = new String; 
	var codebase = new String; 
	var pluginspage = new String; 
	var embedType = new String; 
	var src = new String; 
	var width = new String; 
	var height = new String; 
	this.init = function(oSrc, oWidth, oHeight, oId) {
		thisFileName = getFileName(oSrc).split(".")[0];
		thisFileType = getFileName(oSrc).split(".")[1];
		thisFileType = thisFileType.replace(" ", "");
		
		if (!oId){
			oId = thisFileName;
		}

		switch(thisFileType){
			case "swf" : {
				embedType = "application/x-shockwave-flash";
				mediaType = "flash";
				} break;
			case "wmv" : {
				embedType = "video/x-ms-wmv";
				mediaType = "movie";
				} break;
			case "wma" : {
				embedType = "audio/x-ms-wma";
				mediaType = "movie";
				} break;
			case "mp3" : {
				embedType = "audio/mpeg";
				mediaType = "movie";
				} break;
			case "asf" : {
				embedType = "video/x-ms-asf ";
				mediaType = "movie";
				} break;
			case "avi" : {
				embedType = "video/x-msvideo";
				mediaType = "movie";
				} break;
			case "mpeg" :
			case "mpg" : {
				embedType = "video/mpeg";
				mediaType = "movie";
				} break;
		}

		if (mediaType == "flash"){ 
			clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
			codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0"; 
			pluginspage = "http://www.macromedia.com/go/getflashplayer"; 
			parameter += "<param name='quality' value='high'>\n"; 
		} 
		else if (mediaType == "movie"){ 
			clsid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";
			codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715";
			pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp";
		} 

		if (thisFileType == "mov"){ 
			clsid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
			codebase="http://www.apple.com/qtactivex/qtplugin.cab";
			pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp";
			embedType="video/quicktime";
		} 

		src = oSrc;
		width = oWidth;
		height = oHeight;
		objId = oId;	
	} 

	this.param = function(parm , value) {      
		parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
	}  


	this.show = function() { 
		if (clsid){ 
			obj = '<object classid="clsid:'+ clsid +'" codebase="'+ codebase +'" width="'+ width +'" height="'+ height +'" id="' + objId + '">\n';
			obj += '<param name="src" value="'+ src + '">\n';
			obj += '<param name="url" value="'+ src + '">\n';
			obj += parameter;
			//obj += '<!--[if !IE]>-->';
			//obj += '<object data="' + src + '" type="' + embedType + '" width="'+ width +'" height="'+ height +'" name="' + objId + '" >';
			//obj += '<param name="src" value="'+ src + '">\n';
			//obj += parameter;
			//obj += '<a href="' + pluginspage + '" onclick="window.open(this.href);return false;">Click here to download plugin</a>';
			//obj += '</object>\n';
			//obj += '<!--<![endif]-->';
			obj += '<embed src="'+ src+ '" quality="high" bgcolor="#ffffff" width="'+ width +'" height="'+ height +'" name="'+objId+'" align="middle" wmode="transparent" type="' + embedType + '" pluginspage="' + pluginspage + '" />';
			obj += '</object>\n'; 
			eval("window." + objId + " = document.getElementById('" + objId + "');");
		} 
		document.write(obj);
	}
}

function getFileName(uri){
	if(uri.indexOf("#")>0)uri = uri.substr(0,uri.indexOf("#"));
	if(uri.indexOf("&")>0)uri = uri.substr(0,uri.indexOf("&"));
	if(uri.indexOf("?")>0)uri = uri.substr(0,uri.indexOf("?"));
	var thisUriArray = uri.split(/\//);
	var thisFileName = thisUriArray[thisUriArray.length-1];
	return thisFileName;
}

function getSWF(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
		if (window.document[movieName])	return window.document[movieName];
    }
	else {
		if (!window.document[movieName]) return document.getElementById(movieName);
		if(document[movieName].length != undefined)	return document[movieName][1];
    }
}


function IE_HtmlRewrite(objParent) {
	if (window.ActiveXObject && objParent) {
		objParent.innerHTML = objParent.innerHTML;
	}
}

function calculateBytes(szValue)
{
  var tcount = 0;

  var tmpStr = new String(szValue);
  var temp = tmpStr.length;

  var onechar;
  for ( k=0; k<temp; k++ )
  {
    onechar = tmpStr.charAt(k);
    
    if (escape(onechar).length > 4)
    {
      tcount += 2;
    }
    else
    {
      tcount += 1;
    }
  }

  return tcount;
}
	
function dsSubString(data,num){
	liTxt = data;
	liTxtLe = calculateBytes(liTxt);
	if(liTxtLe>num){
		liTxt = liTxt.substring(0,(num-3));
		document.write(liTxt+"...");
	}else{
		document.write(liTxt);
	}
}

/*
<script type="text/javascript">
	setEm = new setEmbed();
	setEm.init('subGnb.swf','600','60');
	setEm.param('allowScriptAccess','always');
	setEm.param('wmode', 'transparent');
	setEm.show();
</script>
*/

/*
	addEvent(window, 'load', function(){
		initInterval = setInterval('initData()',0);
	});
	function initData(){
		getSWF("subGnb").setXMLURL("xml/subGnb.xml");
		clearInterval(initInterval);
	}
*/
