
function flashWrite(url,w,h,id,bg,vars,win){ 
	var flashStr = 
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' name='"+id+"' align='middle'>"+ 
	"<param name='allowScriptAccess' value='always' />"+ 
	"<param name='allowFullScreen' value='true' />"+
	"<param name='movie' value='"+url+"' />"+ 
	"<param name='FlashVars' value='"+vars+"' />"+ 
	"<param name='wmode' value='"+win+"' />"+ 
	"<param name='menu' value='false' />"+
	"<param name='scaleMode' value='noScale' />"+
	"<param name='showMenu' value='false' />"+
	"<param name='align' value='CT' />"+ 
	"<param name='quality' value='high' />"+ 
	"<param name='bgcolor' value='"+bg+"' />"+ 
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' id='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
	"</object>"; 

	document.write(flashStr); 
}


/**
 *	공통 함수
 */
var gzCommon = {};

/**
	네임텍 이동 링크
*/
gzCommon.goNametag = function(usrNo, menu) {
	if (typeof(menu) == 'undefined') {
		menu = "";
	}else{
		menu = "#"+ menu;
	}

	var win = window.open("about:blank");
	if (win) {
		if($gz.www.property.CONST.NAMETAG_DOMAIN){
			win.location.href = $gz.www.property.CONST.NAMETAG_DOMAIN +"/gz/redirect/"+ usrNo + menu;
		}else{
			win.location.href = "http://nametag.golfzon.com/gz/redirect/"+ usrNo + menu;
		}
	}
}

/**
	 매장 홈페이지로 이동
*/
gzCommon.goSiteHome = function(soid, menu) {
	if (typeof(soid) == 'undefined' || soid.length == 0) {
		alert("매장 점주 분들만 이용가능한 서비스 입니다.");
		return false;
	}

	if (typeof(menu) == 'undefined') {
		menu = "";
	}else{
		menu = "#"+ menu;
	}
	
	var win = window.open("about:blank");
	if (win) {
		if($gz.www.property.CONST.SOSITE_DOMAIN){
			win.location.href = $gz.www.property.CONST.SOSITE_DOMAIN +"/"+ soid + menu;
		}else{
			win.location.href = "http://www.golfzon.com/"+ soid + menu;
		}
	}
}


/**
	 금지단어체크
*/
gzCommon.checkBanWord = function(contents) {
	if (typeof(contents) == 'undefined' || contents.length == 0) {
		alert("내용이 없다");
		return false;
	}

	var url = "/ajax.jsp"
	var params = "externalURL="+ $const['UIAPI_DOMAIN'] + "/common/validate/forbiden"+"&contents="+ encodeURIComponent(contents);
	
	var result = true;

	$.ajax({
		type: "POST",
		async: false,
		dataType : "text",
		url: url,
		cache: false,	   
		data: params,
		success: function(data){		
			eval("xx = "+ data +";");
			if (xx.isSuccess == false && xx.errorCode == "banWord") {
				alert("입력하신 내용에 금지단어가 포함되어 있습니다.\n확인후 다시 작성해 주세요.\n\n["+ xx.errorMessage +"]");
			}
			result = xx.isSuccess;
		}
	});

	return result;
}



/**
*	파일 클래스
*/
function clsFiles() {
	this.files = new Array();

	this.add = function(obj){
		for (var i=0,c=obj.length;i<c ;i++ ) {
			var newObj = {};
			newObj.filename = obj[i].filename;
			newObj.filepath = obj[i].filepath;
			newObj.filesize = obj[i].filesize;
			newObj.filetype = obj[i].filetype;

			this.files.push(newObj);
		}
	};

	this.toString = function() {
		var result = "";
		var obj = this.files;
		for (var i=0,c=obj.length;i<c ;i++ ) {
			if (i != 0 ) result += "|^|";

			result += obj[i].filename +"~";
			result += obj[i].filepath +"~";
			result += obj[i].filesize +"~";
			result += typeof(obj[i].filetype) == 'undefined' ? "-" : obj[i].filetype;
		}

		return result;
	};

	this.parse = function(sFiles) {
		if (typeof(sFiles) == 'undefined') return;

		var row = "";
		var tmp = sFiles.split("|^|");
		for (var i=0,c=tmp.length;i<c ;i++ ) {
			row = tmp[i].split("~");
			if (row.length == 4) {
				var obj = {};
				obj.filename = row[0];
				obj.filepath = row[1];
				obj.filesize = row[2];
				obj.filetype = row[3];
				this.files.push(obj);
			}
		}
	};

	this.getFilePath = function(index){
		if (this.files.length < 1) return "";
		if (typeof(index) == 'undefined' || this.files.length <= index) index = this.files.length -1;

		return this.files[index].filepath;
	};

	this.remove = function(index) {
		if (typeof(index) == 'undefined' || this.files.length <= index) index = this.files.length -1;
		this.files.shift[index];
	};

	this.removeAll = function() {
		this.files.length = 0 ;
	};
}

var gzFiles = new clsFiles();

