﻿// show hide
function showLy(id){
    var bx = document.getElementById(id);
    if (bx.style.display == 'block') 
        {
            bx.style.display='none';
        }
    else
        {
            bx.style.display='block';
        }
}
//flash
function flashSet(s, w, h, d, bg, t, f, l) {
	var code = "";
    code  = "<object type=\"application/x-shockwave-flash\" ";
    code +=         "data=\""+s+"\" ";
    code +=         "width=\""+w+"\" height=\""+h+"\" id=\""+d+"\">";
    code += "<param name=\"movie\" value=\""+s+"\" />";
    code += "<param name=\"quality\" value=\"high\" />";
    code += "<param name=\"wmode\" value=\""+t+"\" />";
    code += "<param name=\"menu\" value=\"false\" />";
    code += "<param name=\"allowScriptAccess\" value=\"always\" />";
    code += "<param name=\"swliveconnect\" value=\"true\" />";
	code += "<param name='scale' value='"+f+"' />";
	code += "<param name='salign' value='"+l+"' />";
	code += "</object>";

	return code;
}
function flashWrite(s, w, h, d, bg, t, f, l) {

	document.write (flashSet(s,w,h,d,bg,t,f,l));
}
function flashLocation(s, w, h, d, bg, t, f, l) {

    document.write(flashSet(s, w, h, d, bg, t, f, l));
}
function flashSetWrite(s, w, h, d, bg, t, f, l) {

    var code = "";
    code = "<object type=\"application/x-shockwave-flash\" ";
    code += "classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
    code += "codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ";
    code += "width=\"" + w + "\" height=\"" + h + "\" id=\"" + d + "\">";
    code += "<param name=\"movie\" value=\"" + s + "\" />";
    code += "<param name=\"quality\" value=\"high\" />";
    code += "<param name=\"wmode\" value=\"" + t + "\" />";
    code += "<param name=\"menu\" value=\"false\" />";
    code += "<param name=\"allowScriptAccess\" value=\"always\" />";
    code += "<param name=\"swliveconnect\" value=\"true\" />";
    code += "<param name='scale' value='" + f + "' />";
    code += "<param name='salign' value='" + l + "' />";
    code += "<embed src=\"" + s + "\" quality=\"high\" "
    code += "wmode=\"" + t + "\" "
    code += "menu=\"false\" width=\"" + w + "\" height=\"" + h + "\" "
    code += "type=\"application/x-shockwave-flash\" "
    code += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\"> "
    code += "</embed>"
    code += "</object>"

    document.write(code);
}
/* definition list toggle faq */
function initToggle(tabContainer) {
	triggers = tabContainer.getElementsByTagName("a");

	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1])
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.targetEl.style.display = "none";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
				}
				this.targetEl.style.display = "block";
				tabContainer.current = this;
			}
			return false;
		}
	}
}

//롤오버 2차방법
function menusOver(ele) {
	var eleWrap = document.getElementById(ele);
	var alink = eleWrap.getElementsByTagName("A");
	
	for (i=0; i<alink.length; i++) {
		if(alink[i].getElementsByTagName("img").length == 0) continue;		

		if (alink[i].getElementsByTagName("img")[0].src.indexOf("_on.gif") != -1 ) {		
			continue;
		}
		alink[i].onmouseover = alink[i].onfocus = function() {
			subImage = this.getElementsByTagName("img")[0];
			if (subImage.src.indexOf("_on.gif") != -1) return false;
			subImage.src = subImage.src.replace(".gif","_on.gif");
			//alert(subImage.src);
		}
		alink[i].onmouseout = alink[i].onblur = function() {
			subImage = this.getElementsByTagName("img")[0];
			subImage.src = subImage.src.replace("_on.gif", ".gif");
		}
	}
}
function SWFLoader() {
    this.id = "";
    this.title = undefined;
    this.wmode = "window";
    this.flashvars = "";
    this.classId = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
    this.codeBase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0';
    this.pluginSpage = 'http://www.macromedia.com/go/getflashplayer';
    this.embedType = 'application/x-shockwave-flash';
    this.flashvars = "";
}

SWFLoader.prototype.setting = function(obj) {
    for (var property in obj) {
        this[property] = obj[property];
    }
    if (this.alternate && document.getElementById(this.alternate)) {
        var node = document.getElementById(this.alternate);
        this.alternate = node.innerHTML;
        node.style.display = "none";
    } else {
        this.alternate = "";
    }
    this.parameter = "";
    this.parameter += "<param name='allowScriptAccess' value='always' />";
    this.parameter += "<param name='allowFullScreen' value='false' />";
    this.parameter += "<param name='movie' value='" + this.url + this.flashvars + "' />";
    this.parameter += "<param name='wmode' value='" + this.wmode + "' />";
    this.parameter += "<param name='quality' value='best'/>";
    this.parameter += "<param name='base' value='.'>";
    this.parameter += "<param name='scale' value='noscale'/>";
    this.parameter += "<param name='expressinstall' value='Scripts/expressInstall.swf' />";
}

SWFLoader.prototype.addParameter = function(name, value) {
    this.parameter += "<param name='" + name + "' value='" + value + "'/>";
}

SWFLoader.prototype.show = function(ele) {
    var str = "";
    var title = (this.title) ? ' title="' + this.title + '"' : "";

    if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
        str += '<object id="' + this.id + '" name="' + this.id + '" width="' + this.width + '" height="' + this.height + '" classid="' + this.classId + '" codebase="' + this.codeBase + '">';
        str += this.parameter;
        str += this.alternate;
        str += '</object>';
    } else {
        str += '<object id="' + this.id + '" name="' + this.id + '" type="application/x-shockwave-flash" data="' + this.url + this.flashvars + '" width="' + this.width + '" height="' + this.height + '">';
        str += this.parameter;
        str += this.alternate;
        str += '</object>';
    }
    (ele != undefined) ? ele.innerHTML = str : document.write(str);
}
