// JavaScript Document

function esoHeader(){
   mmoHeader()
}
function esoFooter(){
   mmoFooter()
}


////////////// for page use //////////////////

/*main player guide flash menu*/
var showhidden = "a";
function showdiv(tags){
document.getElementById(showhidden).style.display = "none";
document.getElementById(tags).style.display = "block";
showhidden = tags;
}

function togglediv(obj,tags){
	var tags = (obj).getElementsByTagName("div");
	for(i=0;i<tags.length;i++){
		tags[i].style.display = "none";
	}
	(tags).style.display = "block";
}
/*main player guide flash menu*/

/*page tab js*/

function o_tab(){
	var tab_menu,tab_main;
	var on,off;
	var type;
	
	function $( id ){ return document.getElementById( id );}
	
	function setListener(){
		for( var i = 0; i < tab_menu.length; i++ ){
			tab_menu[i].cur_no = i;
			if( type == "" ){
				tab_menu[i].onclick = setOnAndOff;
			} else {
				tab_menu[i].onmouseover = setOnAndOff;
				tab_menu[i].onmouseout = setOnAndOff;
			}
		}
	}
	
	function setOnAndOff(){
		for( var i=0; i<tab_menu.length; i++ ){
		   	$(tab_main+(i+1)).style.display = ( i==this.cur_no )?"block":"none";
			tab_menu[i].className = ( i==this.cur_no )?on:off;
		}
		return false;
	}
	
	this.init = function( tab_menu1,tagName,tab_main1,on1,off1,no1,type1 ){
		tab_menu = $(tab_menu1).getElementsByTagName( tagName );
		tab_main = tab_main1;
		on = on1;
		off = off1;
		type = type1;
		tab_menu[no1-1].className = on;
		$(tab_main+no1).style.display = "block";
		setListener();
	}

}

////////* page tab js end*//////////////////

/*tooltip js*/

var body = null;
var div = null;
var frame = null;
var text;
var flag = false;
var width;
var heigth;

if (typeof document.attachEvent!='undefined') {
   window.attachEvent('onload',init);
} else {
   window.addEventListener('load',init,false);
}
function init(){ 	
	div = document.createElement("div");
	div.className = "ToolTip";
	
	div_in = document.createElement("div");
	div_in.className = "ToolTip2";
	
	frame = document.createElement("IFrame");
	frame.width = "100%";
	frame.height = "100%";
	frame.frameBorder = 0;
	
	div.appendChild(frame);
	div.appendChild(div_in);
	document.body.appendChild(div);
	
	div.style.display = "none";
}

function moveToopTip(e){	
	var src = null;
	src = (e.srcElement)?e.srcElement:e.target;

	src.onmouseout = hideToolTip;
	
	if(div.style.display == "none")div.style.display = "";
	
	if( !flag )setToolTipContent( text );
		
	setToolTipPosition(e);
}

function hideToolTip(){
	flag = !flag;
	if(div.style.display == "")div.style.display = "none";
}

function showToolTip( _text,e){	
	
	if( text != _text ){
		text = _text;
	}
	moveToopTip(e);
}

function setToolTipPosition(e){
	
	var x = y = 0;
	x = (e.x)?e.x:e.pageX;
	y = (e.x)?e.y:e.pageY;

	if( parseInt(x)+parseInt(width) > (document.body.clientWidth + document.documentElement.scrollLeft) )
		x=Math.abs(parseInt(x)-parseInt(width))-20;
	if( parseInt(y)+parseInt(height) > (document.body.clientHeight + document.documentElement.scrollTop) )
		y = Math.abs(parseInt(y)-parseInt(height))-20;
	
	div.style.width = width + "px";
	div.style.height = height + "px";
	div_in.style.width = width + "px";
	div_in.style.height = height + "px";	
	
	//alert(y+15);
	var ua = navigator.userAgent.toLowerCase();
	var isIE = (ua.indexOf("msie") > -1);
    if(isIE)
	{
	div.style.left = x + 5 + document.documentElement.scrollLeft + "px";
	div.style.top = y + 5  + document.documentElement.scrollTop + "px";
	}
	else
	{
	div.style.left = x + 5 +  "px";
	div.style.top = y + 5  +  "px";
	}
}


function setToolTipContent( text ){
	flag = !flag;	
	var frist_lenth = text.indexOf('|')+1;	
	widthheight = text.substr(frist_lenth,text.length);
	text = text.substr(0,frist_lenth-1);

	var width_lenth  = widthheight.indexOf(',') + 1;
	width = widthheight.substr(0,width_lenth-1);
	height = widthheight.substr(width_lenth,widthheight.length);

    if(text.substr(0,7) == "http://"){
		frame.style.display="";
		if(frame.src != text)frame.src = text;
		div_in.style.display="none";
	} else {
		div_in.style.display="";
		div_in.innerHTML=text;
		frame.style.display="none";
	}
}
/*-------------tooltip js over --------------*/

