﻿function flashJS(id, url, width, height, vars, bgColor, winmode) {
  //winmode - opaque, transparent
	document.write("	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' "); 
	document.write("		width='"+width+"' height='"+height+"' id='"+id+"' align='middle'> ");
	document.write("	<param name='allowScriptAccess' value='sameDomain' /> ");
	document.write("	<param name='movie' 			value='"+url+"' /> ");
	document.write("	<param name='FlashVars' 		value='"+vars+"' /> ");
	document.write("	<param name='wmode' 			value='"+winmode+"' /> ");
	document.write("	<param name='menu' 				value='false' /> ");
	document.write("	<param name='salign' 			value='lt' /> ");
	document.write("	<param name='scale' 			value='noscale' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='bgcolor' value='"+bgColor+"' /> ");
	document.write("	<embed src='"+url+"' flashVars='"+vars+"' wmode='"+winmode+"' menu='false' quality='high' ");
	document.write("	bgcolor='"+bgColor+"' width='"+width+"' height='"+height+"' name='"+id+"' align='middle' salign='lt' scale='noscale'");
	document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /> ");
	document.write("	</object> ");
}

function linkPage(url) {
	location.href=url;
}

function openWindow(url) {
	window.open(url);
}

function layer_toggle(obj) {
	if (obj.style.display == 'none') obj.style.display = 'block';
	else if (obj.style.display == 'block') obj.style.display = 'none';
}

getObject = function( objectId ) {
	if (typeof objectId == 'string') {
		if(document.getElementById && document.getElementById(objectId))
			return document.getElementById(objectId);
		else if (document.all && document.all(objectId))
			return document.all(objectId);
		else if (document.layers && document.layers[objectId])
			return document.layers[objectId];
		else
			return false;
	} else return objectId;
}

getStyle = function(el, property) {
	var value = null;
	var dv = document.defaultView;

	el = getObject(el);

	if (property == 'opacity' && el.filters) {// IE opacity
		value = 1;
		try {
			value = el.filters.item('DXImageTransform.Microsoft.Alpha').opacity / 100;
		} catch(e) {
			try {
				value = el.filters.item('alpha').opacity / 100;
			} catch(e) {}
		}
	} else if (el.style[property]) {
		value = el.style[property];
	} else if (el.currentStyle && el.currentStyle[property]) {
		value = el.currentStyle[property];
	} else if ( dv && dv.getComputedStyle ) {  // convert camelCase to hyphen-case
		var converted = '';
		for(i = 0, len = property.length;i < len; ++i) {
			if (property.charAt(i) == property.charAt(i).toUpperCase()) {
				converted = converted + '-' + property.charAt(i).toLowerCase();
			} else {
				converted = converted + property.charAt(i);
			}
		}

		if (dv.getComputedStyle(el, '').getPropertyValue(converted)) {
			value = dv.getComputedStyle(el, '').getPropertyValue(converted);
		}
	}
	return value;
};

setStyle = function(el, property, val) {
	var el = getObject(el);
	switch(property) {
		case 'opacity' :
			if (el.filters) {
				el.style.filter = 'alpha(opacity=' + val * 100 + ')';
				if (!el.currentStyle.hasLayout)
					el.style.zoom = 1;
			} else {
				el.style.opacity = val;
				el.style['-moz-opacity'] = val;
				el.style['-khtml-opacity'] = val;
			}
			break;
		default :
			el.style[property] = val;
	}
}

getClientWidth = function() {
	if ( navigator.appName.indexOf("Microsoft") != -1 )
		return ( (document.documentElement.offsetWidth || document.body.offsetWidth) );
	if ( parseInt(navigator.appVersion) > 3 )
		return ( window.innerWidth-17 );
}

getClientHeight = function() {
	if ( navigator.appName.indexOf("Microsoft") != -1 )
		return ( (document.documentElement.offsetHeight || document.body.offsetHeight) );
	if ( parseInt(navigator.appVersion) > 3 )
		return ( window.innerHeight-10 );
}


/* 실명인증 */
function BoninCheck_winopen(refresh_url) {
	document.domain = "seoul.go.kr";
	var url = "http://www.seoul.go.kr/seoul/jsp/mem/BoninCheck_winopen.jsp?SITE_SB=SB00014&NEXT_URL=";
//	refresh_url = URLEncode(refresh_url);

	if ( confirm("실명인증용 팝업창입니다.\n\n실명인증하시겠습니까?") )
		window.open(url+refresh_url, 'realName', 'width=490,height=275,top=100,left=100');
}

function URLEncode (clearString) {
	var output = '';
	var x = 0;
	clearString = clearString.toString();
	var regex = /(^[a-zA-Z0-9_.]*)/;
	while (x < clearString.length) {
		var match = regex.exec(clearString.substr(x));
		if (match != null && match.length > 1 && match[1] != '') {
			output += match[1];
			x += match[1].length;
		} else {
			if (clearString[x] == ' ')
				output += '+';
			else {
				var charCode = clearString.charCodeAt(x);
				var hexVal = charCode.toString(16);
				output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
			}
			x++;
		}
	}
	return output;
}
function URLDecode (encodedString) {
	var output = encodedString;
	var binVal, thisString;
	var myregexp = /(%[^%]{2})/;
	while ((match = myregexp.exec(output)) != null
			&& match.length > 1 && match[1] != '') {
		binVal = parseInt(match[1].substr(1),16);
		thisString = String.fromCharCode(binVal);
		output = output.replace(match[1], thisString);
	}
	return output;
}
