﻿//begin vietnamnet
 //AP.Core.JS.Initialization.add(loadHomeBox);
        homeBoxLoaded = true;
        AP.Core.JS.Initialization.call(_initDynamicLead);
        //AP.Core.JS.PopupLead.init('bestNews');
        AP.Core.JS.Initialization.add(_initTopNews);
        AP.Core.JS.Initialization.call(_initHomeAdv);
        try{
        AP.Core.JS.Initialization.add(_bindGoldPrice);
        }catch(ex1){}
        try{
        AP.Core.JS.Initialization.add(_bindExchangeRate);
        }catch(ex2){}
        try{
        AP.Core.JS.Initialization.add(_bindStockInfo);
        }catch(ex3){}
        AP.Core.JS.Initialization.add(_initboxInfo);
        
        function _initDynamicLead()
        {
            AP.Core.JS.DynamicLead.GB = true;
            AP.Core.JS.DynamicLead.globalSlidePause = 6.5;
            AP.Core.JS.DynamicLead.globalTitleTransition = 1.4;
            AP.Core.JS.DynamicLead.init();
        }
        function _initTopNews()
        {
            AP.Core.JS.DynamicTab.init({id:'topNews', ajaxRequest: '/ajax/TopNews/get.html', cache: true, action: AP.Core.JS.PopupLead.init, template: tplTopnews});
        }
        function _initboxInfo()
        {
            AP.Core.JS.DynamicTab.init({id:'boxInfo', ajaxRequest: '/ajax/BoxInfo/get.html', cache: true, data: {ns:'boxInfo'}});
        }
        function _initHomeAdv()
        {
            AP.Core.JS.PhotoSlide.init({id:'headAdv', autoStart: true, slidePause: 15.0, direction: AP.Core.JS.PhotoSlide.Direction.Horizontal});
        }
        function _bindGoldPrice()
        {
            var s = //'<'+'p class="bold">Giá vàng:</'+'p>' +
            '<ta'+'ble cellpadding="0" cellspacing="1" width="100%">' +
            '<t'+'r>' +
            '<t'+'d>Vàng-Mua</t'+'d>' +
            '<t'+'d align="right">{Buy}</t'+'d>' +
            '</t'+'r>' +
            '<t'+'r>' +
            '<t'+'d>Vàng-Bán</t'+'d>' +
            '<t'+'d align="right">{Sell}</t'+'d>' +
            '</t'+'r>' +
            '</tab'+'le>';
            var t = new AP.Core.JS.Template({id:'boxInfoGoldPrice',template:s});
            t.overwrite('boxInfoGoldPrice', goldPrice);
        }
        function _bindExchangeRate()
        {
            var s = '<sp'+'an class="label name">{MoneyCode}</sp'+'an><sp'+'an class="label price">{Sell}</sp'+'an>';
            var t = new AP.Core.JS.Template({id:'boxInfoExchange',template:s});
            var tb = new AP.Core.JS.Template({id:'boxInfoExchangeFoo', template:'<b'+'r class="clear" />'});
            for (var i=0; i<exchangeRate.FORM.ROWSET.ROW.length; i++)
            {
                exchangeRate.FORM.ROWSET.ROW[i].Sell = exchangeRate.FORM.ROWSET.ROW[i].Sell.substr(0,exchangeRate.FORM.ROWSET.ROW[i].Sell.length-3);
                t.append('boxInfoExchange', exchangeRate.FORM.ROWSET.ROW[i]);
            }
            tb.append('boxInfoExchange', {});
        }
        function _bindStockInfo()
        {
            var s = '<sp'+'an class="stk_name">{name}</sp'+'an>' +
            '<sp'+'an class="stk_image"><i'+'mg height="9" width="9" src="/Images/{status}.gif" alt="" title="" /></sp'+'an>' +
            '<sp'+'an class="stk_price">{price}</sp'+'an>' +
            '<sp'+'an class="stk_price stk_price1">{diff}</sp'+'an>';
            var t = new AP.Core.JS.Template({id:'boxInfoStock',template:s});
            var tb = new AP.Core.JS.Template({id:'boxInfoStockFoo', template:'<b'+'r class="clear" />'});
            for (var i=0; i<stockInfo.FORM.ROWSET.ROW.length; i++)
            {
                t.append('boxInfoStock', stockInfo.FORM.ROWSET.ROW[i]);
            }
            tb.append('boxInfoStock', {});
        }
        //end vietnamnet

function clear_keyword()
 {
	var user = document.getElementById('rcv_top1_txtSearch').value;
	
	if(user=="Nhập từ khóa tìm kiếm")
	{
	   document.getElementById('rcv_top1_txtSearch').value = "";
	}
	
	if(user=="")
	{
	   document.getElementById('rcv_top1_txtSearch').value = "Nhập từ khóa tìm kiếm";
	}
 }
 
function clear_pass()
 {
	var user = document.getElementById('username').value;
	var pass = document.getElementById('password').value;
	
	if(pass=="123456")
	{
	   document.getElementById('password').value = "";
	}
	
	if(pass=="")
	{
	   document.getElementById('password').value = "123456";
	}
 }
