/*  AdCom.LibraryJS.Javascript
    Developer: Lam Vi Banh
    Email: banhthidiem@yahoo.com
    --------------------------------------------------------
*/
function OpenMedia(urlvalue)
{
	var WMP7;
	try
	{
		if ( navigator.appName != "Netscape" )
		{
			WMP7 = new ActiveXObject("WMPlayer.OCX");
		}
	}
	catch (error)
	{
		;
	}
	var leftPos = (screen.availWidth - 230) / 2;
	var topPos = (screen.availHeight - 275) / 2;
	var TorchTeWindow = window.open("", "", "width=230,height=275,scrollbars=no,resizable=no,titlebar=0,top=" + topPos + ",left=" + leftPos);
	TorchTeWindow.document.open();
	var HTML = ('<html><head><title>fpt.vn - nhacso.net</title>');
	    HTML += ('<link type="text/css" href="/AdCss/PublicStyle.css" rel="stylesheet" />');
	    HTML += ('</head><body>');
	    HTML += ('<table border="0" height="250" width="210" align="center" class="tableBorder"><tr><td>');
	// Windows Media Player 7 Code
	if ( WMP7 )
	{
	    HTML += ('<OBJECT id="Player" height="250" width="210" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>');
	    HTML += ('<PARAM NAME="URL" VALUE=""+urlvalue+"">');
	    HTML += ('<PARAM NAME="rate" VALUE="1">');
	    HTML += ('<PARAM NAME="balance" VALUE="0">');
	    HTML += ('<PARAM NAME="currentPosition" VALUE="0">');
	    HTML += ('<PARAM NAME="defaultFrame" VALUE="">');
	    HTML += ('<PARAM NAME="playCount" VALUE="1">');
	    HTML += ('<PARAM NAME="autoStart" VALUE="1">');
	    HTML += ('<PARAM NAME="currentMarker" VALUE="0">');
	    HTML += ('<PARAM NAME="invokeURLs" VALUE="-1">');
	    HTML += ('<PARAM NAME="baseURL" VALUE="">');
	    HTML += ('<PARAM NAME="volume" VALUE="100">');
	    HTML += ('<PARAM NAME="mute" VALUE="0">');
	    HTML += ('<PARAM NAME="uiMode" VALUE="full">');
	    HTML += ('<PARAM NAME="stretchToFit" VALUE="0">');
	    HTML += ('<PARAM NAME="windowlessVideo" VALUE="0">');
	    HTML += ('<PARAM NAME="enabled" VALUE="-1">');
	    HTML += ('<PARAM NAME="enableContextMenu" VALUE="0">');
	    HTML += ('<PARAM NAME="fullScreen" VALUE="0">');
	    HTML += ('<PARAM NAME="SAMIStyle" VALUE="">');
	    HTML += ('<PARAM NAME="SAMILang" VALUE="">');
	    HTML += ('<PARAM NAME="SAMIFilename" VALUE="">');
	    HTML += ('<PARAM NAME="captioningID" VALUE="">');
	    HTML += ('</OBJECT>');
	}

	// Windows Media Player 6.4 Code
	else
	{
	    HTML += ('<OBJECT ID="Player"  classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
	    HTML += ('codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" ');
	    HTML += ('width="210" height="250"');
	    HTML += ('standby="Loading Microsoft Windows Media Player components..." ');
	    HTML += ('type="application/x-oleobject" VIEWASTEXT> ');
	    HTML += ('<PARAM NAME="FileName" VALUE=""+urlvalue+"">');
	    HTML += ('<PARAM NAME="TransparentAtStart" Value="false">');
	    HTML += ('<PARAM NAME="AutoStart" Value="true">');
	    HTML += ('<PARAM NAME="AnimationatStart" Value="false">');
	    HTML += ('<PARAM NAME="ShowControls" Value="false">');
	    HTML += ('<PARAM NAME="autoSize" Value="true">');
	    HTML += ('<PARAM NAME="ShowDisplay" value ="false">');
	    HTML += ('<PARAM NAME="displaySize" Value="0">');
	    HTML += ('<Embed type="application/x-mplayer2" ');
	    HTML += ('pluginspage= ');
	    HTML += ('"http://www.microsoft.com/Windows/MediaPlayer/" ');
	    HTML += ('src=""+urlvalue+"" ');
	    HTML += ('Name=MediaPlayer ');
	    HTML += ('transparentAtStart=0 ');
	    HTML += ('autostart=1 ');
	    HTML += ('animationAtStart=0 ');
	    HTML += ('autoSize=1');
	    HTML += ('width="210" height="250"');	
	    HTML += ('displaySize=0></Embed> ');
	    HTML += ('</OBJECT> ');
	}
	HTML += ('</td></tr>');
	HTML += ('<tr><td class="source"><a href="www.nhacso.net">Detail in http://www.nhacso.net</a></td></tr>');;
	HTML += ('</table></body></html>');
	TorchTeWindow.document.write(HTML);
	TorchTeWindow.document.close();
}
//===============================================
var pathImg 	= "Images/Home/";
var imgIsUse 	= "";
var imgOldSrc 	= "";
//===============================================
//-----------------------------------------------
function SetImgMouseDown(imgId, img)
{
    var str = AdFindObjectID(imgId + "Div").style.display;
	imgOldSrc = AdFindObjectID(imgId).src;
	if (str != "block")
		AdFindObjectID(imgId).src = pathImg + "MaximizeClick_" + img + ".gif";
    else
		AdFindObjectID(imgId).src = pathImg + "RestoreClick_" + img + ".gif";
	imgIsUse = img;
}
//-----------------------------------------------
function SetImgDragStart(imgId, img)
{
	if (imgIsUse != img)	return;
	AdFindObjectID(imgId).src = imgOldSrc;
}
//-----------------------------------------------
function SetViewTableDiv(tableName, img)
{
	var str = AdFindObjectID(tableName + "Div").style.display;
    if (str == "block")
    {
		AdFindObjectID(tableName + "Div").style.display = "none";
		AdFindObjectID(tableName).src = pathImg + "Maximize_" + img + ".gif";
		AdFindObjectID(tableName).title = "Maximize";
    }
    else
    {
        AdFindObjectID(tableName + "Div").style.display = "block";
        AdFindObjectID(tableName).src = pathImg + "Restore_" + img + ".gif";
		AdFindObjectID(tableName).title = "Restore";
    }
    
}
//-----------------------------------------------
function AdFindObjectID(idName)
{
	return document.getElementById(idName);
}
function AdFindObjectName(strName)
{
	return document.getElementsByName(strName);
}
//-----------------------------------------------
function SetBlockAdWebServer(strName,intTabLength)
{
    try
    {
        var strDivName = strName.substring(0,strName.length-2);
        var AdDiv = AdFindObjectID(strDivName);
        for (var i = 1; i <= intTabLength; i++)
        {
            var stri = strDivName;
            if (i < 10) 
                stri = strDivName + "0" + i;
            else 
                stri = strDivName + i;
            AdFindObjectID(stri).className = "tabgrey";
        }
        var strfile = AdFindObjectID(strName).headers;
        AdFindObjectID(strName).className = "tabgreen";
        AdDiv.innerHTML = AdGenerateHTML("/AdTest/XML/ad" + strfile + ".xml", "/AdTest/XSLT/ad" + strfile + ".xsl");
    }
    catch(ex){}
}
//-----------------------------------------------
function SetBlockAdWebClient(strName,intTabLength)
{
    try
    {
        var strDivName = strName.substring(0, strName.length - 2);
        for (var i = 1; i <= intTabLength; i++)
        {
            var stri = strDivName;
            if (i < 10) 
                stri = strDivName + "0" + i;
            else 
                stri = strDivName + i;
            AdFindObjectID(stri).className = "tabgrey";
            AdFindObjectID(AdFindObjectID(stri).headers).style.display = "none";
        }
        AdFindObjectID(strName).className = "tabgreen";
        AdFindObjectID(AdFindObjectID(strName).headers).style.display = "block";
    }
    catch(ex){}
}
//----------------------------------------------
function AdGenerateHTML(XMLFile,XSLFile)
{
    try
    {
    	var xml;
    	var xsl;
        if (window.ActiveXObject)
        {
			xml = new ActiveXObject("Microsoft.XMLDOM");
            xsl = new ActiveXObject("Microsoft.XMLDOM");
        }
        else if (document.implementation && document.implementation.createDocument)
        {
            xml= document.implementation.createDocument("", "", null);
            xsl= document.implementation.createDocument("", "", null);
        }
        else
        {
            return "Your browser cannot handle this script";
        }
        xml.async = false;
        xml.validateOnParse = true;
        xml.load(XMLFile);
        xsl.async = false;
        xsl.validateOnParse = true;
        xsl.load(XSLFile);
 	    return xml.transformNode(xsl);
        //-----------//-----------
 	}
    catch(errorObject)
    {
        return "<b>" + errorObject + "</b>";
    }
}