function viewFlash(flashUrl,flashWidth,flashHeight,flashDiv) {
	var flashPath,flashVars;
	var classId			=	"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	var codeBase		=	"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
	var pluginsPage	=	"application/x-shockwave-flash";
	var embedType	=	"application/x-shockwave-flash";
	var pluginsPage	=	"http://www.macromedia.com/go/getflashplayer";

	var flashHtml		=	"";

	flashHtml			+=	'<object id="flashObj" classid="'+ classId +'" codebase="'+ codeBase +'" width="'+ flashWidth +'" height="'+ flashHeight +'">';
	flashHtml			+=	'	<param name="movie" value="' + flashUrl + '" />';
	flashHtml			+=	'	<param name="quality" value="high" />';
	flashHtml			+=	'	<param name="allowScriptAccess" value="always" />';
	flashHtml			+=	'	<param name="wmode" value="transparent" />';
	flashHtml			+=	'	<embed src="'+ flashUrl + '" allowScriptAccess="always" quality="high" wmode="transparent" width="'+ flashWidth +'" height="'+ flashHeight +'" type="' + embedType + '" pluginspage="' + pluginsPage + '" />';
	flashHtml			+=	'</object>';

	if(flashDiv) {
		document.getElementById(flashDiv).innerHTML	=	flashHtml;
	} else {
		document.write(flashHtml);
	}
}

function ajaxCreate() {
	var xmlHttp;

	if(window.ActiveXObject) {
		xmlHttp	=	new ActiveXObject("Microsoft.XMLHTTP");
	} else if(window.XMLHttpRequest) {
		xmlHttp	=	new XMLHttpRequest();
	}

	return xmlHttp;
}

function ajaxRequest(div,actionfile,param,xml) {
	var ajax		=	ajaxCreate();

	ajax.open(param ? "POST" : "GET",actionfile,false);
	ajax.setRequestHeader("content-type","application/x-www-form-urlencoded;charset=UTF-8'");
	ajax.send(param ? param : null);

	if(ajax == null){
		alert("AJAX NOT SUPPORT.");
		history.back();
	}

	if(xml) {
		eval(div+"(ajax)");
	} else {
		if(div) {
			document.getElementById(div).innerHTML	=	ajax.responseText;
		} else {
			return ajax.responseText;
		}
	}
}

function viewLink(bbs,idx) {
	document.checkForm.boardNum.value = idx;
	
	if (bbs == 1) {
		go_url = "/ch/news/news_view.asp"
	} else if (bbs == 2) {
		go_url = "/ch/news/gallery_view.asp"
	}
	
	document.checkForm.action = go_url;
	document.checkForm.submit();
}

function setCookie(name, value, expiredays)	{
	var expire_date = new Date();
	expire_date.setDate(expire_date.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; expires=" + expire_date.toGMTString() + "; path=/; domain="+ document.domain;
}

function getCookie(name) {
	var nameOfCookie = name + "=";
	var x = 0;

	while(x <= document.cookie.length) {
		var y	=	(x+nameOfCookie.length);
		if(document.cookie.substring(x,y) == nameOfCookie) {
			if((endOfCookie = document.cookie.indexOf(";",y)) == -1) {
				endOfCookie	=	document.cookie.length;
			}

			return unescape( document.cookie.substring(y,endOfCookie));
		}

		x	=	document.cookie.indexOf(" ",x) + 1;
		if(x == 0)
		break;
	}

	return "";
}
