// (C)opyright Instadia A/S 2000-2005
// Date: 08/04/05  Source: stable/cvs/trunk/js/gather/specials.js  Revision: 781
var ICSp = (document.location.protocol == "https:") ? 1 : 0;

if (typeof CSid == "undefined") 
    var CSid = "00000";
    
if (typeof CSil == "undefined") 
    var CSil = false;
    
if (typeof CSfm == "undefined") 
    var CSfm = false;
    
if (typeof CSlo == "undefined") 
    var CSlo = false;

if (typeof CSse == "undefined") 
    var CSse = false;

if (typeof CSel == "undefined") 
    var CSel = false;

if (typeof CSdl == "undefined") 
    var CSdl = false;

if (typeof CSlt == "undefined") 
    var CSlt = false;

if (typeof CSit == "undefined") 
    var CSit = false;

if (typeof CStd == "undefined") 
    var CStd = false;
    
if (typeof CShd == "undefined") 
    var CShd = "";

if (typeof CSlp == "undefined") 
    var CSlp = "";

if (typeof CSfp == "undefined") 
    var CSfp = "";
    
if (typeof CSlf == "undefined") 
    var CSlf = "";
    
if (typeof CSsf == "undefined") 
    var CSsf = "";

if (typeof CSi1 == "undefined") 
    var CSi1 = 0;

if (typeof CSi2 == "undefined") 
    var CSi2 = document.links.length;
    
if (typeof CSfeid == "undefined") 
    var CSfeid = CSid;
    
function appev(a, b, c, d)
{
    if(typeof Instadia_sendEvent == "function" && c != "")
    {
        c = (c == " " ? "" : c);
        Instadia_sendEvent(CSid, b + c, document.location.toString(), ICSp);
    }
    
    if(typeof a == "function")
    {
        a.apply(d);
    }
}

function appfe(a, b)
{
    if(typeof Instadia_formEvent == "function")
    {
        Instadia_formEvent(CSfeid, b, "", "", ICSp);
    }
    
    if(typeof a == "function")
    {
        a.apply(b);
    }
}

function ICScountProperties(obj)
{
    var vlNumber = 0;
    for (var i in obj)
    {
        vlNumber += 1;
    }
    
    return (vlNumber);
}