///////////////////////////////////////////////////////////
// "Live Clock" script (3.0)
// By Mark Plachetta (astroboy@zip.com.au)
// http://www.zip.com.au/~astroboy/liveclock/
///////////////////////////////////////////////////////////

var LC_Style=[
	"Arial",			// clock font
	"2",				// font size
	"black",			// font colour
	"white",			// background colour
	"The time is: ",	// html before time
	"",					// html after time
	200,				// clock width
	0,					// 12(1) or 24(0) hour?
	2,					// update never(0) secondly(1) minutely(2)
	0,					// no date(0) dd/mm/yy(1) mm/dd/yy(2) DDDD MMMM(3) DDDD MMMM YYYY(4)
	0,					// abbreviate days/months yes(1) no(0)
	null				// gmt offset (null to disable)
];

///////////////////////////////////////////////////////////

var LC_IE=(document.all);
var LC_NS=(document.layers);
var LC_N6=(window.sidebar);
var LC_Old=(!LC_IE && !LC_NS && !LC_N6);

var LC_Clocks=new Array();

var LC_DaysOfWeek=[
	["Sunday","Sun"],
	["Monday","Mon"],
	["Tuesday","Tue"],
	["Wednesday","Wed"],
	["Thursday","Thu"],
	["Friday","Fri"],
	["Saturday","Sat"]
];

var LC_MonthsOfYear=[
	["January","Jan"],
	["February","Feb"],
	["March","Mar"],
	["April","Apr"],
	["May","May"],
	["June","Jun"],
	["July","Jul"],
	["August","Aug"],
	["September","Sep"],
	["October","Oct"],
	["November","Nov"],
	["December","Dec"]
];

var LC_ClockUpdate=[0,1000,60000];

///////////////////////////////////////////////////////////

function LC_CreateClock(c) {
	if(LC_IE||LC_N6){clockTags='<span id="'+c.Name+'" style="width:'+c.Width+'px;background-color:'+c.BackColor+'"></span>'}
	else if(LC_NS){clockTags='<ilayer width="'+c.Width+'" bgColor="'+c.BackColor+'" id="'+c.Name+'Pos"><layer id="'+c.Name+'"></layer></ilayer>'}

	if(!LC_Old){document.write(clockTags)}
	else{LC_UpdateClock(LC_Clocks.length-1)}
}

function LC_InitializeClocks(){
		if(LC_Old){return}
	for(i=0;i<LC_Clocks.length;i++){
		LC_UpdateClock(i);
		if (LC_Clocks[i].Update) {
			eval('var '+LC_Clocks[i].Name+'=setInterval("LC_UpdateClock("+'+i+'+")",'+LC_ClockUpdate[LC_Clocks[i].Update]+')');
		}
	}
}

function LC_UpdateClock(Clock){
	var c=LC_Clocks[Clock];

	var t=new Date();
	if(!isNaN(c.GMT)){
	var offset=t.getTimezoneOffset();
	if(navigator.appVersion.indexOf('MSIE 3') != -1){offset=offset*(-1)}
		t.setTime(t.getTime()+offset*60000);
		t.setTime(t.getTime()+c.GMT*3600000);
	}
	var day=t.getDay();
	var md=t.getDate();
	var mnth=t.getMonth();
	var hrs=t.getHours();
	var mins=t.getMinutes();
	var secs=t.getSeconds();
	var yr=t.getYear();

	if(yr<1900){yr+=1900}

	if(c.DisplayDate>=3){
		md+="";
		abbrev="th";
		if(md.charAt(md.length-2)!=1){
			var tmp=md.charAt(md.length-1);
			if(tmp==1){abbrev="st"}
			else if(tmp==2){abbrev="nd"}
			else if(tmp==3){abbrev="rd"}
		}
		md+=abbrev;
	}

	var ampm="";
	if(c.Hour12==1){
		ampm="AM";
		if(hrs>=12){ampm="PM"; hrs-=12}
		if(hrs==0){hrs=12}
	}
	if(mins<=9){mins="0"+mins}
	if(secs<=9){secs="0"+secs}

	var html = '<font color="'+c.FntColor+'" face="'+c.FntFace+'" size="'+c.FntSize+'">';
	html+=c.OpenTags;
	html+=hrs+':'+mins;
	if(c.Update==1){html+=':'+secs}
	if(c.Hour12){html+=' '+ampm}
	if(c.DisplayDate==1){html+=' '+md+'/'+(mnth+1)+'/'+yr}
	if(c.DisplayDate==2){html+=' ('+LC_DaysOfWeek[day][c.Abbreviate]+', '+md+'/'+(mnth+1)+')'}
	if(c.DisplayDate>=3){html+=' on '+LC_DaysOfWeek[day][c.Abbreviate]+', '+md+' '+LC_MonthsOfYear[mnth][c.Abbreviate]}
	if(c.DisplayDate>=4){html+=' '+yr}
	html+=c.CloseTags;
	html+='</font>';

	if(LC_NS){
		var l=document.layers[c.Name+"Pos"].document.layers[c.Name].document;
		l.open();
		l.write(html);
		l.close();
	}else if(LC_N6||LC_IE){
		document.getElementById(c.Name).innerHTML=html;
	}else{
		document.write(html);
	}
}

