var siteUrl = "http://accounts.mmosite.com/";

//if (typeof($) != 'function') {
//	function $(id) {
//		return document.getElementById(id);
//	}
//}


function accountsHeader(){
mmoHeader()
}
function accountsFooter(){
mmoFooter()
}


function getWindowSize(){
	return {
		Width:Math.max(document.body.scrollWidth, document.body.clientWidth),
		Height:Math.max(document.body.scrollHeight, document.body.clientHeight)
	}
}

function getDialogLoc(t_DiglogW, t_DiglogH) {
	var dde = document.documentElement;
	if (window.innerWidth) {
	  var ww = window.innerWidth;
	  var wh = window.innerHeight;
	  var bgX = window.pageXOffset;
	  var bgY = window.pageYOffset;
	} else {
	  var ww = dde.offsetWidth;
	  var wh = dde.offsetHeight;
	  var bgX = dde.scrollLeft;
	  var bgY = dde.scrollTop;
	}
	return {
		leftPos:(bgX + ((ww - t_DiglogW)/2)),
		topPos:t_DiglogY = (bgY + ((wh - t_DiglogH)/2))
	}
}


function openFrame(action, url, pmwidth, pmheight) {
	var ua = navigator.userAgent.toLowerCase();
	var isIE = (ua.indexOf("msie") > -1),isIE7 = (ua.indexOf("msie 7") > -1),isOpera = (ua.indexOf("opera") > -1),isSafari = (ua.indexOf("webkit") != -1 || ua.indexOf("khtml") != -1),isGecko = (!isSafari && ua.indexOf("gecko") > -1);
	
	if (typeof(url) == 'undefined')
		url = 'index.php';
	var objs = document.getElementsByTagName("OBJECT");
	if(action == 'open') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].style.visibility != 'hidden') {
				objs[i].setAttribute("oldvisibility", objs[i].style.visibility);
				objs[i].style.visibility = 'hidden';
			}
		}
		var clientWidth = document.body.clientWidth;
//		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		var clientHeight = getWindowSize().Height;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if (typeof(pmwidth) == 'undefined')
			pmwidth = 800;
		if (typeof(pmheight) == 'undefined')
			pmheight = clientHeight * 0.9;
		if(!document.getElementById('pmlayer_bg')) {
			div = document.createElement('div');
			div.id = 'pmlayer_bg';
			div.style.position = 'absolute';
			div.style.left = div.style.top = '0px';
			div.style.width = '100%';
			div.style.height = (clientHeight > document.body.scrollHeight ? clientHeight : document.body.scrollHeight) + 'px';
			div.style.backgroundColor = '#000';
			div.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=80,finishOpacity=100,style=0)';
			div.style.opacity = 0.8;
			div.style.zIndex = '98';
			document.getElementById('append_parent').appendChild(div);
			div = document.createElement('div');
			div.id = 'pmlayer';
			div.style.width = pmwidth + 'px';
			div.style.height = pmheight + 'px';
			div.style.left = ((clientWidth - pmwidth) / 2) + 'px';
			div.style.position = 'absolute';
			div.style.zIndex = '99';
			document.getElementById('append_parent').appendChild(div);
			document.getElementById('pmlayer').innerHTML = '<div style="width: ' + pmwidth + 'px; background: #666666; margin: 5px auto; text-align: left;">' +
				'<div style="width: ' + pmwidth + 'px; height: ' + pmheight + 'px; padding: 1px; background: #FFFFFF; border: 1px solid #7597B8; position: relative; left: -6px; top: -3px;">' +
				'<a href="###" onclick="openFrame(\'close\')"><img style="position: absolute;right: 20px;top: 15px" border="0" src="' + siteUrl + 'images/close.gif" title="close" /></a>' +
				'<iframe id="pmframe" name="pmframe" style="width:' + pmwidth + 'px;height:100%" allowTransparency="true" frameborder="0"></iframe></div></div>';
				
				
				
				
						document.getElementById('pmlayer2').innerHTML = '<div class="winbox" id="winbox2">' +
				' <div class="winbox_bg" id="winbox_bg2"></div><div class="winbox_main" id="winbox_main2"> <div class="winbox_close" title="click to close" onclick="openDiv(\'close\')"></div>' +
				document.getElementById(div_id).innerHTML + 
				'</div></div>';
						
		document.getElementById("winbox2").style.display = "block";
		document.getElementById("winbox2").style.marginLeft = -pmwidth/2 + "px";
		if(isIE){
		document.getElementById("winbox2").style.marginTop = -pmheight/2 + "px";
		}else{
	    document.getElementById("winbox2").style.top = -pmheight/2 + "px";
		}
		document.getElementById("winbox_bg2").style.width = pmwidth + "px";
		document.getElementById("winbox_bg2").style.height = pmheight + "px";
		document.getElementById("winbox_main2").style.width = pmwidth - 20 + "px";
		document.getElementById("winbox_main2").style.height = pmheight - 20 + "px";
		
		}
		document.getElementById('pmlayer').style.display = '';
		document.getElementById('pmlayer').style.top = getDialogLoc('', pmheight).topPos;
