﻿function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        { 
            c_start=c_start + c_name.length+1; 
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
        } 
    }
    return null;
}
function setCookie(c_name,value)
{
    document.cookie=c_name+ "=" +escape(value);
}
function clearCookie ( c_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = c_name += "=; expires=" + cookie_date.toGMTString();
}
function loadDoc(url)
{
    xmlhttp=null;
    if (window.XMLHttpRequest)
    {// code for IE7, Firefox, Opera, etc.
        xmlhttp=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET",url,false);
    xmlhttp.send(null);

    if (xmlhttp!=null)
    {
        return xmlhttp.responseText;
    }
    else
    {
        alert("Your browser does not support XMLHTTP.");
    }
}



/** 
* set idrop drop feature's version
*/
function setIDrop() {
    activexs = document.getElementsByName("iDrop");
    if (activexs == null)
        return;
    for (var i = 0; i < activexs.length; i++) {
        activex = document.getElementsByName("iDrop")[i];

        //Checking appVersion to load appropriate ActiveX control (32-bit or 64-bit)
        var appVersionName = navigator.appVersion;
        var index = appVersionName.indexOf("x64");
        if (index != -1) {
            //clsid for 64-bit control
            activex.classid = "clsid:32290CD1-D585-4803-AF20-F16E20FF377A";
        }
        else {
            //clsid for 32 bit control
            activex.classid = "clsid:21E0CB95-1198-4945-A3D2-4BF804295F78";
        }
    }
}


function setMyIDrop(pn) {
    var name = pn + "idrop"
    activexs = document.getElementsByName(name);
    if (activexs == null)
        return;

    //Checking appVersion to load appropriate ActiveX control (32-bit or 64-bit)
    var appVersionName = navigator.appVersion;
    var index = appVersionName.indexOf("x64");
    
    for (var i = 0; i < activexs.length; i++) {
        activex = activexs[i];
        if (index != -1) {
            //clsid for 64-bit control
            if (activex.classid == null || activex.classid=="")
                activex.classid = "clsid:32290CD1-D585-4803-AF20-F16E20FF377A";
        }
        else {
            //clsid for 32 bit control
            if (activex.classid == null || activex.classid == "")
                activex.classid = "clsid:21E0CB95-1198-4945-A3D2-4BF804295F78";
        }
    }
   }

   function showLEDMountDetail(mountSpan, imgHtml, detailHtml, idx) {
   	    var thumbSPAN = document.getElementById(mountSpan);
   	    thumbSPAN.style.top = (-100 + idx * 25) + "px";
    	thumbSPAN.innerHTML = imgHtml;
   	    thumbSPAN.innerHTML += "<div style=\"float:left;width:90px; padding-left:10px;  \">" + detailHtml.toString().replace("inch", "\"").replace("inch", "\"").replace("inch", "\"").replace("inch", "\"") + "<\div>";
   	    thumbSPAN.style.visibility = "visible";
   	thumbSPAN.style.zIndex = 50;
   	thumbSPAN.style.position = "absolute";
   	thumbSPAN.style.right = "35px";
   	thumbSPAN.style.marginTop = "100px";
   	thumbSPAN.style.display = "block";
   	thumbSPAN.style.background = "black";
   	thumbSPAN.style.color = "white";
   	thumbSPAN.style.width = "165px";
   	thumbSPAN.style.height = "62px";
   }

   function hideLEDMountDetail(mountSpan) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.innerHTML = "";
   	thumbSPAN.style.visibility = "hidden";
   	thumbSPAN.style.zIndex = 1;
   }

   function showXMountDetail(mountSpan, imgHtml, detailHtml, idx) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.style.top = (-100 + idx * 25) + "px";
   	thumbSPAN.innerHTML = imgHtml;
   	thumbSPAN.innerHTML += "<div style=\"float:left; width:90px; padding-left:10px; \">" + detailHtml.toString().replace("inch", "\"").replace("inch", "\"").replace("inch", "\"").replace("inch", "\"") + "<\div>";
   	thumbSPAN.style.visibility = "visible";
   	thumbSPAN.style.zIndex = 50;
   	thumbSPAN.style.position = "absolute";
   	thumbSPAN.style.right = "30px";
   	thumbSPAN.style.marginTop = "100px";
   	thumbSPAN.style.display = "block";
   	thumbSPAN.style.background = "black";
   	thumbSPAN.style.color = "white";
   	thumbSPAN.style.width = "165px";
   	thumbSPAN.style.height = "62px";
   }

   function hideXMountDetail(mountSpan) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.innerHTML = "";
   	thumbSPAN.style.visibility = "hidden";
   	thumbSPAN.style.zIndex = 1;
   }

   function showPMountDetail(mountSpan, imgHtml, detailHtml, idx) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.style.top = (-100 + idx * 25) + "px";
   	thumbSPAN.innerHTML = imgHtml;
   	thumbSPAN.innerHTML += "<div style=\"float:left; width:90px; padding-left:10px; \">" + detailHtml.toString().replace("inch", "\"").replace("inch", "\"").replace("inch", "\"").replace("inch", "\"") + "<\div>";
   	thumbSPAN.style.visibility = "visible";
   	thumbSPAN.style.zIndex = 50;
   	thumbSPAN.style.position = "absolute";
   	thumbSPAN.style.right = "30px";
   	thumbSPAN.style.marginTop = "100px";
   	thumbSPAN.style.display = "block";
   	thumbSPAN.style.background = "black";
   	thumbSPAN.style.color = "white";
   	thumbSPAN.style.width = "165px";
   	thumbSPAN.style.height = "90px";
   }

   function hidePMountDetail(mountSpan) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.innerHTML = "";
   	thumbSPAN.style.visibility = "hidden";
   	thumbSPAN.style.zIndex = 1;
   }

   function showGMountDetail(mountSpan, imgHtml, detailHtml, idx) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.style.top = (-100 + idx * 25) + "px";
   	thumbSPAN.innerHTML = imgHtml;
   	thumbSPAN.innerHTML += "<div style=\"float:left; width:90px; padding-left:10px; \">" + detailHtml.toString().replace("inch", "\"").replace("inch", "\"").replace("inch", "\"").replace("inch", "\"") + "<\div>";
   	thumbSPAN.style.visibility = "visible";
   	thumbSPAN.style.zIndex = 50;
   	thumbSPAN.style.position = "absolute";
   	thumbSPAN.style.right = "30px";
   	thumbSPAN.style.marginTop = "100px";
   	thumbSPAN.style.display = "block";
   	thumbSPAN.style.background = "black";
   	thumbSPAN.style.color = "white";
   	thumbSPAN.style.width = "165px";
   	thumbSPAN.style.height = "62px";
   }

   function hideGMountDetail(mountSpan) {
   	var thumbSPAN = document.getElementById(mountSpan);
   	thumbSPAN.innerHTML = "";
   	thumbSPAN.style.visibility = "hidden";
   	thumbSPAN.style.zIndex = 1;
   }


   function setMenus() {
       //set mainmenu
       if ((window.Menu) && (document.getElementById(window.Menu) != null)) {
           document.getElementById(window.Menu).style.color = "#000";
       }
   }




