﻿

function UWZ_SwapImage(obj, img) {
    try {
        obj.src = img;
    }
    catch (ex) {
    }
}



function LTrim( str ) {

    var j = 0;
    for (var i = 0; i < str.length; i++) {
        if (str.charAt(i) == ' ') {
            j++;
        }
        else {
            break;
        }
    }
    
    return str.substring(j, str.length - j + 1);    
}

function RTrim( str ) {
    
    var j = 0;
    for (var i = str.length - 1;  i >= 0; i--) {
        if (str.charAt(i) == ' ') {
            j++;
        }
        else {
            break;
        }
    }
    
    return str.substring(0, str.length - j);
}

function Trim( str ) { return RTrim((LTrim(str))); }

var STRING_TRIM_PATTERN = /(^\s*)|(\s*$)/g; // 내용의 값을 빈공백을 trim하기 위한것(앞/뒤)
String.prototype.trim = function() {
return this.replace(STRING_TRIM_PATTERN, "");
}

function trim( str ) {
    str = str.replace(/(^\s*)|(\s*$)/g, "");
    return str;
}

function AddFlash(width, height, url, fvalues, idname) {
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' ");

	if (idname != "") {
		document.write("		id='" + idname + "' ");
	}

	document.write("		width='" + width + "' height='" + height + "' align='middle'>");


	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'				value='" + url + "' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='allowFullScreen'	value='true' />	"); 	// 2008-01-14 송응제 추가
	document.write("	<param name='wmode'				value='transparent'> ");
	document.write("	<param name='flashVars'			value='" + fvalues + "'/> ");
	document.write("	<embed src='" + url + "' quality='high' width='" + width + "' height='" + height + "' allowFullScreen='true' align='middle' wmode='transparent' ");

	if (idname != "") {
		document.write("			id					='" + idname + "' ");
	}


	document.write("		allowScriptAccess='always' swfLiveConnect=true type='application/x-shockwave-flash' ");
	document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

// 쿠키함수
function getCookie(name) {
	var prefix = name + "=";

	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1) return null;

	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;

	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function setCookie(name, value, expiredays) {
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";";
}

// 이미지 리사이즈	
function goResizeImage(strID) {
	var width = eval("document.all.boardImage" + strID + ".width");
	if (width > 620) eval("document.all.boardImage" + strID + ".width = 620");
}