﻿function findObj(theObj, theDoc){
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}
    function postHTTPRequestOject(){
        var xmlhttp=false;
        try{
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e){
            try{
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(E){
                xmlhttp = false;
            }
        }
        if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
            xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
    }
    var xmlhttp=postHTTPRequestOject();
    function CallBack(){
        if(xmlhttp.readyState==4){
            if(xmlhttp.status==200){
                if(navigator.appName == "Netscape")
                    objHTML.innerHTML = xmlhttp.responseText;
                else
                findObj('objHTML').innerHTML = xmlhttp.responseText;
                //document.write(xmlhttp.responseText);
                //alert(xmlhttp.responseText)
            }
        }
    }
    //method= "POST" hoac "GET"
    function ButtonClick(method,page){
        xmlhttp.open(method,page,true);
        xmlhttp.onreadystatechange=CallBack;
        xmlhttp.send(null);
    }
    //ButtonClick("POST","page.aspx");
 
 // JavaScript Document
function tabcontrol(k,h,idName)
	{
		for(j=0;j<h;j++)
		{		
			v=findObj(idName+j);
			if(k==j)
			{
				if(v.style.display=="none")
					v.style.display = "";
				else v.style.display = "none";
			}
			else v.style.display = "none";
		}
	}
	
	function TurnPlayer(ids,link){
	    var obj=findObj(ids)
	    if(obj.style.display=="none"){
			obj.style.display = "";
			link.innerHTML="Tắt nhạc nền";
			
			}
		else {
		    obj.style.display = "none";
		    link.innerHTML="Mở nhạc nền";
		    }
	}
