﻿//-----------------------------------------------
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_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_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 OpenServey(id)
{
	var value = '-1';
	if (id==0)
	{
	    var sur = document.getElementsByName('optSurvey');
	    for (i=0;i<sur.length;i++)
	    {
	        if (sur[i].checked)
		        value=sur[i].value;
        }
	}
	//----------------
    var leftPos = (screen.availWidth-430) / 2;
	var topPos = (screen.availHeight-350) / 2;
	window.open('/Survey/AdResultSurvey.aspx?value=' + value,'','width=430,height=350,scrollbars=no,resizable=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
//-----------------------------------------------	
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">Chi tiết tại http://www.nhacso.net</a></td></tr>');;
	HTML += ('</table></body></html>');
	TorchTeWindow.document.write(HTML);
	TorchTeWindow.document.close();
}
//-----------------------------------------------
function SetViewTableDiv(tableName)
{
    var str = document.getElementById(tableName + 'Loc').style.display;
    if (str == 'block')
    {
        document.getElementById(tableName + 'Loc').style.display = "none";
        document.getElementById(tableName).src = "../images/AdImgDown.gif";
    }
    else
    {
        document.getElementById(tableName + 'Loc').style.display = "block";
        document.getElementById(tableName).src = "../images/AdImgUp.gif";
    }
    
}
//-----------------------------------------------
function SearchClick()
{
    var txtSearch = document.getElementById('txtSearch').value;
    if (txtSearch!='')
    {
        window.open("http://www.google.com/search?hl=en&output=FPT_Telecom&q=" + txtSearch); 
    }
    else
    {
        checkEmail();
    }
}
//-----------------------------------------------
function checkEmail()
{
    var username = document.getElementById('mailbox').value;
    var ext = document.getElementById("cboLoc").value;
    if (username!='username'&&username!='')
    {
        if (ext=='@fpt.vn')
            window.open("http://isp-mail.fpt.vn/exchange/logonFrm.asp?isnewwindow=0&mailbox=" + username + ext); 
        else
            window.open("http://isp-mail.hcm.fpt.vn/exchange/logonFrm.asp?isnewwindow=0&mailbox=" + username + ext); 
    }
}
//----------------------------------------------
function SetBlockAd1(strName)
{
    var arrAdTabSub = new Array('TinNoiBat','SoHoa','GiaiTri','DoThi');
    for(it=0;it<4;it++)
    {
        document.getElementById("Div" + arrAdTabSub[it]).style.display = "none";
        document.getElementById(arrAdTabSub[it]).className = "tabgrey"; 
    }
    //-----------------
    document.getElementById("Div" + strName).style.display = "block";
    document.getElementById(strName).className = "tabgreen";
}
//-----------------------------------------------
function SetBlockAd2(strName)
{
    var arrAdTabSub = new Array('NhacSo','Iptv','Mobione','PhimAnh');
    for(it=0;it<4;it++)
    {
        document.getElementById("Tab" + arrAdTabSub[it]).style.display = "none";
        try
        {
            document.getElementById("Div" + arrAdTabSub[it]).style.display = "none";
            document.getElementById(arrAdTabSub[it]).className = "tabgrey"; 
        }
        catch(error)
        {}
    }
    //-----------------
    document.getElementById("Tab" + strName).style.display = "block";
    try
    {
        document.getElementById("Div" + strName).style.display = "block";
        document.getElementById(strName).className = "tabgreen";
    }
    catch(error)
    {}
}
//-----------------------------------------------
var itCurrent = Math.floor(Math.random() * 4);
function SetBlockMasterAdRandom()
{
    SetBlockMasterAd2(itCurrent);
}
//-----------------------------------------------
function SetBlockMasterAd2(ArrayInt)
{
    var arrAdTabSub = new Array('NhacSo','Iptv','Mobione','PhimAnh');
    SetBlockAd2(arrAdTabSub[ArrayInt]);
}
//-----------------------------------------------
function SetBlockMaster(count)
{
    if (itCurrent==3 && count==1)
        itCurrent = -1;
    else if (itCurrent==0 && count==-1)
        itCurrent = 4;
    itCurrent += count;
    SetBlockMasterAd2(itCurrent);
}
//-----------------------------------------------
function SetBlockAdFiber(strName)
{
    var arrAdTabSub = new Array('GioiThieu','HoTro','BaoGia','LienHe');
    for(it=0;it<4;it++)
    {
        document.getElementById("Div" + arrAdTabSub[it]).style.display = "none";
        document.getElementById(arrAdTabSub[it]).className = "tabgrey"; 
    }
    //-----------------
    document.getElementById("Div" + strName).style.display = "block";
    document.getElementById(strName).className = "tabgreen";
}