document.title = "::: dtac music :::";

// Rollover //
function autoBlur()
{ 
 if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
  document.body.focus(); 
} 
  document.onfocusin=autoBlur; 

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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_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_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 MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}


// Music Hub Top50 Tab //
var tabArray = new Array("All","Thaimusic","POP","Classics","OST","Worldmusic");

function showTabMenu(id) {
    var imgUrl = "/web/images/main/musichub_menu_";

    for(i=0;i<tabArray.length;i++){
        if (i!=id) {
			var objImgOff = document.getElementById("img"+tabArray[i]);
			objImgOff .src = imgUrl+tabArray[i]+"off.gif";
			var objListOff = document.getElementById(tabArray[i]);
			objListOff.style.display="none";
        }
	}
	
	var objImgOn = document.getElementById("img"+tabArray[id]);
	objImgOn .src = imgUrl+tabArray[id]+"on.gif";
	var objListOn = document.getElementById(tabArray[id]);
	objListOn.style.display="";
}


// Mobile Zone Hits Tab //
var mobileTabArray = new Array("Ring4U","Ringtone","FullSong","MVideo","CuttingBell");

function showMobileTabMenu(id) {
    var imgUrl = "/web/images/main/mobilezone_menu_";

    for(i=0;i<mobileTabArray.length;i++){
        if (i!=id) {
			var objImgOff = document.getElementById("imgMobile"+mobileTabArray[i]);
			objImgOff .src = imgUrl+mobileTabArray[i]+"off.gif";
			var objListOff = document.getElementById("mobile"+mobileTabArray[i]);
			objListOff.style.display="none";
        }
    }
    
    var objImgOn = document.getElementById("imgMobile"+mobileTabArray[id]);
	objImgOn .src = imgUrl+mobileTabArray[id]+"on.gif";
	var objListOn = document.getElementById("mobile"+mobileTabArray[id]);
	objListOn.style.display="";

}

// On the Radio //
var radioTabArray = new Array("FMMAX","HOTWAVE","EFM","VirginHits","SeedRadio","GETChart","FATRadio","EAZYRadio");

function showRadio(id) {    

    for(i=0;i<radioTabArray.length;i++){
        if (i!=id) {
			var objListOff = document.getElementById(radioTabArray[i]);
			objListOff.style.display="none";
        }
	}
	
	var objListOn = document.getElementById(radioTabArray[id]);
	objListOn.style.display="";

}


// Mobile Group Tab //
var groupTabArray = new Array("Group1","Group2","Group3");

function showGroupTabMenu(id) {
    var imgUrl = "/web/images/mypage/group_menu_";

    for(i=0;i<groupTabArray.length;i++){
        if (i!=id) {
            document.all["imgGroup"+groupTabArray[i]].src = imgUrl+groupTabArray[i]+"off.gif";
            document.all["group"+groupTabArray[i]].style.display="none";
        }
    }
    document.all["imgGroup"+groupTabArray[id]].src = imgUrl+groupTabArray[id]+"on.gif";
    document.all["group"+groupTabArray[id]].style.display="";

}



// Customer Center FAQ //
function toggle(e) 
{
	if (e.style.display == "none") 
	{     
		e.style.display = "";  
	} 
	else 
	{
		e.style.display = "none";
	}
}
		

// Popup Center //
function NewWindow(mypage, myname, w, h, scroll)
{
	var win = null;
	
	LeftPosition=(screen.width) ? (screen.width-w)/2 : 0;
	TopPosition=(screen.height) ? (screen.height-h)/2 : 0;				
	settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',resizable=no, scrollbars=' + scroll + ',toolbar=0,location=0,directories=0,status=0,menubar=0';
	win=window.open(mypage,myname,settings);
}

//* ÇÃ·¡½Ã ¸µÅ© *//
function render_flash(swf_name,swf_width,swf_height){
	var text ='';
	text ='<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="'+swf_width+'" height="'+swf_height+'">';
	text +='<param name="movie" value="'+swf_name+'">';
	text +='<param name="quality" value="high">';
	text +='<param name="wmode" value="transparent">';
	text +='<embed src="'+swf_name+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" width="'+swf_width+'" height="'+swf_height+'">';
    text +='</embed>';
	text +='</object>';
	document.write(text);
}

//* ÇÃ·¡½Ã ¸µÅ© *//
function render_flash_embed(swf_name,swf_width,swf_height){
	var text ='';
	text ='<embed src="'+swf_name+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+swf_width+'" height="'+swf_height+'">';
    text +='</embed>';
	document.write(text);
}

function trim(str) {
    return str.replace(/^\s*/, "").replace(/\s*$/, "");
}
