 

var dc = document.domain;

if ( dc == "www.c-games.net")
{
	alert("This is not the Maplestory Europe official website.\n Please do not leave your personal information. ");
}
/*apply title value setting start */
var _title = "";
function LastCall()
{ 
	var existFrame = document.getElementById("boardFrame");
	//var _title = "";
	
	if (!( ( existFrame == undefined )||( existFrame == null)))	//exist frame
	{
		//LastCallByFrame();
		_title = document.getElementById("title_r");
		 
		if (!( ( _title == undefined )||( _title == null)))
		{
			_title = _title.innerHTML; 
			_title = RemoveTag(_title); 
		}
		 
	}
	else
	{  
		if (_title == "")
		{
			_title = document.getElementById("title_r");	
			if (!( ( _title == undefined )||( _title == null)))
			{
				_title = _title.innerHTML; 
				_title = RemoveTag(_title); 
			}
			else
				_title = "";
		}
		
	}
	
	ApplyTitle();	
}

function ApplyTitle()
{ 
	if ((_title != "") && (_title != null))
		window.document.title = document.title+" -"+_title; 
}


function LastCallByFrame()
{ 
	if (_title == "")
	{
		_title = document.getElementById("title_r");	
		if (!( ( _title == undefined )||( _title == null)))
		{
			_title = _title.innerHTML;
			_title = RemoveTag(_title);
		}
		else
			_title = "";
		
	}
	var origionTitle = parent.document.title;
	var newTitle = "MapleStory Europe - Free to Play Online MMORPG Game -"+_title;
	
	 
	
 
	
	if ((_title != "") && (origionTitle != newTitle) )
	{ 
		parent.document.title = newTitle;//parent.document.title+_title;
	}
	
}

function RemoveTag(str)
{
	var objStrip = new RegExp();
	objStrip = /[<][^>]*[>]/gi;
	
	var rtn = str.replace(objStrip, ""); 
	rtn = rtn.replace(/&gt;/gi,">");
	rtn = rtn.replace(/&lt;/gi,"<"); 
	rtn = rtn.replace(">","");
	return rtn;
}
/*apply title value setting end */
 

/// * mouse roll over  img * ///
function CHIMG(obj){
   var str = obj.src;               
   if(str.indexOf('_on.gif') < 0){         
    ss = str.substr(0, str.indexOf('.gif'))      
    obj.src = ss + "_on.gif";                         
   }else{                                      
    ss = str.substr(0, str.indexOf('_on.gif'))
    obj.src = ss + ".gif";
   }
 }

/// * Select Box* ///


var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)


var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}

function showhide(obj, e, visible, hidden){
    if (ie5||ns6)
        dropmenuobj.style.left=dropmenuobj.style.top=-500
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
        obj.visibility=visible
    else if (e.type=="click")
        obj.visibility=hidden
}

function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
    var edgeoffset=0
    if (whichedge=="rightedge"){
    var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
        dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }
    else{
    var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
        dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    }
    return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    if (typeof dropmenuobj!="undefined") //hide previous menu
        dropmenuobj.style.visibility="hidden"
        clearhidemenu()
    if (ie5||ns6){
        obj.onmouseout=delayhidemenu
        dropmenuobj=document.getElementById(dropmenuID)
    if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
        dropmenuobj.onmouseover=clearhidemenu
        dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
        showhide(dropmenuobj.style, e, "visible", "hidden")
        dropmenuobj.x=getposOffset(obj, "left")
        dropmenuobj.y=getposOffset(obj, "top")
        dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
        dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
    return clickreturnvalue()
}

function clickreturnvalue(){
    if ((ie5||ns6) && !enableanchorlink) return false
    else return true
}

function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
}

function dynamichide(e){
    if (ie5&&!dropmenuobj.contains(e.toElement))
        delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
}

function delayhidemenu(){
    delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
    if (typeof delayhide!="undefined")
        clearTimeout(delayhide)
}

