// IE ÆÐÄ¡ ´ë¾È 2006-03-08
//<script>objectlaunch("<EMBED src=http://5p.paran.com/data/new/newarmy_01.swf width=400 height=400 type=application/x-shockwave-flash utostart='true' balance='0' loop='0'>");<
function objectlaunch(obcode)
{
    document.write(obcode);
}


function hanCheck(str){ //ÇÑ±Û¿©ºÎÈ®ÀÎ function
	var b =  new Boolean(false);

	for(i=0;i<str.length;i++) {
			var a=str.charCodeAt(i);
			if (a > 128) {
				b = true;
				break;
			}
	}	

	return b;
}

/**
 * ¾Ë¶óºñ¾Æ ¼ýÀÚ¿©ºÎ Ã¼Å©
 */
function check_num(_value){ 
	var x= _value;
	var anum=/(^\d+$)|(^\d+\.\d+$)/ 
	if (anum.test(x)) 
		testresult=true 
	else{ 
		testresult=false 
	} 
	return (testresult) 
}

function linkFile1(body_url){
		var h = new Boolean(false); //ÇÑ±Û¿©ºÎ		
		h = hanCheck(body_url);

		if(h == true && body_url.indexOf("?") >= 0){
			str_next_param = body_url.substring(body_url.indexOf("?")+1);
			body_url = body_url.substring(0,body_url.indexOf("?"));
			document.link_form.action = getCookie("frame_url") + "?" + str_next_param;
		}

		document.link_form["LinkFile"].value = body_url;
		//document.link_form.method = "get";
		document.link_form.submit();
}

function linkFile2(frame_url, body_url){
	var t_frame_url;

	body_url = NotHoBoard(body_url);

	if (getCookie('user_aff_cd')=="001" || getCookie('user_aff_cd')=="242" || getCookie('user_aff_cd')=="247" || getCookie('user_aff_cd')=="") {
		setIndexCookie('frame_url',frame_url);
		t_frame_url = frame_url
	}
	else {
		t_frame_url = getCookie('frame_url');
	}

	var h = new Boolean(false); //ÇÑ±Û¿©ºÎ		
	h = hanCheck(body_url);
		
	if(h == true && body_url.indexOf("?") >= 0){
		str_next_param = body_url.substring(body_url.indexOf("?")+1);
		body_url = body_url.substring(0,body_url.indexOf("?"));
		document.link_form.action = t_frame_url + "?" + str_next_param;
	}else{
		document.link_form.action = t_frame_url;
	}
	document.link_form["LinkFile"].value = body_url;
	//document.link_form.method = "get";
	document.link_form.submit();
}

function linkFile3(frame_url, body_url, next_body_url){
	body_url = NotHoBoard(body_url);
	document.link_form.action = frame_url;
	document.link_form["LinkFile"].value = body_url;
	document.link_form["NextLinkFile"].value = next_body_url;
	document.link_form.submit();
}

function linkFile4(frame_url, body_url, next_frame_url, next_body_url){
	body_url = NotHoBoard(body_url);
	document.link_form.action = frame_url;
	document.link_form["LinkFile"].value = body_url;
	document.link_form["NextLinkFile"].value = next_body_url;
	document.link_form["NextFrameFile"].value = next_frame_url;
	document.link_form.submit();
}

function NotHoBoard(url){
	var link;
	link = url;
	if (url.indexOf("RXListApp") > 0)
	{
		link = "/community/criboard/boardlist.jsp?jcode=JBD0000101";
	}
	return link;
}

function setIndexCookie( name, value){
		document.cookie = name + "=" + escape( value ) + "; path=/ticketlink;"
}

function setCookie( name, value){
	document.cookie = name + "=" + escape( value ) + "; path=/ticketlink;"
}

