﻿//***************************
//showfolio profile js
//***************************

function showCredits(id)
{
    new Effect.toggle('show_credits' + id,'appear',{queue: 'end',duration:0});
    new Effect.toggle('hide_credits' + id,'appear',{queue: 'end',duration:0.2});
    
    new Effect.BlindDown('credits' + id,{duration:0.3, queue: 'end'});
}

function hideCredits(id)
{
    new Effect.BlindUp('credits' + id,{duration:0.3, queue: 'end'});
    new Effect.toggle('hide_credits' + id,'appear',{queue: 'end',duration:0});
    new Effect.toggle('show_credits' + id,'appear',{queue: 'end',duration:0.2});                    
}

function rollUpBigBoxes()
{
    var arr = document.getElementsByTagName("div");
    for (i = 0; i < arr.length; i++)
    {
        if(arr[i].className == "rolluptall")
        {   
            if(arr[i].clientHeight<417) //if it's not too tall, do next item
            {
                continue;
            }

            arr[i].style.height = "417px";
            //arr[i].style.border = "1px solid red";
            //arr[i].style.padding = "0 0 -20px 0";
            //arr[i].style.margin = "0 0 0 0";

            //enlarge the content box parent to fit the extra text in at the bottom
            cbox = arr[i].parentNode;
            if (cbox.className.indexOf("cBoxContent") < 0) {
                cbox = arr[i].parentNode.parentNode;
            }
            cbox.style.height = (parseInt(cbox.scrollHeight) + 3) + 'px';
            
            for(n = 0; n<arr[i].parentNode.childNodes.length; n++)
            {
                if(arr[i].parentNode.childNodes[n].className=="display-all")
                {
                    arr[i].parentNode.childNodes[n].style.visibility="visible";
                }
            }
        }
    }

    fixFooterCorner();
}

function unrollTall(id, link)
{
    var obj=document.getElementById(id);
    if(obj!=null)
    {
        obj.style.height = "auto";

        //enlarge the content box parent to fit the extra text in at the bottom
        cbox = obj.parentNode;
        if (cbox.className.indexOf("cBoxContent") < 0) {
            cbox = obj.parentNode.parentNode;
        }
        cbox.style.height = (parseInt(cbox.scrollHeight) + 3) + 'px';
        
        for(n = 0; n<link.parentNode.parentNode.childNodes.length; n++)
        {
            if(link.parentNode.parentNode.childNodes[n].className=="display-all")
            {
                link.parentNode.parentNode.childNodes[n].style.visibility="hidden";
            }
        }
        for(n = 0; n<link.parentNode.parentNode.childNodes.length; n++)
        {
            if(link.parentNode.parentNode.childNodes[n].className=="display-collapse")
            {
                link.parentNode.parentNode.childNodes[n].style.visibility="visible";
            }
        }
    }

    fixFooterCorner();
}

function rerollTall(id, link)
{
    var obj=document.getElementById(id);
    if(obj!=null)
    {
        obj.style.height = "417px";

        //enlarge the content box parent to fit the extra text in at the bottom
        cbox = obj.parentNode;
        if (cbox.className.indexOf("cBoxContent") < 0) {
            cbox = obj.parentNode.parentNode;
        }
        cbox.style.height = '';
        cbox.style.height = (parseInt(cbox.scrollHeight) + 3) + 'px';
        
        for(n = 0; n<link.parentNode.parentNode.childNodes.length; n++)
        {
            if(link.parentNode.parentNode.childNodes[n].className=="display-all")
            {
                link.parentNode.parentNode.childNodes[n].style.visibility="visible";
            }
        }
        for(n = 0; n<link.parentNode.parentNode.childNodes.length; n++)
        {
            if(link.parentNode.parentNode.childNodes[n].className=="display-collapse")
            {
                link.parentNode.parentNode.childNodes[n].style.visibility="hidden";
            }
        }
    }

    fixFooterCorner();
}

function fixFooterCorner() {
    //IE has this weird glitch where it doesn't redraw the box footer properly.
    //This checks for IE, sets a border around the footer corner, and unsets it.
   
    if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {

        var arr = document.getElementsByTagName("div");
        for (i = 0; i < arr.length; i++) {
            if (arr[i].className == "cBoxFooterR") {
                arr[i].style.border = "1px solid black";
                arr[i].style.border = '';
            }
        }
    }
}