if(CSdl||CSel||CSil)
{
    var CSl = document.links;
    CShd += (CShd.length ? ", " : "") + ( CStd ? document.domain.replace(/^(www\.)?(.*)/,"$2") : document.domain);
    CShd = CShd.replace(/\ /g,"").split(",");
    
    for (var CSi = 0; CSi < CSl.length; CSi++)
    {
        var CSlUsed = 0;
        if (CSl[CSi].href.toLowerCase().indexOf("javascript:") != -1)
        {
            continue;
        }
        
        if (typeof CSl[CSi].onclick == "function" && (CSl[CSi].onclick.toString().indexOf("Instadia_send") != -1 || CSl[CSi].onclick.toString().indexOf("this") != -1))
        {
            continue;
        }
        
        var ICSregExp = /(^http[s]?|^file):[\/][\/]([^\/]+)[\/]?([^\?]+[\/])*([^\?]*)[\?]?(.*)/i;
        var ICSregRes = ICSregExp.exec(CSl[CSi].href);
        var CSr1 = ICScountProperties(ICSregRes) == 0 ? "" : typeof ICSregRes[2] == "undefined" ? "" : ICSregRes[2];
        var CSr2 = ICScountProperties(ICSregRes) == 0 ? "" : typeof ICSregRes[3] == "undefined" ? "" : ICSregRes[3];
        var CSr3 = ICScountProperties(ICSregRes) == 0 ? "" : typeof ICSregRes[4] == "undefined" ? "" : ICSregRes[4];
        var CSr4 = ICScountProperties(ICSregRes) == 0 ? "" : typeof ICSregRes[5] == "undefined" ? "" : ICSregRes[5];
        var CSlnktxt = ((navigator.appName=="Netscape") ? ( (typeof CSl[CSi].text != "undefined") ? CSl[CSi].text : "" ) : CSl[CSi].innerText);
        
        if(navigator.appName!="Netscape" && CSl[CSi].alt)
        {
            CSlnktxt = CSl[CSi].alt;
        }
        else if (navigator.appName!="Netscape" && CSl[CSi].all(0))
        {
            CSlnktxt = CSl[CSi].all(0).alt;
        }
        
        if(CSlt && CSlnktxt.length == 0)
        {
            CSlnktxt = CSr2 + CSr3;
        }
        
        if (CSdl && CSl[CSi].href.toLowerCase().match (/.*[.](zip|pdf|txt|exe|doc|xls|ppt|rar|pps|tar|gz|dwg|eps|dxf|rtf)$/))
        {
            if(typeof CSl[CSi].onclick == "undefined")
            {
                CSl[CSi].onclick = new Function("appev(undefined, 'Download # " + ( CSlt ? CSlnktxt : CSr2 + CSr3 ) + "',' ')");
                CSlUsed = 1;
            }
            else
            {
                CSl[CSi].onclick = new Function("appev(" + CSl[CSi].onclick + ", 'Download # " + ( CSlt ? CSlnktxt : CSr2 + CSr3 ) + "',' ')");
                CSlUsed = 1;
            }
        }
        else if (CSel)
        {
            var nhd = true;
            for (var CShdi = 0; CShdi < CShd.length; CShdi++)
            {
                if (CSr1 == "" || CSr1.indexOf(CShd[CShdi]) != -1)
                {
                    nhd = false;
                    continue;
                }
            }
            
            if (nhd)
            {
                if(typeof CSl[CSi].onclick == "undefined")
                {
                    CSl[CSi].onclick = new Function("appev(undefined, 'Exit # " + CSr1 + " - " + CSr2 + CSr3 + "',' ')");CSlUsed = 1;
                }
                else
                {
                    CSl[CSi].onclick = new Function("appev(" + CSl[CSi].onclick + ",'Exit # " + CSr1 + " - " + CSr2 + CSr3 + "',' ')");
                    CSlUsed = 1;
                }
            }
        }
        
        if (CSil && !CSlUsed && CSi >= CSi1 && CSi <= CSi2 && CSlp.indexOf(document.title.toString()) != -1)
        {
            CSl[CSi].onclick = new Function("appev(" + CSl[CSi].onclick + ",'Link # " + (CSit ? CSlnktxt : CSr2 + CSr3) + "',' ')");
        }
    }
}

if (CSfm||CSlo||CSse)
{
    window.defaultStatus = '';
    var formsMax = document.forms.length;
    
    for(var CSx = 0; CSx < formsMax; CSx++)
    {
        var CSf = document.forms[CSx];
        var fieldsmax = CSf.elements.length;
        
        for(var CSy = 0; CSy < fieldsmax; CSy++)
        {
            var CSe = CSf.elements[CSy];
            if(CSfm && (CSfp == "*" || CSfp.indexOf(document.title.toString()) != -1))
            {
                CSe.onchange = new Function ("appfe(" + (typeof CSe.onchange == "undefined" ? null : CSe.onchange) + ", this)");
            }
            
            if(CSlo && CSlf == CSe.name)
            {
                var CSe1 = CSe;
                CSf.onsubmit = new Function ("appev(" + (typeof CSf.onsubmit == "undefined" ? null : CSf.onsubmit) + ",'Login # ', CSe1.value, this)");
            }
            else if (CSse && CSsf == CSe.name)
            {
                var CSe2 = CSe;
                CSf.onsubmit = new Function ("appev(" + (typeof CSf.onsubmit == "undefined" ? null : CSf.onsubmit) + ",'Search # ', CSe2.value, this)");
            }
        }
    }
}
