﻿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";
        }
    }
}