var Description;
var DescriptionTimer = null;

IsIE = IsIE && !IsIE7;

function ProcessClientData() {
    
    try {
    
        var clientsLi = GetRef("ClientContainer").getElementsByTagName("li");
        var clientCount = clientsLi.length;
        var i;
        for (i=0; i<clientCount; i++) {
            var clientLi = clientsLi[i];
            clientLi.className += " Default";
            var dataDivId = clientLi.id.replace(/Client/, "Data");
            var dataDiv = GetRef(dataDivId);
            
            var aLinks = dataDiv.getElementsByTagName("a");
            if (aLinks && aLinks.length>0) {
                clientLi.href=aLinks[0].href;
                clientLi.onclick = Navigate;                
            }
            
            clientLi.ClientDescriptionData = new ClientDetails(i, dataDiv.innerHTML);
            
        }
        
    } catch (e) {
        // error    
    }
}

function Navigate() {
    var href=this.href;

    if (href) {
        if (href.match(/demonzmedia/)) {
            document.location = href;
        } else {
            OpenLink2(href);
        }
    }
}

function ClientOver(ref) {
    
    // $('element').getPosition();
    
    try {
    
        
        var pos = $(ref.id).getPosition();
        //var size = $(ref.id).getSize();

        
        if (ref) {
            ElementOver(ref);
        }
        
        if (DescriptionTimer) {
            clearTimeout(DescriptionTimer);
        }
        
        var index = ref.ClientDescriptionData.Index;
        var html = ref.ClientDescriptionData.Html;
        GetRef("DescriptionContent").innerHTML = html;
        
        var left = ((index % 6) * 110);
        var top = (Math.floor((index / 6)) * (IsIE ? 122: 112)); //- (IsIE ? 0 : 0);

        var position = FindPosition(GetRef("ClientFedexKinkos"));
        
        //window.status = position.Left+" "+position.Top+" "+IsIE+" "+index+" "+left+" "+top;
        
        left += position.Left;
        top += position.Top;
        
        var ref = GetRef("ClientDescription");
        var height = ref.offsetHeight;
        
        top -= height;
        
        

        
        ref.style.left = pos.x + "px"; //left+"px";
        ref.style.top = (pos.y - $("ClientDescription").getSize().y) + "px"; //top+"px";
        ref.style.visibility = "visible";

    } catch (e) {
    
    }
    
}

function ClientOut(ref) {
    try {
    
        if (ref) {
            ElementDefault(ref);
        }
   
        DescriptionTimer = setTimeout("HideClientDescription();", 1000);
    } catch (e) {
    }        
}

function ClearTimer() {
    try {
        if (DescriptionTimer) {
            clearTimeout(DescriptionTimer);
        }
    } catch (e) {
    }
}

function HideClientDescription() {
    try {
        GetRef("ClientDescription").style.visibility = "hidden";
    } catch (e) {
    }    
}

function ClientDetails(index, html) {
    this.Index = index;
    this.Html = html;
}