function LiveClock(a,b,c,d,e,f,g,h,i,j,k,l){
	this.Name='LiveClock'+LC_Clocks.length;
	this.FntFace=a||LC_Style[0];
	this.FntSize=b||LC_Style[1];
	this.FntColor=c||LC_Style[2];
	this.BackColor=d||LC_Style[3];
	this.OpenTags=e||LC_Style[4];
	this.CloseTags=f||LC_Style[5];
	this.Width=g||LC_Style[6];
	this.Hour12=h||LC_Style[7];
	this.Update=i||LC_Style[8];
	this.Abbreviate=j||LC_Style[10];
	this.DisplayDate=k||LC_Style[9];
	this.GMT=l||LC_Style[11];
	LC_Clocks[LC_Clocks.length]=this;
	LC_CreateClock(this);
}







//////////////////////////////////////////////////////////////////////*Flashnews*//////////////////////////////////////////////////////////////////////////////////////////////////////
function playFlash(flashid){
    var fpic =document.getElementById(flashid).getElementsByTagName("img");
	var flink =document.getElementById(flashid).getElementsByTagName("a");
	var texts =document.getElementById(flashid).getElementsByTagName("a");
	var pic_width="280";
    var pic_height="210"; 
	var button_pos=fpic.length;
	var stop_time=6000; 
	var show_text=1; 
	var txtcolor="dddddd";
	var bgcolor="000000";
	var imag=new Array();
	var link=new Array();
	var text=new Array();

	var flashUrl = 'http://images.mmosite.com/zo/images/viewer.swf';


   for(var i=0;i<fpic.length;i++){
   imag[i]=fpic[i].src;
   }  

	var swf_height=pic_height;
	var pics="", links="", texts="";
	for(var i=0; i<imag.length; i++){
		pics=pics+("|"+imag[i]);
		links=links+("|"+flink[i]);
		
		
		//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 wmode="transparent" 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); 
	//document.writeln(links+"<br />"); 
}



////////////////main page////////////////////////////////////
function submenu(ID){
document.getElementById(ID).style.display=(document.getElementById(ID).style.display =='none')?'':'none';
}



///////////////////////// tab ///////////////////////////////////

var $ = function(i){return document.getElementById(i);}
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);


var switchpage = function(o, n, p){
   var ol = $(o+p);
   var cl = $(o+n);
   ol.style.display="none";
   cl.style.display="";
}

var p1 = 1;

var timer;
function page1(num){ 
   if( timer != undefined )
     clearInterval( timer );
   timer = setInterval( function(){
			switchpage("p1_", num, p1);
   			p1 = num;
			clearInterval( timer );
	},200 );
}

var p2 = 1;

var timer;
function page2(num){ 
   if( timer != undefined )
     clearInterval( timer );
   timer = setInterval( function(){
			switchpage("p2_", num, p2);
   			p2 = num;
			clearInterval( timer );
	},200 );
}

var p3 = 1;

var timer;
function page3(num){ 
   if( timer != undefined )
     clearInterval( timer );
   timer = setInterval( function(){
			switchpage("p3_", num, p3);
   			p3 = num;
			clearInterval( timer );
	},200 );
}

var p4 = 1;

var timer;
function page4(num){ 
   if( timer != undefined )
     clearInterval( timer );
   timer = setInterval( function(){
			switchpage("p4_", num, p4);
   			p4 = num;
			clearInterval( timer );
	},200 );
}



/*navigation*/

mySlideOutMenu.Registry = []
mySlideOutMenu.aniLen = 10
mySlideOutMenu.hideDelay = 500
mySlideOutMenu.minCPUResolution = 80

