// JScript File
function swffix(id,W,H,File) {
	document.getElementById(id).innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+W+"' height='"+H+"'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+File+"' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='wmode' value='transparent'><embed src='"+File+"' width='"+W+"' height='"+H+"' quality='high' wmode='transparent' pluginspage='http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' /></object>";
}

function swfMovie(id,File) {
	document.getElementById(id).innerHTML = "<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='610'  height='550' bgcolor='#FFFFFF'> <param name='movie' value='MainMovie.swf?file="+File+"&bufferTime=3&bufferTime=10&autoStart=true' /><param name='wmode' value='transparent'/><param name='quality' value='high' /></object>";
}

function movie_view(filename,w,h)
{
//document.write('<embed src="http://luna.eyainteractive.com/savefile/luna/movie/'+filename+'" width="'+w+'" height="'+h+'" SHOWDISPLAY=0 SHOWCONTROLS=0></embed>');
document.write('<embed src="../download/movie/'+filename+'" width="'+w+'" height="'+h+'" SHOWDISPLAY=0 SHOWCONTROLS=0></embed>');
}



function flash_call(url,width,height,background)
{


document.write('<table width="'+width+'" height="'+height+'" border="0"  cellpadding="0" cellspacing="0" id="main_event"><tr><td width="'+width+'">');
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">');
if (background=="N")
{
document.write('                <param name=wmode value=transparent>');
}



document.write('				<param name="movie" value="'+url+'">');
document.write('                <param name="quality" value="high">');
document.write('                <embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
document.write('              </object></td></tr></table>');


}

function GenStyle(hi){
	 document.write('<style type="text/css">');
	 document.write('body {');
	 document.write(' background-color: #02222D;');
	 document.write(' background-repeat: repeat-x;');
	 document.write('margin-left: 0px;');
	  document.write('margin-top:0px;');
	 if (hi==864){
		 document.write('margin-top:50px;');
	 }	
	  if (hi==800){
		 document.write('margin-top:15px;');
	 }	
	   if (hi==900){
		 document.write('margin-top:65px;');
	 }	
	 document.write('margin-right: 0px;');
	 document.write('margin-bottom: 0px;');
	 //document.write('background-image: url(Images/bg.jpg);');
	 document.write('}');
	 document.write('</style>');
}

function GenFrame(height){
	document.write('<IFRAME src=http://LunaPlus.gitex.co.th frameBorder=0  height=510 width=100% scrolling=no  >');
	document.write('</IFRAME>');
}

function openWindow(theURL,winName,features) 
			{ //v2.0
			window.open(theURL,winName,features).focus();
			}
function artwork_view(filename,w,h)
{
window.open("../download/art_view.aspx?filename="+filename+"&width="+w+"&height="+h+"","view","width=100,height=100,top=0,left=0,scrollbars=1");

}

function Movie_view(filename,w,h)
{
window.open("../download/Movie_view.aspx?filename="+filename+"&width="+w+"&height="+h+"","view","width=100,height=100,top=0,left=0,scrollbars=1");

}

function event_popup(filename)
{
//document.write('<embed src="http://luna.eyainteractive.com/savefile/luna/movie/'+filename+'" width="'+w+'" height="'+h+'" SHOWDISPLAY=0 SHOWCONTROLS=0></embed>');
window.open(filename,"","width=100,height=100,top=0,left=0,scrollbars=0");
}

function newspring_popup(filename,w,h)
{
window.open(filename,"","width="+w+",height="+h+",top=0,left=0,scrollbars=1");
}

function movie_title(filename,w,h)
{
//document.write('<embed src="http://luna.eyainteractive.com/savefile/luna/movie/'+filename+'" width="'+w+'" height="'+h+'" SHOWDISPLAY=0 SHOWCONTROLS=0></embed>');
document.write('<embed src="download/movie/'+filename+'" width="'+w+'" height="'+h+'" SHOWDISPLAY=0 SHOWCONTROLS=0></embed>');
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function writeFlash( arg )
{
  var parm = []
  var _default_version = "8,0,24,0";
  var _default_quality = "high";
  var _default_align = "middle";
  var _default_menu = "false";

  for(i = 0; i < arguments.length; i ++)
  {
    parm[i] = arguments[i].split(' ').join('').split('=')
      for (var j = parm[i].length-1; j > 1; j --){
        parm[i][j-1]+="="+parm[i].pop();
      }
    switch (parm[i][0])
    {
      case '_version'   	: var _version = parm[i][1] ; break ; 
      case '_swf'       		: var _swf     = parm[i][1] ; break ; 
      case '_base'      		: var _base    = parm[i][1] ; break ; 
      case '_quality'   		: var _quality = parm[i][1] ; break ; 
      case '_loop'      		: var _loop    = parm[i][1] ; break ; 
      case '_bgcolor'   	: var _bgcolor = parm[i][1] ; break ; 
      case '_wmode'     	: var _wmode   = parm[i][1] ; break ; 
      case '_play'      		: var _play    = parm[i][1] ; break ; 
      case '_menu'      	: var _menu    = parm[i][1] ; break ; 
      case '_scale'     		: var _scale   = parm[i][1] ; break ; 
      case '_salign'    		: var _salign  = parm[i][1] ; break ; 
      case '_height'    		: var _height  = parm[i][1] ; break ; 
      case '_width'     		: var _width   = parm[i][1] ; break ; 
      case '_hspace'    	: var _hspace  = parm[i][1] ; break ; 
      case '_vspace'    	: var _vspace  = parm[i][1] ; break ; 
      case '_align'     		: var _align   = parm[i][1] ; break ; 
      case '_class'     		: var _class   = parm[i][1] ; break ; 
      case '_id'        		: var _id      = parm[i][1] ; break ; 
      case '_name'      	: var _name    = parm[i][1] ; break ; 
      case '_style'     		: var _style   = parm[i][1] ; break ; 
      case '_declare'   		: var _declare = parm[i][1] ; break ; 
      case '_flashvars' 	: var _flashvars = parm[i][1] ; break ; 
      default           		:;
    }
  }

  var thtml = ""
  thtml += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + ((_version)?_version:_default_version) + "'"
  if(_width)        	thtml += " width='" + _width + "'"
  if(_height)       	thtml += " height='" + _height + "'"
  if(_hspace)       	thtml += " hspace='" + _hspace + "'"
  if(_vspace)       	thtml += " vspace='" + _vspace + "'"
  if(_align)        		thtml += " align='" + _align + "'"
  else              		thtml += " align='" + _default_align + "'"
  if(_class)        	thtml += " class='" + _class + "'"
  if(_id)           		thtml += " id='" + _id + "'"
  if(_name)         	thtml += " name='" + _name + "'"
  if(_style)        	thtml += " style='" + _style + "'"
  if(_declare)      	thtml += " " + _declare
                    		thtml += ">"
  if(_swf)          	thtml += "<param name='movie' value='" + _swf + "'>"
  if(_quality)      	thtml += "<param name='quality' value='" + _quality + "'>" 
  else              		thtml += "<param name='quality' value ='" + _default_quality + "'>"
  if(_loop)         	thtml += "<param name='loop' value='" + _loop + "'>"
  if(_bgcolor)      	thtml += "<param name='bgcolor' value='" + _bgcolor + "'>"
  if(_play)         	thtml += "<param name='play' value='" + _play + "'>"
  if(_menu)         	thtml += "<param name='menu' value='" + _menu + "'>"
  else              		thtml += "<param name='menu' value='" + _default_menu + "'>"
  if(_scale)        	thtml += "<param name='scale' value='" + _scale + "'>"
  if(_salign)       	thtml += "<param name='salign' value='" + _salign + "'>"
  if(_wmode)        thtml += "<param name='wmode' value='" + _wmode + "'>"
  if(_base)         	thtml += "<param name='base' value='" + _base + "'>"
  if(_flashvars)    	thtml += "<param name='flashvars' value='" + _flashvars  + "'>"
                    		thtml += "<embed pluginspage='http://www.macromedia.com/go/getflashplayer'"
  if(_width)        	thtml += " width='" + _width + "'"
  if(_height)       	thtml += " height='" + _height + "'"
  if(_hspace)       	thtml += " hspace='" + _hspace + "'"
  if(_vspace)       	thtml += " vspace='" + _vspace + "'"
  if(_align)        		thtml += " align='" + _align + "'"
  else              		thtml += " align='" + _default_align + "'"
  if(_class)        	thtml += " class='" + _class + "'"
  if(_id)           		thtml += " id='" + _id + "'"
  if(_name)         	thtml += " name='" + _name + "'"
  if(_style)        	thtml += " style='" + _style + "'"
                    		thtml += " type='application/x-shockwave-flash'"
  if(_declare)      	thtml += " " + _declare  
  if(_swf)          	thtml += " src='" + _swf + "'"
  if(_quality)      	thtml += " quality='" + _quality + "'"
  else              		thtml += " quality='" + _default_quality + "'"
  if(_loop)         	thtml += " loop='" + _loop + "'"
  if(_bgcolor)      	thtml += " bgcolor='" + _bgcolor + "'"
  if(_play)         	thtml += " play='" + _play + "'"
  if(_menu)         	thtml += " menu='" + _menu + "'"
  else              		thtml += " menu='" + _default_menu + "'"
  if(_scale)        	thtml += " scale='" + _scale + "'"
  if(_salign)       	thtml += " salign='" + _salign + "'"
  if(_wmode)        thtml += " wmode='" + _wmode + "'"
  if(_base)         	thtml += " base='" + _base + "'"
  if(_flashvars)    	thtml += " flashvars='" + _flashvars + "'"
                    		thtml += "></embed>"
                    		thtml += "</object>"
  document.write(thtml)
}

function multi_popup(f,w,h,s)
{
window.open(f,"aaaa","width="+w+",height="+h+",top=0,left=0,scrollbars="+s+"");
}

function gameClient1(fileName) {
	var ranNum= Math.floor(Math.random()*2);
			var url;
			if (parseInt(ranNum)==0){
				url='ftp://202.43.36.23/lunaplus/'+fileName
			}
			else{
				url='ftp://202.43.36.24/lunaplus/'+fileName
			}
			window.open(url);
}

function gameClient1_(fileName) {
	url="ftp://202.43.36.24/lunaplus/"+fileName;
	document.location.replace(url);
	//myWindow = window.open(url, "DarkClient", 'toolbar, width=30, height=20, left=3000, top=3000, scrollbars=yes, titlebar');
	//myWindow.document.close();
}

function gameClient2(fileName) {
	url="ftp://202.43.36.24/lunaplus/th_lnplus_101119.exe";//+fileName;
	document.location.replace(url);
}

function gameClientBit(fileName) {
	url="http://202.43.34.110/patch/"+fileName;
	document.location.replace(url);
	//myWindow = window.open(url, "DarkClient", 'toolbar, width=30, height=20, left=3000, top=3000, scrollbars=yes, titlebar');
	//myWindow.document.close();
}

function  lunaplusclient1(fileName) {
	url="ftp://202.43.36.23/"+fileName;
	document.location.replace(url);	
}
function LunaPlusClient2(fileName) {
	url="ftp://202.43.36.24/" +fileName;
	document.location.replace(url);	
}
function lunaplusclientbit(fileName) {
	url="http://202.43.36.23/patch/"+fileName;
	document.location.replace(url);	
}

function flashWrite(file,vars,w,h){
	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='Player' align='baseline'>"+
	"<param name='allowScriptAccess' value='sameDomain' />"+
	"<param name='movie' value='"+file+"' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='#ffffff' />"+
	"<param name='wmode' value='transparent'>"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<embed src='"+file+"' FlashVars='"+vars+"'  "+
	"quality='high' bgcolor='#ffffff' width='"+w+"' height='"+h+"' name='Player' align='baseline' "+
	"allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  "+
	"wmode='transparent'  loop='true' />"+
	"</object>";
	document.write(flashStr);
}