//		document.getElementById('pmlayer').style.top = ((clientHeight - pmheight) / 2 + scrollTop) + 'px';
		if(!url) {
			pmframe.location = 'index.php';
		} else {
			pmframe.location = url;
		}
		document.body.style.overflow = "hidden";
		document.body.scroll = "no";
	} else if(action == 'close') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].attributes['oldvisibility']) {
				objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue;
				objs[i].removeAttribute('oldvisibility');
			}
		}
		document.getElementById('pmlayer').style.display = 'none';
		document.body.style.overflow = "auto";
		document.body.scroll = "auto";
	}
}


function showWinboxDiv(action, div_id, pmwidth, pmheight, num) {
	var ua = navigator.userAgent.toLowerCase();
	var isIE = (ua.indexOf("msie") > -1),isIE7 = (ua.indexOf("msie 7") > -1),isOpera = (ua.indexOf("opera") > -1),isSafari = (ua.indexOf("webkit") != -1 || ua.indexOf("khtml") != -1),isGecko = (!isSafari && ua.indexOf("gecko") > -1);
	num = typeof(num) == 'undefined' ? '' : num;
	if (typeof(url) == 'undefined')
		url = 'index.php';
	if(action == 'open') {
		var clientWidth = document.body.clientWidth;
		var clientHeight = getWindowSize().Height;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if (typeof(pmwidth) == 'undefined')
			pmwidth = 800;
		if (typeof(pmheight) == 'undefined')
			pmheight = clientHeight * 0.9;

			div = document.getElementById(div_id);
			div.style.width = pmwidth + 'px';
			div.style.height = pmheight + 'px';
			div.style.left = ((clientWidth - pmwidth) / 2) + 'px';
			div.style.position = 'absolute';
			div.style.display = 'block';
			var num_added = num ? parseInt(num) : 0;
			div.style.zIndex = (95 + num_added).toString();

		document.getElementById("winbox" + num).style.display = "block";
		document.getElementById("winbox" + num).style.marginLeft = -pmwidth/2 + "px";
		
		//alert(document.getElementById("winbox" + num).style.marginLeft);
		
		if(isIE){
		$("#winbox"+ num).css('margin-top', -pmheight/2 + "px");
		$("#winbox").css('margin', -pmheight/2 + "px");
		}else{
	    $("#winbox"+ num).css('top', "70%");;
		$("#winbox").css('top', "70%");
		}
		//document.getElementById("winbox"+ num).style.Top = -pmheight/2 + "px";
		
		document.getElementById("winbox" + num).style.marginTop = -pmheight/2 + "px";
		document.getElementById("winbox_bg" + num).style.width = pmwidth + "px";
		document.getElementById("winbox_bg" + num).style.height = pmheight + "px";
		document.getElementById("winbox_main" + num).style.width = pmwidth - 20 + "px";
		document.getElementById("winbox_main" + num).style.height = pmheight - 20 + "px";

		
		div.style.display = '';
		div.style.top = getDialogLoc('', pmheight).topPos;
		document.body.style.overflow = "hidden";
		document.body.scroll = "no";
	} else {
		document.getElementById(div_id).style.display = 'none';
	}
}
/*
function openSecondDiv(action, div_id, pmwidth, pmheight) {
	if (typeof(url) == 'undefined')
		url = 'index.php';
	var objs = document.getElementsByTagName("OBJECT");
	if(action == 'open') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].style.visibility != 'hidden') {
				objs[i].setAttribute("oldvisibility", objs[i].style.visibility);
				objs[i].style.visibility = 'hidden';
			}
		}
		var clientWidth = document.body.clientWidth;
//		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		var clientHeight = getWindowSize().Height;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if (typeof(pmwidth) == 'undefined')
			pmwidth = 800;
		if (document.getElementById('append_parent2') == null) {
			div = document.createElement('div');
			div.id = 'append_parent2';
			document.body.appendChild(div);
		}	
			
		if (typeof(pmheight) == 'undefined')
			pmheight = clientHeight * 0.9;


			if(!document.getElementById('pmlayer2')) {
				div = document.createElement('div');
				div.id = 'pmlayer2';
				div.style.width = pmwidth + 'px';
				div.style.height = pmheight + 'px';
				div.style.left = ((clientWidth - pmwidth) / 2) + 'px';
				div.style.position = 'absolute';
				div.style.zIndex = '99';
				document.getElementById('append_parent2').appendChild(div);
			}

			
		document.getElementById('pmlayer2').innerHTML = '<div class="winbox" id="winbox2">' +
				' <div class="winbox_bg" id="winbox_bg2"></div><div class="winbox_main" id="winbox_main2"> <div class="winbox_close" title="click to close" onclick="openSecondDiv(\'close\')"></div>' +
				document.getElementById(div_id).innerHTML + 
				'</div></div>';
						
		document.getElementById("winbox2").style.display = "block";
		document.getElementById("winbox2").style.marginLeft = -pmwidth/2 + "px";
		document.getElementById("winbox2").style.marginTop = -pmheight/2 + "px";
		document.getElementById("winbox_bg2").style.width = pmwidth + "px";
		document.getElementById("winbox_bg2").style.height = pmheight + "px";
		document.getElementById("winbox_main2").style.width = pmwidth - 20 + "px";
		document.getElementById("winbox_main2").style.height = pmheight - 20 + "px";

		
		document.getElementById('pmlayer2').style.display = '';
		document.getElementById('pmlayer2').style.top = getDialogLoc('', pmheight).topPos;
		document.body.style.overflow = "hidden";
		document.body.scroll = "no";
	} else if(action == 'close') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].attributes['oldvisibility']) {
				objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue;
				objs[i].removeAttribute('oldvisibility');
			}
		}
		document.getElementById('pmlayer2').style.display = 'none';
		document.body.style.overflow = "auto";
		document.body.scroll = "auto";
	}
}*/

