function ShowEmployeeCardPopup(employee_id, link_text)
{	
	if (link_text == "(click for more info)")
	{
		document.getElementById('popup['+employee_id+']').style.display = 'block';
		document.getElementById('overlay_link['+employee_id+']').innerHTML = '(click for less info)';

		var MiddleHeight = document.getElementById('middle['+employee_id+']').clientHeight
		var TopBottom = MiddleHeight + 64

		document.getElementById('top['+employee_id+']').style.bottom=TopBottom + "px";
		TopBottom = TopBottom - 133;
		document.getElementById('glare['+employee_id+']').style.bottom= TopBottom + "px";
	}
	else
	{
		document.getElementById('popup['+employee_id+']').style.display = 'none';
		document.getElementById('overlay_link['+employee_id+']').innerHTML = '(click for more info)';
	}
}

function ShowClientManilaFolderPopup(client_id, link_text)
{	
	if (link_text == "More Info")
	{
		document.getElementById('popup['+client_id+']').style.display = 'block';
		document.getElementById('overlay_link['+client_id+']').innerHTML = 'Less Info';

		var MiddleHeight = document.getElementById('middle['+client_id+']').clientHeight
		var TopBottom = MiddleHeight + 34

		document.getElementById('top['+client_id+']').style.bottom=TopBottom + "px";
	}
	else
	{
		document.getElementById('popup['+client_id+']').style.display = 'none';
		document.getElementById('overlay_link['+client_id+']').innerHTML = 'More Info';
	}
}

function DashBoardButtonMouseOver(button_id)
{
	document.getElementById('link['+button_id+']').style.color = '#00afff';
	document.getElementById('link['+button_id+']').style.background = 'url(../../images/dashboard_button_arrow_over.png) no-repeat';
}

function DashBoardButtonMouseOut(button_id)
{
	document.getElementById('link['+button_id+']').style.color = '#000';
	document.getElementById('link['+button_id+']').style.background = 'url(../../images/dashboard_button_arrow.png) no-repeat';
}

function ToggleRays(link_text)
{
	if (link_text == "Rays Off")
	{
		document.getElementById('head_box').style.background='url(../../images/left_box_bg_no_rays.png) no-repeat left top';
		document.getElementById('toggle_rays').innerHTML = 'Rays On';
	}
	else
	{
		document.getElementById('head_box').style.background='url(../../images/left_box_bg.png) no-repeat left top';
		document.getElementById('toggle_rays').innerHTML = 'Rays Off';
	}
}

function DownloadMouseOver(download_id, icon_url)
{
	document.getElementById('download['+download_id+']').style.background = 'url(../../images/download_bg.png) no-repeat 0 -90px';
	document.getElementById('download['+download_id+']').style.cursor = 'pointer';
	document.getElementById('icon['+download_id+']').src = icon_url.substring(0, icon_url.length - 4) + '_over.png';
	
	document.getElementById('popup['+download_id+']').style.display = 'block';

	var MiddleHeight = document.getElementById('middle['+download_id+']').clientHeight
	var TopBottom = MiddleHeight + 64

	document.getElementById('top['+download_id+']').style.bottom=TopBottom + "px";
	TopBottom = TopBottom - 133;
	document.getElementById('glare['+download_id+']').style.bottom= TopBottom + "px";
}

function DownloadMouseOut(download_id, icon_url)
{
	document.getElementById('download['+download_id+']').style.background = 'url(../../images/download_bg.png) no-repeat top left';
	document.getElementById('icon['+download_id+']').src = icon_url;
	document.getElementById('popup['+download_id+']').style.display = 'none';
}

function DownloadMouseDown(download_id)
{
	document.getElementById('download['+download_id+']').style.background = 'url(../../images/download_bg.png) no-repeat 0 -180px';
}

function DownloadMouseUp(download_id)
{
	if (readCookie('DownloadsEnabled') == '1')
	{
		window.location = "/downloads/" + download_id
	}
	else
	{
		jQuery.facebox(function(){ $.ajax({dataType:'script', type:'post', url:'/download_signups/new?download_id='+download_id}) });
	}
}

function setCookie(name, value, days)
{
    if (days)
    {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else
    {
        var expires = "";
    }
    document.cookie = name + "=" + escape(value) + expires + ";";
}

function readCookie(name)
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');

    for (var i=0;i < ca.length;i++)
    {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}