
var currentImage = 0;
var totalImages = 13;
var viewSize = 6;

/**********************
 **********************
 **********************
 **********************
 Added August 19th, 2008
 **********************
 **********************
 **********************
 **********************/
var Execute = function() {
			this.element = null;
			this.ex = function() { disableAnchor(this.element,false); };
	};

function moveToPrevious(el)
{
	var executeFunction = new Execute();
	if(currentImage > 0)
	{
		disableAnchor($(el),true);
		new Effect.Move('inside', { x: 141, y: 0, transition: Effect.Transitions.sinoidal });
		currentImage--;
		executeFunction.element = el;
		executeFunction.ex();
	}
}

function moveToNext(el)
{
	var executeFunction = new Execute();
	if(currentImage < totalImages-viewSize)
	{
		disableAnchor(el,true);
		new Effect.Move('inside', { x: -141, y: 0, transition: Effect.Transitions.sinoidal });
		currentImage++;
		executeFunction.element = el;
		executeFunction.ex();
	}
		
}

function disableAnchor(el, disable)
{
	if(disable)
	{
		var obj = $(el);
		var onclick = obj.getAttribute("onclick");
		if(onclick && onclick != "" && onclick != null)
		{
			try
			{
				$(el).style.setAttribute('onclick_bak',onclick);
			} catch (e) {
				obj.setAttribute('onclick_bak', onclick);
			};
		}
		try
		{
			$(el).style.removeAttribute('onclick');
		} catch (e) {
			obj.removeAttribute('onclick');
		};
	}
	else
	{
		try
		{
			var onclick_bak = document.getElementById(el).style.getAttribute("onclick_bak");
			setTimeout(function() { document.getElementById(el).style.setAttribute('onclick',onclick_bak); },3000);
		} catch (e) {
			setTimeout("$(\""+el+"\").setAttribute('onclick', $(\""+el+"\").getAttribute('onclick_bak'))",1000);
		};
	}
}

/**********************
 **********************
 **********************
 **********************
 Added August 19th, 2008
 **********************
 **********************
 **********************
 **********************/

var  scroll = {
	top: function(event) { new Effect.ScrollTo('top'); },
	bottom: function(el) { new Effect.ScrollTo(el); }
};

/**
 * Adds a function to the window onload event
 */
function addLoadEvent(func) {
    var oldOnload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldOnload();
            if (func) {
                func();
           }
        }
    }
}
addLoadEvent(function() {
  /* more code to run on page load */
});