// constructor
function mySlideOutMenu(id, dir, left, top, width, height)
{
	this.ie  = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	this.css = "";

	if (this.ie || this.ns4 || this.dom) {
		this.id			 = id
		this.dir		 = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"
		this.dim		 = this.orientation == "h" ? width : height
		this.hideTimer	 = false
		this.aniTimer	 = false
		this.open		 = false
		this.over		 = false
		this.startTime	 = 0

		// global reference to this object
		this.gRef = "mySlideOutMenu_"+id
		eval(this.gRef+"=this")

		// add this menu object to an internal list of all menus
		mySlideOutMenu.Registry[id] = this

		var d = document

		var strCSS = "";
		strCSS += '#' + this.id + 'Container { visibility:hidden; '
		strCSS += 'left:' + left + 'px; '
		strCSS += 'top:' + top + 'px; '
		strCSS += 'width:' + width + 'px; '
		strCSS += 'height:' + height + 'px; '		
		strCSS += 'overflow:hidden; z-index:10000; }'
		strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
		strCSS += '}'

		this.css = strCSS;

		this.load()
	}
}

mySlideOutMenu.writeCSS = function() {
	document.writeln('<style type="text/css">');

	for (var id in mySlideOutMenu.Registry) {
		document.writeln(mySlideOutMenu.Registry[id].css);
	}

	document.writeln('</style>');
}

mySlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	var temp

	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
	else {
		this.container	= obj1
		this.menu		= obj2
		this.style		= this.ns4 ? this.menu : this.menu.style
		this.homePos	= eval("0" + this.dirType + this.dim)
		this.outPos		= 0
		this.accelConst	= (this.outPos - this.homePos) / mySlideOutMenu.aniLen / mySlideOutMenu.aniLen 

		// set event handlers.
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("mySlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("mySlideOutMenu.hideMenu('" + this.id + "')")

		//set initial state
		this.endSlide()
	}
}
	
mySlideOutMenu.showMenu = function(id)
{
	var reg = mySlideOutMenu.Registry
	var obj = mySlideOutMenu.Registry[id]
	
	if (obj.container) {
		obj.over = true

		// close other menus.
		for (menu in reg) if (id != menu) mySlideOutMenu.hide(menu)

		// if this menu is scheduled to close, cancel it.
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }

		// if this menu is closed, open it.
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
}

mySlideOutMenu.hideMenu = function(id)
{
	// schedules the menu to close after <hideDelay> ms, which
	// gives the user time to cancel the action if they accidentally moused out
	var obj = mySlideOutMenu.Registry[id]
	if (obj.container) {
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.hideTimer = window.setTimeout("mySlideOutMenu.hide('" + id + "')", mySlideOutMenu.hideDelay);
	}
}

mySlideOutMenu.hideAll = function()
{
	var reg = mySlideOutMenu.Registry
	for (menu in reg) {
		mySlideOutMenu.hide(menu);
		if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
	}
}

mySlideOutMenu.hide = function(id)
{
	var obj = mySlideOutMenu.Registry[id]
	obj.over = false

	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	
	// flag that this scheduled event has occured.
	obj.hideTimer = 0

	// if this menu is open, close it.
	if (obj.open && !obj.aniTimer) obj.startSlide(false)
}

mySlideOutMenu.prototype.startSlide = function(open) {
	this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime()	
	this.aniTimer = window.setInterval(this.gRef + ".slide()", mySlideOutMenu.minCPUResolution)
}

mySlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > mySlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(mySlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-")		d = -d
		else if (this.open && this.dirType == "+")	d = -d
		else if (!this.open && this.dirType == "-")	d = -this.dim + d
		else										d = this.dim + d

		this.moveTo(d)
	}
}

mySlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.startSlide(this.over)
	}
}

mySlideOutMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}
mySlideOutMenu.prototype.moveTo = function(p) { 
	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
mySlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}

// events
mySlideOutMenu.prototype.onactivate		= function() { }
mySlideOutMenu.prototype.ondeactivate	= function() { }
var $ = function(i){return document.getElementById(i);}
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);


/*tab change*/
	function getNames(obj,name,tij)
	{	
		var p = document.getElementById(obj);
		var plist = p.getElementsByTagName(tij);
		var rlist = new Array();
		for(i=0;i<plist.length;i++)
		{
			if(plist[i].getAttribute("name") == name)
			{
				rlist[rlist.length] = plist[i];
			}
		}
		return rlist;
	}

		function fod(obj,name)
		{
			var p = obj.parentNode.getElementsByTagName("a");
			var p1 = getNames(name,"f","div"); // document.getElementById(name).getElementsByTagName("div");
			for(i=0;i<p1.length;i++)
			{
				if(obj==p[i])
				{
					p[i].className = "over";
					p1[i].className = "dis";
				}
				else
				{
					p[i].className = "";
					p1[i].className = "undis";
				}
			}
		}
