// JScript File
var ipagesize = 10;
var sChoseItem="";
var s_Cate ="I1";
var sContent="ctl00_cph_home_";
function goto_headpoint(i)
{

}
function set_main_side_block(iH)
{
   var dH = document.getElementById(sContent + "d_disp_newhome").offsetHeight; 
   if (iH>0) 
   {
       var hdn_S = parseInt(document.getElementById(sContent + "d_hdn_side").value);
       var hdn_M = parseInt(document.getElementById(sContent + "d_hdn_main").value);
       var hdn_H = parseInt(document.getElementById(sContent + "d_hdn_height").value);
       var uH = hdn_M -hdn_H+ dH;
       //-
       if (uH <hdn_S )  { uH=hdn_S; }
	    $("#tb-row").height(uH+30);
	    $("#container").height(uH+30);
	    //$("#tb-row").height(uH);
	    //$("#container").height(uH);
	    $("#main-block").height(uH);
	    $("#side-block").height(uH);
    }
    else
    {
    	document.getElementById(sContent + "d_hdn_height").value = String(dH);
    }
}
function go_ChoseItem(i)
{ 
    var g_ID = document.getElementById("d_hdn_id_"+i);
     var g_data = document.getElementById("d_ckb_"+i);
    if ( g_ID != null && g_data.checked == true)
    {
        if (sChoseItem.length>0) {sChoseItem += "|"; }
        sChoseItem += s_Cate+g_ID.value;
    }
    //alert(sChoseItem);
}
function go_compare()
{
    ipagesize = parseInt(document.getElementById(sContent + "d_chk_line").value);
    var sID = sChoseItem;  //"";
//    for (var i=1; i<=ipagesize;i++) 
//    {
//        var g_data = document.getElementById("d_ckb_"+i);
//        if (g_data != null) 
//        {
//            var g_ID = document.getElementById("d_hdn_id_"+i);
//            if ( g_ID != null && g_data.checked == true)
//            {
//                if (sID.length>0) {sID += "|"; }
//                sID += s_Cate+g_ID.value;
//            }
//        }
//    }
    //alert(sID);
    //-    
    var cURL = "H1_compare_home.aspx";
    if (sID !="") 
    {
        cURL += "?S_C_ID_LIST="+sID;
        var cGC = (Math.random()+1) * (Math.random()+1) ;
        var cwin = "G1_newhome_"  + cGC ;
        cwin = cwin.replace('.','');
        cwin = cwin.replace(' ','');
        win_open = window.open(cURL,cwin) ;
    }
    else
    {
        alert("คลิ๊กเลือกรายการ อย่างน้อย 1 รายการ.");
    }
    //-
}
function go_gmap()
{
    ipagesize = parseInt(document.getElementById(sContent + "d_chk_line").value);
    //var s_Cate ="I1";
    var sID = "";
    for (var i=1; i<=ipagesize;i++) 
    {
        var g_data = document.getElementById("d_ckb_"+i);
        if (g_data != null) 
        {
            var g_ID = document.getElementById("d_hdn_id_"+i);
            if ( g_ID != null && g_data.checked == true)
            {
              if (sID.length>0) {sID += "|"; }
                sID += s_Cate+g_ID.value;
            }
        }
    }
    //-    
    var cURL = "H1_home_gmap.aspx";
    if (sID !="" ) 
    {
        cURL += "?S_C_ID_LIST="+sID;
        var cGC = (Math.random()+1) * (Math.random()+1) ;
        var cwin = "G1_newhome_"  + cGC ;
        cwin = cwin.replace('.','');
        cwin = cwin.replace(' ','');
        win_open = window.open(cURL,cwin) ;
    }
     else
    {
        alert("คลิ๊กเลือกรายการ อย่างน้อย 1 รายการ.");
    }
    //-
}

function Open_Win_Popup(cURL) {
    var cGC = (Math.random()+1) * (Math.random()+1) ;
    var cwin = "G1_newhome_"  + cGC ;
    cwin = cwin.replace('.','');
    cwin = cwin.replace(' ','');
    win_detail = window.open(cURL,cwin);//window.open(cURL,cwin,"toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=0,left=0,width=770,height=550") ;
}
function Open_Win_Popup_860(cURL) {
   
    var cGC = (Math.random()+1) * (Math.random()+1) ;
    var cwin = "G1_newhome_860"  + cGC ;
    cwin = cwin.replace('.','');
    cwin = cwin.replace(' ','');
    //win_detail = window.open(cURL,cwin,"toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=0,left=0") ;
    win_detail = window.open(cURL,cwin) ;
}
function Open_HotPrj_Win(cURL,cGC) {
  var cGC = (Math.random()+1) * (Math.random()+1) ;
  var cwin = "G1_newhome_Hot"  + cGC ;  
  cwin = cwin.replace('.','');
  cwin = cwin.replace(' ','');
  win_detail =window.open(cURL,cwin);// window.open(cURL,cwin,"toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=no,top=0,left=0,width=770,height=550") ;
}
function sitemap(cURL) {
  msg = window.open(cURL,"sitemap","toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,top=10,left=20,width=390,height=750") ;
}
function Open_Win_Popup_PDF(cURL) {
   
    var cGC = (Math.random()+1) * (Math.random()+1) ;
    var cwin = "G1_newhome_"  + cGC ;
    cwin = cwin.replace('.','');
    cwin = cwin.replace(' ','');
    win_detail = window.open(cURL,cwin,"toolbar=no,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes,top=20,left=20,width=770,height=550") ;
}
function bookmarkhome(url,title)
{
    if (window.sidebar)
    {
        window.sidebar.addPanel(title,url,"");
    }
    else if ( document.all)
    {
        window.external.AddFavorite(url,title);
    }
    else if (window.opera && window.print)
    {
        return true;
    }
}