/* FIREFOX  URL COPY start */
function copyContent(str) 
{ 
    if (document.selection) 
    { 
        bResult = window.clipboardData.setData("Text",str); 
        if (bResult) alert(wsGetContext("msg0120")); 
    } else { 
        str = encodeforFlash(str); 
        var flashcopier = 'flashcopier'; 
        if(!document.getElementById(flashcopier)) { 
            var divholder = document.createElement('div'); 
            divholder.id = flashcopier; 
            document.body.appendChild(divholder); 
        } 
        document.getElementById(flashcopier).innerHTML = ''; 
        var divinfo = '<embed src="http://msimage.nexoneu.com/en/flash/_clipboard.swf" FlashVars="clipboard='+str+'" width="1" height="1" type="application/x-shockwave-flash"></embed>'; 
        document.getElementById(flashcopier).innerHTML = divinfo; 
        alert(wsGetContext("msg0120")); 
    } 
}; 

/*
firefox  url  copy ½Ã Å¬¸³º¸µå ÀÌ¿ë ºÒ°¡.
flash ¸¦ ÀÌ¿ëÇÏ¿©  url copy  Á¦°ø
*/
function encodeforFlash(str) 
{ 
    var SAFECHARS = "0123456789" + 
                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
                  "abcdefghijklmnopqrstuvwxyz" + 
                  "-_.!~*'()"; 

    var HEX = "0123456789ABCDEF"; 

    var plaintext = str; 
    var encoded = ""; 
    for (var i = 0; i < plaintext.length; i++ ) { 
        var ch = plaintext.charAt(i); 
        if (ch == " ") { 
            encoded += "+"; 
        } else if (SAFECHARS.indexOf(ch) != -1) { 
            encoded += ch; 
        } else { 
            var charCode = ch.charCodeAt(0); 
            if (charCode > 255) { 
                encoded += ch; 
            } else { 
                encoded += "%"; 
                encoded += HEX.charAt((charCode >> 4) & 0xF); 
                encoded += HEX.charAt(charCode & 0xF); 
            } 
        } 
    } 
    return encoded; 
}; 
/* FIREFOX  URL COPY end */

//Support View Page
function viewClick(idx)
{
	var divObj = document.getElementsByTagName("div");

	for(i=0;i<divObj.length;i++)
	{
		if(divObj[i].id.length>6)
		{
			if(divObj[i].id.substring(0,6)=="supDiv")
			{
				if(idx != divObj[i].id.substring(6))
				{
					divObj[i].style.display = "none";
					document.getElementById('img'+divObj[i].id.substring(6)).src = "http://msimage.nexoneu.com/en/forum/show.gif";
				}
			}
		}
	}
	
	if( document.getElementById('img'+idx).src == "http://msimage.nexoneu.com/en/forum/hide.gif")
	{
		document.getElementById('img'+idx).src = "http://msimage.nexoneu.com/en/forum/show.gif";
		document.getElementById('supDiv'+idx).style.display = "none";
	}
	else
	{
		if(document.getElementById('span'+idx).innerHTML=="")
		{
			var strParam = document.getElementById('BoardGroup').value+"|BBS|"+idx.toString();
			wsRdCntUpdate(strParam);
			if(document.all)
			{
				document.getElementById('rndcnt'+idx).innerText = parseInt(document.getElementById('rndcnt'+idx).innerText) + 1;
			}
			else
			{
				document.getElementById('rndcnt'+idx).textContent = parseInt(document.getElementById('rndcnt'+idx).textContent) + 1;
			}
		}
	
		document.getElementById('img'+idx).src = "http://msimage.nexoneu.com/en/forum/hide.gif";
		if(document.all)
		{
			document.getElementById('span'+idx).innerHTML = document.getElementById('txtarea'+idx).innerText;
		}
		else
		{
			document.getElementById('span'+idx).innerHTML = document.getElementById('txtarea'+idx).textContent;
		}
		document.getElementById('supDiv'+idx).style.display = "inline";
		
		
	}
	
	
	parent.resizeIframe("boardFrame");
}


//string prototype define
String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/gi, "");
}

String.prototype.replaceAll = function(str1, str2)
{
    var temp_str = "";

    if (this.trim() != "" && str1 != str2)
    {
    temp_str = this.trim();

    while (temp_str.indexOf(str1) > -1)
    {
        temp_str = temp_str.replace(str1, str2);
    }
    }

    return temp_str;
}