function openDiv(action, div_id,callback){
	$.prompt($('#'+div_id).html(), { 
		buttons:{OK:true},
		callback: function(v,m){ 
			if(v){ callback }else{ } 
		},
		prefix:'mmoalertwide'
	});
	
}
/*
function openDiv(action, div_id, pmwidth, pmheight,pmtop) {
	var objs = document.getElementsByTagName("OBJECT");
	if(action == 'open') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].style.visibility != 'hidden') {
				objs[i].setAttribute("oldvisibility", objs[i].style.visibility);
				objs[i].style.visibility = 'hidden';
			}
		}
		var clientWidth = document.body.clientWidth;
//		var clientHeight = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
		var clientHeight = getWindowSize().Height;
		var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		if (typeof(pmwidth) == 'undefined')
			pmwidth = 800;
		if (typeof(pmheight) == 'undefined')
			pmheight = clientHeight * 0.9;
			if(!document.getElementById('pmlayer')) {
				div = document.createElement('div');
				div.id = 'pmlayer';
				div.style.width = pmwidth + 'px';
				div.style.height = pmheight + 'px';
				div.style.left = ((clientWidth - pmwidth) / 2) + 'px';
				div.style.top = getDialogLoc('', pmheight).topPos + 'px';
				div.style.position = 'absolute';
				div.style.zIndex = '99';
				document.getElementById('append_parent').appendChild(div);
			}

			
		document.getElementById('pmlayer').innerHTML = '<div class="winbox" id="winbox">' +
				' <div class="winbox_bg" id="winbox_bg"></div><div class="winbox_main" id="winbox_main"> <div class="winbox_close" title="click to close" onclick="openDiv(\'close\')"></div>' +
				document.getElementById(div_id).innerHTML + 
				'</div></div>';
						
		document.getElementById("winbox").style.display = "block";
		document.getElementById("winbox").style.marginLeft = -pmwidth/2 + "px";
		//
		if(pmtop){
			document.getElementById("winbox").style.top = pmtop + "px";
		}else{
			document.getElementById("winbox").style.marginTop = -pmheight/2 + "px";
		}


		document.getElementById("winbox_bg").style.width = pmwidth + "px";
		document.getElementById("winbox_bg").style.height = pmheight + "px";
		document.getElementById("winbox_main").style.width = pmwidth - 20 + "px";
		document.getElementById("winbox_main").style.height = pmheight - 20 + "px";


//		if(!document.getElementById('pmlayer')) {
//			document.getElementById('append_parent').appendChild(div);
//			div = document.createElement('div');
//			div.id = 'pmlayer';
//			div.style.width = pmwidth + 'px';
//			div.style.height = pmheight + 'px';
//			div.style.left = ((clientWidth - pmwidth) / 2) + 'px';
//			div.style.position = 'absolute';
//			div.style.zIndex = '99';
//			document.getElementById('append_parent').appendChild(div);
////			alert(document.getElementById(div_id).innerHTML);
//		}
		
//			document.getElementById('pmlayer').innerHTML = '<div style="width: ' + pmwidth + 'px; background: #666666; margin: 5px auto; text-align: left;">' +
//				'<div style="width: ' + pmwidth + 'px; height: ' + pmheight + 'px; padding: 1px; background: #FFFFFF; border: 1px solid #7597B8; position: relative; left: -6px; top: -3px;">' +
//				'<a href="###" onclick="openDiv(\'close\')" style="position: absolute;right: 20px;top: 15px"><img border="0" src="' + siteUrl + 'images/close.gif" title="close" /> Close</a>' +
//				document.getElementById(div_id).innerHTML + 
//				'</div></div>';
		
		document.getElementById('pmlayer').style.display = '';
		//document.getElementById('pmlayer').style.top = getDialogLoc('', pmheight).topPos;
		//document.body.style.overflow = "hidden";
		document.body.scroll = "no";
	} else if(action == 'close') {
		for(i = 0;i < objs.length; i ++) {
			if(objs[i].attributes['oldvisibility']) {
				objs[i].style.visibility = objs[i].attributes['oldvisibility'].nodeValue;
				objs[i].removeAttribute('oldvisibility');
			}
		}
		document.getElementById('pmlayer').style.display = 'none';
		document.body.style.overflow = "auto";
		document.body.scroll = "auto";
	}
}
*/
function showFlash(iUrl,iWidth,iHeight,iWmode)
{
var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ iWidth +'" height="' + iHeight +'" />';
flash = flash + '<param name="movie" value="'+ iUrl +'" />';
flash = flash + '<param name="quality" value="high" />';
flash = flash + '<param name="menu" value="false" />';
if (iWmode == 1) {
   flash = flash + '<param name="wmode" value="opaque" />';      
}
flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" menu="false" quality="high" ';
if (iWmode == 1) {
   flash = flash + 'wmode="opaque" ';      
}
flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" mwode="transparent"></embed>';
flash = flash + '</object>';

document.writeln(flash); 
//alert(flash);
}
/*type_write*/
var count=0;
function type_write(div,content){
	  //alert(content.length);

	  if(count<=content.length){
	   document.getElementById(div).innerHTML=content.substring(0,count);
	   count++;
	   type = setTimeout("type_write(\""+div+"\",\""+content+"\")",30);
	  }else{
	   clearTimeout(type); 
	  }
	  document.body.onclick = function(){ 
		   clearTimeout(type);  
		   document.getElementById(div).innerHTML=content;
	  }
	  
}
/*****************************************************
 * ajaxload
 *****************************************************/	
