



















function writeCookie(name,value,timeOut)
{
	var expires = "";
	if (timeOut != null && timeOut != '')
	{
		var date = new Date();
		date.setTime(date.getTime()+(timeOut*60*1000));
		expires = '; expires = ' + date.toGMTString();
	}

}

function validateLogin(objForm)
{
	if (document.charset == 'utf-8')
	{
		if (objForm.userName.value == '') { alert('Please insert username.'); return false; }
		else if (objForm.password.value == '') { alert('Please insert password.'); return false; }
	}
	else
	{
		if (objForm.userName.value == '') { alert('Please insert username.'); return false; }
		else if (objForm.password.value == '') { alert('Please insert password.'); return false; }
	}

	return true;
}

function openTrueLink(url, target)
{
	var win = window.open(url, target, "");
	win.focus();
}

function writeLogin(world)
{
	var path = "";
	var bgcolor="";
	if(world == 'music') { path = "music"; bgcolor = "#EC1A49"; }
	else if(world == 'sport') { path = "sport"; bgcolor = "#FE9E09"; }
	else if(world == 'movie') { path = "movie"; bgcolor = "#9E0000"; }
	var authenPath = 'http://trueworld.truelife.com/centralprofile';
	var isLogin = 'false';
	var str = "<TABLE width='170' border='0' cellpadding='0' cellspacing='0'>";
	str = str + "<TR><TD width='170' height='50' colspan='3'><img src='"+authenPath+"/newImages/images/"+path+"/login_01.gif' width='170' height='50'/></TD></TR>";
	str = str + "<TR>";
	str = str + "<TD width='25' background='"+authenPath+"/newImages/images/"+path+"/login_02.gif'><img src='"+authenPath+"/newImages/images/spacer.gif' width='1' height='1'/></TD>";
	str = str + "<TD width='125' align='center' bgcolor='"+bgcolor+"'>";
	str = str + "<TABLE width='100' border='0' cellpadding='0' cellspacing='0'>";
	if(isLogin == 'false')
	{
		str = str + "<FORM name='LoginForm' method='post' action='http://trueworld.truelife.com/centralprofile/Login?returnPage=http%3A%2F%2Fsport.trueworld.net%2Fnew%2Findex.jsp' onsubmit='return validateLogin(this);'>";
		str = str + "<TR><TD width='100' align='left' class='text_white'>User Name</TD></TR>";
		str = str + "<TR><TD width='100' align='left'><input type='text' name='userName' id='userName' value='' maxlength='10' size='17' style='background-color:#FFFFFF; width:100; height:20; color:#000000; border:1px solid #000000; font-size:12px;'/></TD></TR>";
		str = str + "<TR><TD width='100' align='left' class='text_white'>Password</TD></TR>";
		str = str + "<TR><TD width='100' align='left'><input type='password' name='password' id='password' value='' maxlength='20' size='17' style='background-color:#FFFFFF; width:100; height:20; color:#000000; border:1px solid #000000; font-size:12px;'/></TD></TR>";
		str = str + "<TR><TD width='100' align='left' class='text_white'>จำรหัสผ่าน</TD></TR>";
		str = str + "<TR><TD width='100' align='left'><select name='time' style='background-color:#FFFFFF; width:100; height:20; color:#000000; border:1px solid #000000; font-size:12px;'><option value='false'>ไม่จำรหัสผ่าน</option><option value='1'>1 วัน</option><option value='7'>1 สัปดาห์</option><option value='30'>1 เดือน</option><option value='326'>1 ปี</option></select></TD></TR>";
		str = str + "<TR><TD width='100' height='25' align='left' valign='bottom'><input type='image' name='imageField' src='"+authenPath+"/newImages/images/"+path+"/login_03.gif' border='0'/></TD></TR>";
		str = str + "<TR><TD width='100' height='15' align='left' valign='bottom' class='text_white'><img src='"+authenPath+"/newImages/images/"+path+"/allow.gif' width='7' height='10'/>&nbsp;<a href='http://trueworld.truelife.com/centralprofile/insertUserName.jsp' class='text_white'><u>ลืมรหัสผ่าน</u></a></TD></TR>";
		str = str + "<TR><TD width='100' height='15' align='left' valign='bottom' class='text_white'><img src='"+authenPath+"/newImages/images/"+path+"/allow.gif' width='7' height='10'/>&nbsp;<a href='http://trueworld.truelife.com/centralprofile/homeRegister.jsp' class='text_white'><u>สมัครสมาชิก</u></a></TD></TR>";
		str = str + "</FORM>";
	}
	else
	{
		str = str + "<TR>";
		str = str + "<TD width='50' align='left' valign='top'><img src='http://trueworld.truelife.com/product/images/avatar/null' width='45' height='45' border='0'/></TD>";
		str = str + "<TD width='75' align='left' valign='top' class='text_white'><Strong><font color='#000000'>null</font></strong><BR/><a href='http://trueworld.truelife.com/centralprofile/Logout?returnPage=http%3A%2F%2Fsport.trueworld.net%2Fnew%2Findex.jsp' class='text_white'><u>Sign Out</u></a></TD>";
		str = str + "</TR>";
		str = str + "<TR><TD width='125' height='15' align='left' valign='bottom' class='text_white' colspan='2'><img src='"+authenPath+"/newImages/images/"+path+"/allow.gif' width='7' height='10'/>&nbsp;<a href='http://minihome.truelife.com/' class='text_white'><u>MiniHome</u></a></TD></TR>";
		str = str + "<TR><TD width='125' height='15' align='left' valign='bottom' class='text_white' colspan='2'><img src='"+authenPath+"/newImages/images/"+path+"/allow.gif' width='7' height='10'/>&nbsp;<a href='http://trueworld.truelife.com/centralprofile/registerForm.jsp?pagetype=edit&random=Sat Sep 04 04:27:45 ICT 2010' class='text_white'><u>แก้ไขประวัติ</u></a></TD></TR>";
		str = str + "<TR><TD width='125' height='15' align='left' valign='bottom' class='text_white' colspan='2'><img src='"+authenPath+"/newImages/images/"+path+"/allow.gif' width='7' height='10'/>&nbsp;<a href='http://trueworld.truelife.com/centralprofile/changPassword.jsp' class='text_white'><u>เปลี่ยนรหัสผ่าน</u></a></TD></TR>";
	}
	str = str + "</TABLE>";
	str = str + "</TD>";
	str = str + "<TD width='20' background='"+authenPath+"/newImages/images/"+path+"/login_04.gif'><img src='"+authenPath+"/newImages/images/spacer.gif' width='1' height='1'/></TD>";
	str = str + "</TR>";
	str = str + "<TR><TD width='170' height='23' colspan='3'><img src='"+authenPath+"/newImages/images/"+path+"/login_05.gif' width='170' height='23'/></TD></TR>";
	str = str + "</TABLE>";
	document.write("<style type='text/css'>");
	document.write(".text_white { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 'MS Sans Serif', Thonburi, Helvetica; TEXT-DECORATION: none; }");
	document.write("a:link.text_white { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 'MS Sans Serif', Thonburi, Helvetica; TEXT-DECORATION: none; }");
	document.write("a:visited.text_white { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 'MS Sans Serif', Thonburi, Helvetica; TEXT-DECORATION: none; }");
	document.write("a:hover.text_white { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: 'MS Sans Serif', Thonburi, Helvetica; TEXT-DECORATION: none; }");
	document.write("a:active.text_white { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: 'MS Sans Serif', Thonburi, Helvetica; TEXT-DECORATION: none; }");
	document.write("</style>");
	document.write(str);

}

