// JavaScript Document
/**
* 	Adiciona um evento ao objeto
*
*/
function $id(id)
{
    try 
	{
        var a = document.getElementById(id);
    } 
	catch(e) 
	{
        alert("Erro encontrado: "+e);
    }
    return 	a;
}
/**
* 	Adiciona um evento ao objeto
*
*/
function addEvent(obj, evType, fn)
{
    //
    if (obj.addEventListener)
    {
        obj.addEventListener(evType, fn, true);
        return true;
    }
    else if (obj.attachEvent)
    {
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    }
    else
    {
        return false;
    }
}
/**
* 	Abre uma imagem através do lightbox
*
*/
function openImageLightBox(id) 
{
	if(document.getElementById("f"+id))
	{
		var a_false = $id("f"+id);
	}
	else
	{
		var a_false = document.createElement("a");
		a_false.rel = "lightbox";
		a_false.href = id;
	}
	
    myLightbox.start(a_false);
    a_false = null;	
}

function sDown (id)
{
	$id(id).scrollTop -= 10;
}
function sUp (id)
{
	$id(id).scrollTop += 10;
}


function nzkScrolling (target, targetUp, targetDown)
{
	targetUp = $id(targetUp);
	targetDown = $id(targetDown);
	
	targetUp.target = target;
	targetDown.target = target;
	
	targetUp.style.cursor = "pointer";
	targetDown.style.cursor = "pointer";
	
	targetUp.onmousedown = function ()
	{
		this.intervalID = setInterval('sDown("'+this.target+'");', 10);
	}
	
	targetUp.onmouseup = function ()
	{
		clearInterval(this.intervalID);
	}
	
	targetDown.onmousedown = targetDown.onmouseout = function ()
	{
		this.intervalID = setInterval('sUp("'+this.target+'");', 10);
	}
	
	targetDown.onmouseup = targetDown.onmouseout =  function ()
	{
		clearInterval(this.intervalID);
	}
	
}