function ajaxload(url, div)
{
	$('#'+div).html('');
	$('#'+div).load(url);
}

/*****************************************************
 * Request
 *****************************************************/	
function Request(sName)
{
  /*
   retrieve value before next //by33
  */
  
  var sURL = new String(window.location);
  var iQMark= sURL.lastIndexOf('?');
  var iLensName=sName.length;
  
  //retrieve loc. of sName
  var iStart = sURL.indexOf('?' + sName +'=') //limitation 1
  if (iStart==-1)
        {//not found at start
        iStart = sURL.indexOf('&' + sName +'=')//limitation 1
      if (iStart==-1)
         {//not found at end
          return 0; //not found
         }   
        }
        
  iStart = iStart + + iLensName + 2;
  var iTemp= sURL.indexOf('&',iStart); //next pair start
  if (iTemp ==-1)
      {//EOF
      iTemp=sURL.length;
      }  
  return sURL.slice(iStart,iTemp ) ;
  sURL=null;//destroy String
} 

/*****************************************************
 * cookie functions
 *****************************************************/	
function setcookie(name,value){
	var Days = 30;
	var exp = new Date();
	exp.setTime(exp.getTime() + Days*24*60*60*1000);
	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}


function getcookie(name){
	var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
	if(arr=document.cookie.match(reg)){
		return unescape(arr[2]);
	}
	else{
		return null;
	}
}
/*****************************************************
 * achievement_flash
 *****************************************************/	
