//ÀÌ¹ÌÁöÆË¾÷

function viewPic(img){
  foto1= new Image();
  foto1.src=(img);
  contImg(img);
}
function contImg(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewImg(img);
  }
  else{
    funzione="contImg('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewImg(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}

function open_image(str){ //ÀÌ¹ÌÁö Å©±â¿¡ ¸Â´Â ÆË¾÷ ¿­±â
 new_img = new Image(); 
 new_img.src = (str); 

 if((new_img.width!=0)&&(new_img.height!=0)){
  var sv = "no";
  var imgW = new_img.width; 
  var imgH = new_img.height; 
  if(imgW > screen.width-10){
   imgW = screen.width-10; sv="yes";
  }
  if(imgH > screen.height-30){
   imgH = screen.height-30; sv="yes";
  }
  winopt = "scrollbars=" + sv + ",resizable=yes,width=" + imgW + ",height=" + imgH + ",left=0,top=0";
  newopen = window.open("image.asp?image=" + str,"",winopt); 
 }
}

//µ¿¿µ»ó
var paramInfo = new Array;

function initParam()
{
  var oldSize = paramInfo.length;

 for (var i=0; i<oldSize; i++) {
  paramInfo.length--;
 } 
}

function setParam(paramName, paramValue)
{
 var idx = paramInfo.length;

 paramInfo[idx] = [];
 paramInfo[idx][0] = paramName;  
 paramInfo[idx][1]= paramValue;
}
function playMedia(objID, objSource, objWidth, objHeight, objStyle)
{
 document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ');
 document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');

 for (var i=0; i<paramInfo.length; i++) {
  document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');  
 } 
 
 document.write('</OBJECT>');
}
//FLASH
function playFlash(objID, objSource, objWidth, objHeight, objStyle, cabVersion, embedAttr)
{
	document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');

	if (cabVersion != '') {
		document.write('codebase="' + self.window.document.protocol + '"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + cabVersion + '" ');
	}
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');

	for (var i=0; i<paramInfo.length; i++) {
		document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');		
	}	
	
	document.write('<embed src="' + objSource + '" width="' + objWidth + '" height="' + objHeight + '" ' + embedAttr + '>');
	document.write('</OBJECT>');
}


/**
 * Microsoft ActiveX & Flash Patch ´ëÀÀÀ» À§ÇÑ ½ºÅ©¸³Æ® ÇÔ¼ö
 */
function StringBuffer() {
	this.buff = '';
	
	this.append = function(str) {
		this.buff = this.buff + str;
	}
	
	this.toString = function() {
		return this.buff;
	}
}

function XObject(type) {
	this.type = type;
	this.infoKeyArray = new Array();
	this.infoValueArray = new Array();
	this.paramKeyArray = new Array();
	this.paramValueArray = new Array();
	this.embedKeyArray = new Array();
	this.embedValueArray = new Array();
	this.addInfo = function(name, value) {
		if(name==null || value==null) {
			alert("usage : addInfo(name, value)");
		}
		this.infoKeyArray.push(name);
		this.infoValueArray.push(value);
	}
	this.addParam = function(name, value) {
		if(name==null || value==null) {
			alert("usage : addParam(name, value)");
		}
		this.paramKeyArray.push(name);
		this.paramValueArray.push(value);
	}
	this.addEmbedInfo = function(name, value) {
		if(name==null || value==null) {
			alert("usage : addEmbedInfo(name, value)");
		}
		this.embedKeyArray.push(name);
		this.embedValueArray.push(value);	
	}
	this.show = function() {
		if(this.type==null) {
			alert("usage : new Map(type) - type={'object','applet'..}");
		}
		var sb = new StringBuffer();
		sb.append("<");
		sb.append(this.type);
		sb.append(" ");
		for(var i=0; i<this.infoKeyArray.length; i++) {
			sb.append(this.infoKeyArray[i]);
			sb.append("='");
			sb.append(this.infoValueArray[i]);
			sb.append("' ");
		}
		sb.append(">")
		
		for(var i=0; i<this.paramKeyArray.length; i++) {
			sb.append("<param name='");
			sb.append(this.paramKeyArray[i]);
			sb.append("' value='");
			sb.append(this.paramValueArray[i]);
			sb.append("'>");
		}
		
		if(this.embedKeyArray.length > 0) {
			sb.append("<embed ");
			for(var i=0; i<this.embedKeyArray.length; i++) {
				sb.append(this.embedKeyArray[i]);
				sb.append("='");
				sb.append(this.embedValueArray[i]);
				sb.append("' ");
			}
			sb.append(">");
		}
		
		sb.append("</");
		sb.append(this.type);
		sb.append(">");
		document.write(sb.toString());
	}
	this.showActiveXMap = function(id, width, height, x, y, scale, isMapLoadOnInit) {
		this.addInfo("id",id);
		this.addInfo("width",width);
		this.addInfo("height",height);
		this.addParam("CenterX",x);
		this.addParam("CenterY",y);
		this.addParam("DrawScale",scale);
		this.addParam("IsMapLoadOnInit",isMapLoadOnInit);
		this.show();
	}
	this.showAppletMap = function(id, width, height, x, y, scale, isMapLoadOnInit) {
		
	}
	this.showDefaultFlash = function(id, src, width, height, wmode) {
		if(id==null || src==null || width==null || height==null || wmode==null) {
			alert("usage : showDefaultFlash(id, src, width, height, wmode)");
		}
		this.addInfo("id",id);
		this.addInfo("width",width);
		this.addInfo("height",height);
		this.addInfo("classid","clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
		this.addInfo("codebase","https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
		this.addParam("movie",src);
		this.addParam("quality","high");
		this.addParam("wmode",wmode);
		this.addEmbedInfo("src",src);
		this.addEmbedInfo("quality","high");
		this.addEmbedInfo("bgcolor","#FFFFFF");
		this.addEmbedInfo("width",width);
		this.addEmbedInfo("height",height);
		this.addEmbedInfo("type","application/x-shockwave-flash");
		this.addEmbedInfo("pluginspace","https://www.macromedia.com/go/getflashplayer");
		this.show();
	}
	this.showDefaultCongnamulMap = function(id, width, height, x, y, scale, isMapLoadOnInit) {
		if(id==null || width==null || height==null || x==null || y==null || scale==null) {
			alert("usage : showDefaultCongnamulMap(id, width, height, x, y, scale, isMapLoadOnInit)");
		}
		this.addInfo("classid","clsid:E0BF7A2B-2F7C-497A-B50F-292D3F317965");
		this.addInfo("codebase","https://www.congnamul.com/ActiveX/CongnamulMap_V17.cab#version=1,0,0,17");
		this.addParam("ServerIPAddress","mapsvc.samsung.co.kr");
		this.addParam("ServerServletURL","Map/servlet/mapservice");
		this.addParam("UserImageLocation","https://mapsvc.samsung.co.kr/landmark/");
		this.addParam("DecoSymbolUrl","https://map.congnamul.com/images/decoimages");
		this.showActiveXMap(id, width, height, x, y, scale, isMapLoadOnInit);
	}
	this.showDefaultSamsungMap = function(id, width, height, x, y, scale, isMapLoadOnInit) {
		if(id==null || width==null || height==null || x==null || y==null || scale==null) {
			alert("usage : showDefaultSamsungMap(id, width, height, x, y, scale, isMapLoadOnInit)");
		}
		this.addInfo("classid","clsid:DA76E8AE-2E7F-49A8-B5F2-D1C4FF70ECD5");
		this.addInfo("codebase","https://mapsvc.samsung.co.kr/ActiveX/SamsungMap_V25.cab#version=1,0,0,25");
		this.addParam("ServerIPAddress","mapsvc.samsung.co.kr");
		this.addParam("ServerServletURL","Map/servlet/mapservice");
		this.addParam("UserImageLocation","https://mapsvc.samsung.co.kr/landmark/");
		this.addParam("DecoSymbolUrl","https://map.congnamul.com/images/decoimages");
		this.showActiveXMap(id, width, height, x, y, scale, isMapLoadOnInit);
	}
	this.showDefaultAspMap = function(id, width, height, x, y, scale, isMapLoadOnInit) {
		if(id==null || width==null || height==null || x==null || y==null || scale==null) {
			alert("usage : showDefaultAspMap(id, width, height, x, y, scale, isMapLoadOnInit)");
		}
		this.addInfo("classid","clsid:D96D2F74-0B74-47D2-964F-B67E9F69F1CD");
		this.addInfo("codebase","https://asp.congnamul.com/AspActiveX/CongnamulMap4Asp_V23.cab#version=1,0,0,23");
		this.addParam("ServerIPAddress","mapsvc.samsung.co.kr");
		this.addParam("ServerServletURL","Map/servlet/mapservice");
		this.addParam("UserImageLocation","https://mapsvc.samsung.co.kr/landmark/");
		this.addParam("DecoSymbolUrl","https://map.congnamul.com/images/decoimages");
		this.showActiveXMap(id, width, height, x, y, scale, isMapLoadOnInit);
	}
}
