/*
///////////////////////////////////////////////////////////////////////////////
ÆÄÀÏ¸í : ActiveX_Template.js 
¹ö  Àü : v0.91
ÀÏ  ÀÚ : 2006.02.22
¼³  ¸í : °ø¿ë ActiveX Control Template Script
ÀÛ¼ºÀÚ : GS°Ç¼³ÆÀ Á¤¿¬Á¦ »ç¿ø
º¯°æ»çÇ× :
0.90 ÃÊ±âÀÛ¼º
0.91 OZ Ãß°¡
0.92
  - OZ »èÁ¦
  - ºê¶ó¿ìÁ® È®ÀÎ±â´É Ãß°¡
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// »ç¿ë ¿¹
///////////////////////////////////////////////////////////////////////////////

1. ActiveX ControlÀ» È£ÃâÇÒ ÆäÀÌÁö¿¡¼­ »ó´Ü¿¡ ¾Æ·¡ ½ºÅ©¸³Æ® ÀÔ·Â
<script language="javascript" src="ActiveX_Template.js"></script>
*/

var Agent = function () {
	var a = navigator.userAgent;
	function is(s,t) {
		return ((s||"").indexOf(t)>-1);
	}
	this.isWin = is(a,"Windows");
	this.isMac = is(a,"Macintosh");
	this.isOP = typeof window.opera != "undefined" || is(a,"Opera");
	this.isIE = !this.isOP && is(a,"MSIE");
	this.isFF = is(a,"Firefox");
	this.isCR = is(a,"Chrome");
	this.isSF = !this.isCR && is(a,"Apple");
	if (this.isIE) {
		var v = parseFloat(a.match(/MSIE ([0-9\.]+)/)[1]);
		if (isNaN(v)) this.isIE0 = true;
		if (6 <= v && v < 7) {
			this.isIE6 = true;
			return;
		} else if (7 <= v && v < 8) {
			this.isIE7 = true;
			return;
		} else if (5.5 <= v && v < 6) {
			this.isIE55 = true;
			return;
		} else if (v < 5.5) {
			this.isIE5 = true;
			this.isIE = false;
			return;
		} else if (8 <= v) {
			this.isIE8 = true;
			return;
		}		
	}
};

Agent.prototype = {
	/** @id Agent.support */
	support : function (i) {
		if (i===10) {
			return (this.isWin)&&(this.isIE && !this.isIE8) ? true : false ;	
		} else if (i===20) {
			return (this.isWin)&&(this.isIE) ? true : false ;		
		} else if (i===30) {
			return (this.isWin)&&(this.isIE || this.isCR) ? true : false ;		
		} else if (i===40) {
			return (this.isWin)&&(this.isIE || this.isCR || this.isSF) ? true : false ;
		} else if (i===45) {
			return (this.isWin)&&(this.isIE || this.isSF || this.isOP) ? true : false ;
		} else if (i===50) {
			return (this.isWin)&&(this.isIE || this.isCR || this.isSF || this.isOP) ? true : false ;			
		} else if (i===60) {
			return (this.isWin)&&(this.isIE || this.isCR || this.isSF || this.isFF) ? true : false ;
		} else if (i===80) {
			return (this.isWin)&&(this.isIE || this.isFF || this.isCR || this.isSF || this.isOP) ? true : false ;
		} else if (i===90) {
			return (this.isIE || this.isFF || this.isCR || this.isSF || this.isOP) ? true : false ;			
		}		
		return false;
	},
	hasFP : function() {
		if(navigator.plugins&&navigator.mimeTypes.length){
			var x=navigator.plugins["Shockwave Flash"];
			if(x&&x.description){
				return true;
			}
		}else{
			try{
				var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				if(axo!=null) {
					return true;
				}
			}catch(e){}
		}
		return false;
	},
	dump : function() {
		document.write(navigator.userAgent +"<hr>");
		document.write("Win : " + this.isWin +"<br>");
		document.write("Mac : " + this.isMac +"<br>");
		document.write("IE : " + this.isIE +"<br>");
		document.write("IE0 : " + this.isIE0 +"<br>");
		document.write("IE5 : " + this.isIE5 +"<br>");
		document.write("IE55 : " + this.isIE55 +"<br>");
		document.write("IE6 : " + this.isIE6 +"<br>");				
		document.write("IE7 : " + this.isIE7 +"<br>");						
		document.write("IE8 : " + this.isIE8 +"<br>");								
		document.write("FF : " + this.isFF +"<br>");
		document.write("CR : " + this.isCR +"<br>");		
		document.write("SF : " + this.isSF +"<br>");
		document.write("OP : " + this.isOP +"<br>");
	}
};