function setCookieDay( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getProtocol(){
	if (location.protocol == "https:"){
		return "http://" + location.host;
	}else{
		return "";
	}
}

function getCookie(name){
		var idx_s = document.cookie.indexOf(name + "=");
		var idx_e = 0;
		if (idx_s != -1){
			idx_s += name.length + 1;
			idx_e = document.cookie.indexOf(";",idx_s);
			if (idx_e == -1){
				idx_e = document.cookie.length;
			}
		}else{
			return "";
		}

		return document.cookie.substring(idx_s,idx_e);
}


function allblur() {
         for (i = 0; i < document.links.length; i++)
              document.links[i].onfocus = document.links[i].blur;
}


function kbCardInfo_Open(){
	window.open("/ticketlink/tl_notice/kb_card_info.html","","RESIZABLE=no,STATUS=no,WIDTH=620,HEIGHT=680,left=10,top=10");
}



/**
*FAQ °Ë»ö½Ã formCheck
*/
/*
function Checkform(){

	if(frmFAQ.wobj.value==""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.3");
		frmFAQ.sc_keyword.focus();
		return false;
	}
}
*/

function CheckFAQform(){

	if(frmFAQ.wobj.value==""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.");
		frmFAQ.wobj.focus();
		return false;
	}
}


/**
*FAQ °Ë»ö½Ã html Form return1
*/
function getFormStrFAQ1(){
	
	var formStr1 = '';

	formStr1 += '<form name="frmFAQ" method="post" action="'+getProtocol()+'/ticketlink/help/index.jsp" onSubmit="return CheckFAQform()">'
	formStr1 += '<input type="hidden" name="LinkFile" value="/board/faqboard/boardlist.jsp">'
	
	return formStr1;
}


/**
*FAQ °Ë»ö½Ã html Form return2
*/
function getFormStrFAQ2(){
	
	var formStr2 = '';
	formStr2 += ' <input type="hidden" name="jcode" value="JBD0000170" class="boxfont"><input type="hidden" name="wvalue" class="boxfont"><input type="hidden" name="vcode" class="boxfont" value="0000"><input type="text" name="wobj" style="WIDTH: 110px; HEIGHT: 17px;border:1px solid #BCBCBC ;background-color: #EFEFEF;color: #333333;">';

	return formStr2;
}


function getFormStrFAQ2_event(){
	
	var formStr2 = '';
	formStr2 += ' <input type="hidden" name="jcode" value="JBD0000170" class="boxfont"><input type="hidden" name="wvalue" class="boxfont"><input type="hidden" name="vcode" class="boxfont" value="0000"><input type="text" name="wobj" class="boxfont" size="17">';

	return formStr2;
}

/**
*FAQ °Ë»ö½Ã html Form return3
*/
function getFormStrFAQ3(){
	
	var formStr3 = '';
	formStr3 += '</form>'
	
	return formStr3;
}

/**
*FAQ °Ë»ö¹öÆ° Å¬¸¯½Ã submit
*/
function submitFormFAQ(){
	
	if (document.frmFAQ['wobj'].value.length == 0){
		alert ("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À.");	
		return false;
	}else{
		document.frmFAQ.submit();
	}
	
}


/**
 * ³ªµµÇÑÇ¥ 1È¸ ÅõÇ¥¿©ºÎ/º¸±â¼±ÅÃ ¿©ºÎ check
 */
function no_choice(form1){	
	if(form1.p_init.value == getCookie("TicketLinkPoll")){
		alert('ÀÌ¹Ì ÅõÇ¥ÇÏ¼Ì½À´Ï´Ù');
		return;
	}

	var length = form1.choice_id.length;
	var i = 0;
	for (i = 0; i < length; i++)
	{
	  if (form1.choice_id[i].checked){
		form1.submit();
		return;
	  }
	}

	if(true){
		alert("Áú¹®¿¡ ÀÀ´äÇØÁÖ¼¼¿ä!!");
		return;
	}
}

var ImageDomain = "";
if (location.protocol == "http:"){
//	ImageDomain = "http://dev.icketlink.co.kr";
	ImageDomain = "http://img.ticketlink.co.kr";
}
else if(location.protocol == "https:"){
	ImageDomain = "https://img.ticketlink.co.kr";
}

var Srcurit = "";
if (location.protocol == "http:"){
	Srcurit = "http:";
}
else if(location.protocol == "https:"){
	Srcurit = "https:";
}



String.prototype.trim = function() {
    return this.replace(/(^ *)|( *$)/g, "");
}
String.prototype.ltrim = function() {
    return this.replace(/(^ *)/g, "");
}
String.prototype.rtrim = function() {
    return this.replace(/( *$)/g, "");
}
//document.write("<br>" + location.href);


//±ÛÀÚ¼ö Ã¼Å©
function ChckStrLength(object, MaxLength, FieldName) 
{
	var i, len=0;

	if (typeof object == "undefined") {
		return true
	}
	var s = object.value;
	
	// String ±æÀÌ¸¦ ±¸ÇÏ´Â ºÎºÐ..
	for(i=0;i < s.length; i++) (s.charCodeAt(i) > 200)? len+=2:len++;
	
	// ±æÀÌ È®ÀÎ.	
	if (MaxLength < len) 
	  {
		if (FieldName != "") 
			return false;
	  }
	return true;
}

// ¸ð¼­¸® µÕ±Ù Å×ÀÌºí
function roundTable(objID) {
	var obj = document.getElementById(objID);
	var Parent, objTmp, Table, TBody, TR, TD;
	var bdcolor, bgcolor, Space;
	var trIDX, tdIDX, MAX;
	var styleWidth, styleHeight;

	// get parent node
	Parent = obj.parentNode;
	objTmp = document.createElement('SPAN');
	Parent.insertBefore(objTmp, obj);
	Parent.removeChild(obj);

	// get attribute
	bdcolor = obj.getAttribute('rborder');
	bgcolor = obj.getAttribute('rbgcolor');
	radius = parseInt(obj.getAttribute('radius'));
	if (radius == null || radius < 1) radius = 1;
	else if (radius > 6) radius = 6;

	MAX = radius * 2 + 1;

	/*	create table */
	Table = document.createElement('TABLE');
	TBody = document.createElement('TBODY');

	Table.cellSpacing = 0;
	Table.cellPadding = 0;

	for (trIDX=0; trIDX < MAX; trIDX++) {
		TR = document.createElement('TR');
		Space = Math.abs(trIDX - parseInt(radius));
		for (tdIDX=0; tdIDX < MAX; tdIDX++) {
			TD = document.createElement('TD');

			styleWidth = '1px'; styleHeight = '1px';
			if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
			else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
			else if (radius > 2) {
				if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
				if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
			}

			if (styleWidth != null) TD.style.width = styleWidth;
			if (styleHeight != null) TD.style.height = styleHeight;

			if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
			else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;

			if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
			TR.appendChild(TD);
		}
		TBody.appendChild(TR);
	}

	Table.appendChild(TBody);

	// insert table and remove original table
	Parent.insertBefore(Table, objTmp);
}

// FLASH SCIPRT
function swf_view(url, w, h) {
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width="+ w +" height="+ h +" align=\"middle\">");
	document.write("<param name=\"movie\" value="+ url +">");
	document.write("<param name=\"quality\" value=\"high\">");
	document.write("<param name=\"wmode\" value=\"transparent\">");
	document.write("<param name=\"bgcolor\" value=\"#FFFFFF\">");
	document.write("<embed src=" + url + " quality=\"high\" width="+ w +" height="+ h +" align=\"middle\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">");
	document.write("</object>");
}

// Movie SCIPRT
function mov_view(url, w, h) {
	document.write("<embed src='"+ url +"' width='"+ w +"' height='"+ h +"'>");
}

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=7,0,0,0\" width=\""+w+"\" height=\""+h+"\" id=\""+id+"\" align=\"\">"+
	"<param name=\"movie\" value=\""+url+"\" />"+
	"<param name=\"FlashVars\" value=\""+vars+"\" />"+
	"<param name=\"wmode\" value=\""+win+"\" />"+
	"<param name=\"quality\" value=\"high\" />"+
	"<param name=\"bgcolor\" value=\""+bg+"\" />"+
	"<embed src=\""+url+"\" FlashVars=\""+vars+"\" wmode=\""+win+"\" quality=\"high\" bgcolor=\""+bg+"\" width=\""+w+"\" height=\""+h+"\" name=\""+id+"\" align=\"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"+
	"</object>";
	
	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);
}

// mouseÀÌº¥Æ®¿¡ µû¸¥ ÀÌ¹ÌÁö Á¦¾î
function img_over(im) {
	img_src = im.src.substring(0,im.src.indexOf(".gif"));
	img_src = img_src + "_over.gif";
	im.src = img_src;
}

function img_out(im) {
	img_src = im.src.substring(0,im.src.indexOf("_over.gif"));
	img_src = img_src + ".gif";
	im.src = img_src;
}
