/*
Media UI, Kang DW

player.js
-img-media
-¼Ò½ºº¹»ç
-¿ÜºÎ»ç¿ë

TVPotActiveX(obj,div)
-objectÅÂ±×»ý¼º

TVPotPlay(div,paras,potId)
-swf»ç¿ë 
*/
function TVPotActiveX(obj,div){
	// generate html code
	// for ie obejct
	var html = '<object ';
	if (!obj.id && !obj.name){
		var r = Math.round(Math.random()*100);
		html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
	} else {
		if (obj.id) html += 'id="'+obj.id+'" ';
		else html += 'id="'+obj.name+'" ';
		if (obj.name) html += 'name="'+obj.name+'" ';
		else html += 'name="'+obj.id+'" ';
	}
	if (obj.type) html += 'type="'+obj.type+'" ';
	if (obj.classid) html += 'classid="'+obj.classid+'" ';
	if (obj.width) html += 'width="'+obj.width+'" ';
	if (obj.height) html += 'height="'+obj.height+'" ';
	if (obj.codebase) html += 'codebase="'+obj.codebase+'" ';
	// append events
	for (var i in obj.events){
		if (obj.events[i]){
			html += obj.events[i][0]+'="'+obj.events[i][1]+'" ';
		}
	}
	// end of object tag
	html += '>\n';
	// append params
	for (var i in obj.param){
		html += '<param name="'+obj.param[i][0]+'" value="'+obj.param[i][1]+'"/>\n';
	}

	// for ns embed
	html += '<embed ';
	if (!obj.id && !obj.name){
		var r = Math.round(Math.random()*100);
		html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
	} else {
		if (obj.id) html += 'id="'+obj.id+'" ';
		if (obj.name) html += 'name="'+obj.name+'" ';
	}
	if (obj.type) html += 'type="'+obj.type+'" ';
	if (obj.width) html += 'width="'+obj.width+'" ';
	if (obj.height) html += 'height="'+obj.height+'" ';
	// append params
	for (var i in obj.param){
		if (obj.param[i]){
			if (obj.param[i][0]=='movie' || obj.param[i][0]=='src'){
				var _src = obj.param[i][1];
			}
			html += obj.param[i][0]+'="'+obj.param[i][1]+'" ';
		}
	}
	html += '/>\n';
	html += '</object>';

	var isIE = (document.all)?true:false;
	if (isIE){
		document.getElementById(div).innerHTML = html;
	} else if (obj.type=='application/x-shockwave-flash' || obj.classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'){
		// ie¿ÜÀÇ ºê¶ó¿ìÀú¿¡¼­ activex°¡ flashÀÎ °æ¿ì¸¸ ³ëÃâ
		document.getElementById(div).innerHTML = html;
	}
}

function TVPotPlay(div,paras,potId){
	var obj = new Object();
	obj.type = 'application/x-shockwave-flash';
	obj.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	obj.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
	obj.width = 332;
	obj.height = 296;
	obj.id = potId;

	var param = [
		['movie',"http://photo-tvpot.hanmail.net/player/player.swf"],
		['src',"http://photo-tvpot.hanmail.net/player/player.swf"],
		['quality','high'],
		['wmode','transparent'],
		['bgcolor','#FFFFFF'],
		['allowScriptAccess','always'],
		['swLiveConnect','true'],
		['pluginspage','http://www.macromedia.com/go/getflashplayer'],
		['flashvars',paras]
	];
	obj.param = param;

	TVPotActiveX(obj,div);
}