/** @id Flash */
var Flash = function (sSwfUrl, iWidth, iHeight, sWmode) {	
	this.params = {};
	this.vals = {};
	this.atts = {};
	if (sSwfUrl) {
		this.setAtt("src", sSwfUrl);
		this.setParam("movie", sSwfUrl);
	}
	if (iWidth) {
		this.setAtt("width", iWidth); 
	}
	if (iHeight) {
		this.setAtt("height", iHeight);
	}
	if (sWmode) {
		this.setParam("wmode", sWmode);
	}
	this.setAtt("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
	this.setAtt("type", "application/x-shockwave-flash");
	this.setAtt("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0");
	this.setParam("quality", "high");
	this.setParam("allowScriptAccess", "always");
	this.setParam("swliveconnect", "true");
};

Flash.prototype = {
	/** @id Flash.setAtt */
	setAtt : function (sName, vValue) {
		this.atts[sName] = vValue;
	},
	/** @id Flash.getAtt */
	getAtt : function (sName) {
		return this.atts[sName];
	},
	/** @id Flash.setVal */
	setVal : function (sName, vValue) {
		this.vals[sName] = vValue;
	},
	/** @id Flash.getVal */
	getVal : function (sName) {
		return this.vals[sName];
	},
	/** @id Flash.setValByArray */
	setValByArray : function (aName, aValue) {
		if (aName !== null && aValue !== null && aName.length === aValue.length)  {
			for (var i = 0, n = aName.length ; i < n ; i++){
				this.setVal(aName[i], aValue[i]);
			}
		}
	},
	/** @id Flash.setParam */
	setParam : function (sName, vValue) {
		this.params[sName] = vValue;
	},	
	/** @id Flash.getParam */
	getParam : function (sName) {
		return this.params[sName];
	},
	/** @id Flash.getHTML */
	getHTML : function () {
		var a = [];
		var i;
		for (i in this.vals) {
			if (this.vals.hasOwnProperty(i)) {								
				a.push(i + "=" + this.vals[i]);								
			}
		}	
		var v = a.join("&");		
		if (v!==null && v.length > 0) {
			this.setParam("flashvars", v);
		}
		var s = "";
		var k;
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
			s = "<embed ";
			for (k in this.atts) {
				if (this.atts.hasOwnProperty(k)) {
					s += k;
					s += "=\"";
					s += this.atts[k];
					s += "\" ";
				}
			}
			for (k in this.params) {
				if (this.params.hasOwnProperty(k)) {
					s += k;
					s += "=\"";
					s += this.params[k];
					s += "\" ";
				}
			}
			s += "/>";
		} else {
			s = "<object ";			
			for (k in this.atts) {
				if (this.atts.hasOwnProperty(k)) {
					s += k;
					s += "=\"";
					s += this.atts[k];
					s += "\" ";
				}
			}
			s += ">\n";
			for (k in this.params) {
				if (this.params.hasOwnProperty(k)) {
					s += "<param name=\"";
					s += k;
					s += "\" value=\"";
					s += this.params[k];
					s += "\" />";
				}
			}
			s += "</object>";
		}
		return s;
	}
};

///////////////////////////////////////////////////////////////////////////////
// Flash Template
///////////////////////////////////////////////////////////////////////////////
function flash_object( _url , _width , _height )
{
    if((new Agent()).hasFP())
    {
        document.write(new Flash(_url, _width, _height, "transparent").getHTML());
    }
    else
    {
        document.write('ÀÌ µ¿¿µ»óÀ» º¸·Á¸é Adobe Flash Player°¡ ÇÊ¿äÇÕ´Ï´Ù.<br><a href="http://get.adobe.com/flashplayer/">Adobe¿¡¼­ ¼³Ä¡ÇÏ¼¼¿ä.</a>');
    }
}