function writeHeader(world, page) {
	var path = "";
	var authenPath = 'http://trueworld.truelife.com/centralprofile';
	var isLogin = 'false';
	if(world == 'music') { path = "music"; }
	else if(world == 'sport') { path = "sport"; }
	else if(world == 'movie') { path = "movie"; }
	else if(world == 'tv') { path = "tv"; }
	var str = "";
	if(page == 'index') {
		str = str + "<TABLE width='1000' height='170' border='0' cellpadding='0' cellspacing='0'>";
		str = str + "<TR>";
		str = str + "<TD width='1000' height='170'>";
		str = str + "<script type='text/javascript'>AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','1000','height','170','src','"+authenPath+"/newImages/images/"+path+"/true"+path+"_topmenu?all_members=2417841','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','wmode','transparent','menu','0','movie','"+authenPath+"/newImages/images/"+path+"/true"+path+"_topmenu?all_members=2417841' );</script>";
		str = str + "</TD>";
		str = str + "</TR>";
		str = str + "</TABLE>";
	}
	else {
		str = str + "<TABLE width='1000' height='205' border='0' cellpadding='0' cellspacing='0'>";
		str = str + "<TR>";
		str = str + "<TD width='1000' height='170' background='"+authenPath+"/newImages/images/"+path+"/topbanner2.gif'>";
		str = str + "<script type='text/javascript'>AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','1000','height','170','src','"+authenPath+"/newImages/images/"+path+"/true"+path+"_topmenu_inner?all_members=2417841','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','wmode','transparent','menu','0','movie','"+authenPath+"/newImages/images/"+path+"/true"+path+"_topmenu_inner?all_members=383426' );</script>";
		str = str + "</TD>";
		str = str + "</TR>";
		str = str + "<TR><TD width='1000' height='35'><img src='"+authenPath+"/newImages/images/"+path+"/menu_02.gif' width='1000' height='35'/></TD></TR>";
		str = str + "</TABLE>";
	}
	document.write(str);
}

var centralProfileIsLogin = 'false';
var alias = 'null';

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