function check_achievement(){
	/*
	 var showen = getcookie(achievement_name+'_'+achievement_grade);
	
	 if(  achievement_grade != "" && showen != 1){
		 showAllFlash("http://my.850312.tming.tmc/images/sns_images/achievement.swf",800,218,1,"achievement_grade="+achievement_grade+"&achievement_name="+achievement_name);
	 }
	 setcookie(achievement_name+'_'+achievement_grade,1)*/
}
/*****************************************************
 * tooltip
 *****************************************************/	
function tooltip(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 200;
	var speed = 1000;
	var timer = 1;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	this.x = false;
	var o = this;
	o.x_x = false;
	
	return{
		show:function(v,w){
			if(this.x){
				if(tt == null){
					tt = document.createElement('div');
					tt.setAttribute('id',id);
					t = document.createElement('div');
					t.setAttribute('id',id + 'top');
					c = document.createElement('div');
					c.setAttribute('id',id + 'cont');
					b = document.createElement('div');
					b.setAttribute('id',id + 'bot');
					tt.appendChild(t);
					c.appendChild(b);
					tt.appendChild(c);
					
					document.body.appendChild(tt);
					tt.style.opacity = 0;
					tt.style.filter = 'alpha(opacity=0)';
					
					o.x_x = true;
					
					document.onmousemove = this.pos;
				}
				tt.style.display = 'block';
				c.innerHTML = v;
				tt.style.width = w ? w + 'px' : 'auto';
				if(!w && ie){
					t.style.display = 'none';
					b.style.display = 'none';
					tt.style.width = tt.offsetWidth;
					t.style.display = 'block';
					b.style.display = 'block';
				}
				if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
				h = parseInt(tt.offsetHeight) + top;
				clearInterval(tt.timer);
				tt.timer = setInterval(function(){tooltip.fade(1)},timer);
			
			}
		},
		pos:function(e){
			if( o.x_x ){
				var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
				var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;			
				tt.style.top = (u - h) + 'px';
				tt.style.left = (l + left) + 'px';
			}
		},
		fade:function(d){
			if( o.x_x ){
				var a = alpha;
				if((a != endalpha && d == 1) || (a != 0 && d == -1)){
					var i = speed;
					if(endalpha - a < speed && d == 1){
						i = endalpha - a;
					}else if(alpha < speed && d == -1){
						i = a;
					}
					alpha = a + (i * d);
					tt.style.opacity = alpha * .01;
					tt.style.filter = 'alpha(opacity=' + alpha + ')';
				}else{
					clearInterval(tt.timer);
					if(d == -1){tt.style.display = 'none'}
				}
			}
		},
		hide:function(){
			if( o.x_x ){
				clearInterval(tt.timer);
				tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
			}
		}
	};
}




/*****************************************************
 * topmenu
 *****************************************************/	
function drop(num){
	//alert($('#drop_menu'+num).attr('class'));
	if( $('#drop_menu'+num).hasClass('on') ){
		$('.nav_bg span').addClass('off');
	}else{
		$('#drop_menu1').addClass('off');
		$('#drop_menu2').addClass('off');
		$('#drop_menu3').addClass('off');
		$('#drop_menu4').addClass('off');
		$('#drop_menu'+num).attr('class','on');	
	}
}

document.onclick   = function (e){
	
	e = window.event || e;
	cur_o = e.srcElement || e.target;
	if (cur_o.className != 'drop')
	{
		try{
			if( $('.nav_bg span').hasClass('on') ){
				$('.nav_bg span').removeClass('on');
			}
		}catch(err){}
		
	}
	

}
/*****************************************************
 * ShowFlash not for index
 *****************************************************/
