﻿// JScript File
// JScript File
var is_ie = ( /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent) );
var is_ie5 = ( is_ie && /msie 5\.0/i.test(navigator.userAgent) );
var is_ie6 = ( is_ie && /msie 6\.0/i.test(navigator.userAgent) );
var is_ie7 = ( is_ie && /msie 7\.0/i.test(navigator.userAgent) );
/// detect Opera browser
var is_opera = /opera/i.test(navigator.userAgent);

/// detect KHTML-based browsers
var is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
var is_xp=/windows NT 5\.1/i.test(navigator.userAgent);
function selTab(tab,theme,hl){       
var strUrl="http://www.vietgle.vn/";  
    var pram = Ajax4Vg.UidTick_Header().value;    
    if(pram == null || pram == "null") pram="";
    switch(parseInt(tab)){           
        case 1://vh              
                location.href=strUrl + "trithucviet"+pram;
            break;
        case 2://mtd                                 
            location.href=strUrl + "tratu"+pram;            
            break;
        case 3://mt
            location.href=strUrl + "ongkinhviet"+pram;
            break;
        case 4://vebook                                    
            //location.href=strUrl + "sachviet"+pram;
            break;
        case 5://map                    
            location.href=strUrl + "dulich"+pram;
            break;
        case 6://forum
            location.href=strUrl + "diendan"+pram;
            break;
        case 7://home
            location.href=strUrl + "home"+pram;
            break;
    }    
}

function gotiengviet()
{
    if(document.getElementById("checkgoTV").checked==true)
    {        
        setTypingMode(4);
        Ajax4Vg.AddcheckgoTV("true").value;
    }
    else
    {         
        setTypingMode(0);
        Ajax4Vg.AddcheckgoTV("false").value;
    }
}

function setGoTV_mas(obj)
{    
    if(obj=="true")
    {
        setTypingMode(4);
        Ajax4Vg.AddcheckgoTV("true").value;
        if(document.getElementById("idImgGTV"))
        {
            document.getElementById("idImgGTV").className="iconVietnamese";
            document.getElementById("idImgGTV").title="Tắt gõ tiếng Việt";
        }
    }
    else if(obj=="false")
    {
        setTypingMode(0);
        Ajax4Vg.AddcheckgoTV("false").value;
        if(document.getElementById("idImgGTV"))
        {
            document.getElementById("idImgGTV").className="iconEnglish";    
            document.getElementById("idImgGTV").title="Bật gõ tiếng Việt";
        }
    }
}
function GoTV_mas(obj)
{                
   if(Ajax4Vg.GetcheckgoTV().value=="false")    
   {
        setTypingMode(4);
        Ajax4Vg.AddcheckgoTV("true").value;
        obj.className="iconVietnamese";
        obj.title="Tắt gõ tiếng Việt";
    }else
    {
        setTypingMode(0);
        Ajax4Vg.AddcheckgoTV("false").value;
        obj.className="iconEnglish";
        obj.title="Bật gõ tiếng Việt";
    }
    
    
}
function chechGotiengviet()
{    
    var el = document.getElementById("checkgoTV")
    if(el)
    {
        if(el.checked==true)
        {
            el.checked=false;
            setTypingMode(0);
            Ajax4Vg.AddcheckgoTV("false").value;            
        }
        else
        {        
            el.checked=true;
            setTypingMode(4);
            Ajax4Vg.AddcheckgoTV("true").value;
        }
    }
}

function gotiengviet_s()
{
    if(document.getElementById("checkgoTV_s").checked==true)
    {        
        setTypingMode(4);
    }
    else
    {         
        setTypingMode(0);
    }
}
function chechGotiengviet_s()
{
    var el=document.getElementById("checkgoTV_s");
    if(el)
    {
        if(el.checked==true)
        {
            el.checked=false;
            setTypingMode(0);
        }
        else
        {        
            el.checked=true;
            setTypingMode(4);
        }
    }
}

function namxuatbantu()
{    
    var t=new Date();     
    t=t.getFullYear();
    var strHtml =  '<select size="1" id="Comboboxtu" style=\"width:106px\" >'
    for(var i=1900;i<=t;i++)
    {    
        strHtml +='<option value="'+i+'">' + i + '</option>';      
    }
    strHtml +='</select>';   
    document.getElementById("tdcombobox_ncbttu").innerHTML=strHtml;        
}
function namxuatbantoi()
{
    var t=new Date();     
    t=t.getFullYear();
    var strHtml =  '<select size="1" id="Comboboxtoi" style=\"width:106px\" >'
    for(var i=t;i>=1900;i--)
    {    
        strHtml +='<option value="'+i+'">' + i + '</option>';      
    }
        strHtml +='</select>';   
    document.getElementById("tdcombobox_ncbttoi").innerHTML=strHtml;        
}


function viewByType(status)
{    
    window.location.href= "viewbooksbystatus.aspx?status="+ status;
}

function enterSearch()
{   
    var mIndex = document.getElementById("cbSubject").options.selectedIndex;    
    var m_subjectid=document.getElementById("cbSubject").options[mIndex].value;        
    var m_bookname = document.getElementById("txtword").value;
    if(m_bookname=="")return;
    m_bookname = Ajax4Vg.UnicodeToHexUTF8(m_bookname).value;
    window.location.href= "search.aspx?id="+ m_subjectid+"&bookname="+ m_bookname;
}
        
function tblogin()
{
    alert("Chức năng này chỉ dùng cho thành viên, Vui lòng đăng nhập.");
}

function tblogintinhphi()
{
    alert("Sách này có tính phí, Bạn phải mua mới đọc được");
}


//function AddSession(bookid)
//{
//    
//    
//    var URL=window.location.href;
//        var index = URL.indexOf("bookid=");
//    if(index!=-1)
//    {
//        URL=URL.substring(0,index);        
//        window.location.href=URL+"bookid="+bookid+"&dh=1"; 
//    }
//    else
//    {
//        if(URL.indexOf("aspx?") == -1)
//        {
//            window.location.href=URL+"?bookid="+bookid+"&dh=1"; 
//        }
//        else
//        {
//            window.location.href=URL+"&bookid="+bookid+"&dh=1"; 
//        }
//    }
//        
//}

//function viewsluonghang()
//{
//    var el=document.getElementById("slhang");
//    if(el)
//    {
//        el.innerHTML = Ajax4Vb.Countproduct().value;
//    }
//}



function viewProductBasket()
{
    if(Ajax4Vg.GetUID().value == "")
    {
        tblogin();
        return;
     }    
    window.location.href= "productbasket.aspx";
}                 

//function DeleteItem_gh(i)
//{        
//    if(check_delete())
//    {
//        document.getElementById("tdcenter_vb").innerHTML=Ajax4Vbooks.DeleteItem(i,strLang_vb).value;
//        document.getElementById("giohang").innerHTML=Ajax4Vbooks.giohang(strLang_vb).value;           
//    }
//}

//function check_delete (){  

//    var s=Ajax4Vg.GetResourceString("Global", strLang_vb, "question_delete").value  + "?";
//    return window.confirm(s);	
//}


function check_delete (){  

    var s=Ajax4Vg.GetResourceString("Global", "vi-VN", "question_delete").value  + "?";
    return window.confirm(s);	
}

function chitietsudung()
{
   window.location.href= "paydetail.aspx";
}
function sachdadathang()
{
    window.location.href="ordered.aspx";
}
function naptien()
{
   window.location.href= "topay.aspx";
}
function chitietnaptien()
{
   window.location.href= "detailtopay.aspx";
}
    