function showFlash(iUrl,iWidth,iHeight,iWmode,flashVars)
{
	var myDate = new Date();
	var rand_time = myDate.getTime();
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ iWidth +'" height="' + iHeight +'"  id="lomowall" name="lomowall"/>';
	flash = flash + '<param name="movie" value="'+ iUrl +'" />';
	flash = flash + '<param name="allowScriptAccess" value="always" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	if(flashVars){
		flash = flash + '<param name="FlashVars" value='+flashVars+'&rtime'+rand_time+'" />';
	}
	if (iWmode == 1) {
	   flash = flash + '<param name="wmode" value="transparent" />';      
	}
	flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" menu="false" quality="high" ';
	if (iWmode == 1) {
	   flash = flash + 'wmode="transparent" ';      
	}
	flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" type="application/x-shockwave-flash" ';
	if(flashVars){
		flash = flash + 'flashvars="'+flashVars+'&rtime'+rand_time+'"';
	}
	flash = flash + ' mwode="transparent" name="lomowall" id="lomowall"></embed>';
	flash = flash + '</object>';
	
	document.writeln(flash); 
}


/*****************************************************
 * ShowFlash not for all
 *****************************************************/
function showAllFlash(iUrl,iWidth,iHeight,iWmode,flashVars)
{
	var flash = '<param name="movie" value="'+ iUrl +'" />';
	flash = flash + '<param name="allowScriptAccess" value="always" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	if(flashVars){
		flash = flash + '<param name="FlashVars" value="'+flashVars+'" />';
	}
	if (iWmode == 1) {
	   flash = flash + '<param name="wmode" value="transparent" />';      
	}
	flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" menu="false" quality="high" ';
	if (iWmode == 1) {
	   flash = flash + 'wmode="transparent" ';      
	}
	flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" type="application/x-shockwave-flash" ';
	if(flashVars){
		flash = flash + 'flashvars="'+flashVars+'"';
	}
	flash = flash + ' name="lomowall" id="lomowall"></embed>';


	$('#bodyInners').html("<div>"+flash+"</div>"); 
}

/*****************************************************
 * Friends & msg
 *****************************************************/
// Add as friend
function addfriend(url){
	mp_pop = new Popup({ contentType:1, isReloadOnClose:true,scrollType:false, width:320, height:120 });
	mp_pop.setContent("title","Add Friends");
	mp_pop.setContent("contentUrl",url);
	mp_pop.build();
	mp_pop.show();
	return false;
}
// Send mail
function sendmail(url){
	mp_pop = new Popup({ contentType:1, isReloadOnClose:true,scrollType:false, width:520, height:220 });
	mp_pop.setContent("title","Send Mail");
	mp_pop.setContent("contentUrl",url);
	mp_pop.build();
	mp_pop.show();
	if(con){
		window.frames['ifr_popup0'].document.getElementById('messages').value=con;
	}
	return false;
}
//Close popwin
function mp_close_pop(){
	mp_pop.close();
}

	 
/*****************************************************
 * errorimg
 *****************************************************/

function erroravator(dom) { 
/*var rimg = "<!--{IMAGES_URL}-->sns_images/ava.gif"; */

	dom.src = rimg2; 
	dom.alt = "";

} 
function errorimg(dom) { 
/*var rimg = "<!--{IMAGES_URL}-->sns_images/imgbg_dead.gif"; */
	dom.src = rimg1; 
	dom.alt = ""; 
} 
	 
/*****************************************************
 * bridge
 *****************************************************/

//mmoPop
function mmoPop(num){
	if (num ==1){
	document.getElementById("moregbi").style.display = "block"
	}else{
	document.getElementById("moregbi").style.display = "none"
	}
}
//mmoHeader
function myHeader(){

mmoGameHeader();
}


//Footer
function myFooter(){
mmoFooter();

}

	
	
/*****************************************************
 * bg link
 *****************************************************/	
	


var Fid = function(i){return document.getElementById(i);}

var switchMusic = function(o, n, p){
   var ol = Fid(o+p);
   var cl = Fid(o+n);
   ol.style.display="none";
   cl.style.display="";
}
var doClearStyle = function( num,tab,newStyle ){
	var li = Fid( tab ).getElementsByTagName( "li" );
	for( var i = 0; i < li.length; i++ ){
		if( ( num-1 ) == i ){
			li[i].className = newStyle;
		} else {
			li[i].className = "";
		}
	}
}

/*****************************************************
 * tab swich
 *****************************************************/


var m1 = 1;
function doChange( num ){  
   doClearStyle( num,"xtab1","on1" );
   
   switchMusic("xtab_cnt", num, m1);
   m1 = num;
   return false;
}


var m2 = 1;
function doTab2( num ){  
   doClearStyle2( num,"xtab1","tab1_on","tab1_one" );
   
   switchMusic("tab1_cnt", num, m2);
   m2 = num;
   return false;
}

var m3 = 1;
function doTab3( num ){  
   if( num != 1 ){
	   Fid( "xtab3" ).className = "sidebar_column1_top2 xx";
   } else {
   	   Fid( "xtab3" ).className = "sidebar_column1_top2";
   }
   switchMusic("sidebar_column1_cnt", num, m3);
   m3 = num;
   return false;
}


var m4 = 1;
function doChange2( num ){  
   doClearStyle( num,"xtab2","on1" );
   
   switchMusic("xtab2_cnt", num, m4);
   m4 = num;
   return false;
}

var m5 = 1;
function doChange3( num ){  
   doClearStyle( num,"xtab5","on2" );
   
   switchMusic("hot_cnt", num, m5);
   m5 = num;
   return false;
}
var doClearStyle2 = function( num,tab,newStyle,firstStyle ){
	var li = Fid( tab ).getElementsByTagName( "li" );
	for( var i = 0; i < li.length; i++ ){
		li[i].className = "";
	}
	if( num == 1 ){
		li[0].className = firstStyle + " " +  newStyle;
	} else {
		li[0].className = firstStyle;
		li[num-1].className = newStyle;
	}
}



/*****************************************************
 * play flash
 *****************************************************/
 
 function playFlash(flashid){
    var fpic =document.getElementById(flashid).getElementsByTagName("img");
	var flink =document.getElementById(flashid).getElementsByTagName("a");
	var pic_width="340"; 
    var pic_height="255";
	var button_pos=fpic.length;
	var stop_time=6000;
	var show_text=0; 
	var txtcolor="dddddd";
	var bgcolor="000000";
	var imag=new Array();
	var link=new Array();
	var text=new Array();

	var flashUrl = 'http://feature.mmosite.com/flashviewer/viewer02.swf';


   for(var i=0;i<fpic.length;i++){
   imag[i]=fpic[i].src;
   }  

	var swf_height=show_text==1?pic_height+0:pic_height;
	var pics="", links="", texts="";
	for(var i=0; i<imag.length; i++){
		pics=pics+("|"+imag[i]);
		links=links+("|"+flink[i*1]);
		
		//links=links+("|"+flink[i*2]);
		
		links = links.replace(/(&)/g,"-");
		texts=texts+("|"+text[i]);
		//alert(flink[i*2]);
	}
	
	pics=pics.substring(1);
	links=links.substring(1);
	texts=texts.substring(1);
	
	
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ pic_width +'" height="' + pic_height +'" /><param name="allowScriptAccess" value="always" />';
	flash = flash + '<param name="movie" value="'+ flashUrl +'" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	flash = flash + '<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&picwidth='+pic_width+'&picheight='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">';
    flash = flash + '<param name="wmode" value="transparent" />';
	flash = flash + '<embed src="' + flashUrl + '" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&picwidth='+pic_width+'&picheight='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"allowScriptAccess="always"  />';
	flash = flash + '</object>';
	document.writeln(flash); 
}

/*****************************************************
 * showGamelist
 *****************************************************/
 function getId(id) {
	return document.getElementById(id);
}
var switchpage = function(o, n, p){
   var ol = getId(o+p);
   var cl = getId(o+n);
   ol.style.display="none";
   cl.style.display="";
}

var gamelist_pre_no = 1;
function gamepage(num){  
	   var self = getId( "game-list-tab" ).getElementsByTagName("a");
	   for( var i = 0; i < self.length; i++ ){
			self[i].className = "";
	   }
	   self[num].className = "had";
	   switchpage("game-list-con", num, gamelist_pre_no);
	   gamelist_pre_no = num;
	   
	   return false;
	}
function doDisplay(){
	var game_list = getId( "game-list" );
	var game_con = getId( "game-con" );
	var gamelistbtn = getId( "gamelistbtn" );
		if(game_con.style.display == "none"){
			game_con.style.display = "block";
		} else {
			game_con.style.display = "none";
		}
		return false;
	}
	
function showGamelist(){
	var game_list = getId( "game-list" );
	var game_con = getId( "game-con" );
	var gamelistbtn = getId( "gamelistbtn" );

	game_con.style.display = "none";
	gamelistbtn.onclick = doDisplay;
	getId( "game-list-close-btn" ).onclick = doDisplay;

}
