

/* IMAGE ROLLOVERS */
var images = "images/";
function button_action(sender, path, action, ext)
{
    sender.style.cursor = 'pointer';
	if (ext == null) ext = "jpg";
	sender.src = images + path + ((action == "over") ? "-rollover" : "") + "." + ext;
}







/*
 *	CLIENT DROP DOWN
 */

var clientDropEffect;
var clientDropClosedY = -250;
var clientDropOpenY = 0;
var clientDropContainerId = "clientDrop";
function setupClientDrop()
{
	var clientDrop = '#'+clientDropContainerId;
	
	$(clientDrop).bind("mouseenter",function()
	{	
		$(clientDrop).animate( { top:clientDropOpenY }, { queue: false, duration: 500 } );
	}).bind("mouseleave",function()
	{
		$(clientDrop).animate( { top:clientDropClosedY },  { queue: false, duration: 500 } );
	});
}






/* CAROUSEL */

/*var boxWidth = 300;
function slideLeft()
{
	if (getSliderLeft() == 0) return;
	slideBy(boxWidth);
}

function slideRight()
{
	if ((getSliderLeft() <= (($$('#scrollContent .box').length-3) * -boxWidth))) return;
	slideBy(-boxWidth);
}

var sliderLeft;
var slideInProgress = false;

var buttonRightFx;
var buttonLeftFx;

function slideBy(x)
{
	if (slideInProgress) return;
	
	if (getSliderLeft() > 0);
	
	var effect = new Fx.Style('scrollContent', 'marginLeft', {
		duration: 500, 
		transition: Fx.Transitions.Sine.easeInOut,
		onComplete: slideComplete
	});

	// before making the transition, do a check to see if we should fade out buttons now
	checkBeforeSlide(x);
	
	slideInProgress = true;
	effect.start(parseInt(getSliderLeft())+x);
}

function checkBeforeSlide(x)
{
	var targetSliderLeft = getSliderLeft() + x;
	
	if (targetSliderLeft == 0) buttonLeftFx.start(0);
	else buttonLeftFx.start(100);
	
	//alert (getSliderLeft() + " ::: VS ::: " + ($$('#scrollContent .box').length * -boxWidth));
	
	if (targetSliderLeft <= (($$('#scrollContent .box').length-3) * -boxWidth)) buttonRightFx.start(0);
	else buttonRightFx.start(100);
}

function slideComplete()
{
	// it's done, so set the slideInProgress flag back to false
	slideInProgress = false;
	
	// check whether buttons should be displayed
	//checkButtonVisiblity();
	
}

function checkButtonVisiblity()
{
	if (getSliderLeft() == 0) buttonLeftFx.start(0);
	else buttonLeftFx.start(100);
	
	//alert (getSliderLeft() + " ::: VS ::: " + ($$('#scrollContent .box').length * -boxWidth));
	
	if (getSliderLeft() <= (($$('#scrollContent .box').length-3) * -boxWidth)) buttonRightFx.start(0);
	else buttonRightFx.start(100);
}

function getSliderLeft()
{
	sliderLeft = document.getElementById("scrollContent").style.marginLeft;
	if (sliderLeft == "" || parseInt(sliderLeft) == "NaN") return 0;
	else return parseInt(sliderLeft);
}*/





var topnav_menu_timer;
function RollTopNavMenu(p,s) {
    if(s == 'on') {
	    clearTimeout(topnav_menu_timer);
	    getElem('TopNavMenuDrop'+p).style.display = 'inline';
    }
    else {
        topnav_menu_timer = setTimout("getElem('TopNavMenuDrop'+p).style.display = 'none'", 500);
    }
}


function ClickTopNav(p,u) {
    var elem = getElem('TopNavMenuDrop' + p);
    if(elem) elem.style.display = 'none';
    document.location.href = u;
}



function init()
{
    /*if(getElem('scrollContent')) {
	    // setup button transitions
	    buttonLeftFx = new Fx.Style('buttonLeft', 'opacity', {duration:500});
	    buttonRightFx = new Fx.Style('buttonRight', 'opacity', {duration:500});
    	
    	
	    // check for less than 4 boxes
	    if ( $$('#scrollContent .box').length < 4)
	    {
		    $('buttonLeft').setStyle("display", "none");
		    $('buttonRight').setStyle("display", "none");
	    }
	    else
	    {
		    buttonRightFx.set(0);
		    buttonLeftFx.set(0);
		    $('buttonLeft').setStyle("display", "block");
		    $('buttonRight').setStyle("display", "block");
    		
	    }
    	
	    // setup slider buttons visiblity
	    checkButtonVisiblity();
	}*/
	
	
	
	// setup drop downs
	//new DropdownMenu($('byServiceMenu'))
	
	// show on rollover
	/*var servicesTimer;
	$('servicesNav').addEvent('mouseenter', function()
	{
		servicesTimer = $clear(servicesTimer);
		$('servicesNavDrop').setStyle('display', 'block');
		
	});
	$('servicesNav').addEvent('mouseleave', function()
	{
		servicesTimer = (function() { $('servicesNavDrop').hide() } ).delay(500);
	});*/
	
	// keep sublist items highlighted when mouse goes over to sublist
	
	/*$$('.outerLink').each(function(instance) {  
		instance.addEvent('mouseenter', function()
		{
			instance.addClass('active');
		});
		instance.addEvent('mouseleave', function()
		{
			instance.removeClass('active');
		});
	});*/
	
	/*var workTimer;	
	$('workNav').addEvent('mouseenter', function()
	{
		workTimer = $clear(workTimer);
		$('workNavDrop').setStyle('display', 'block');
		
	});
	$('workNav').addEvent('mouseleave', function()
	{
		workTimer = (function() { $('workNavDrop').hide() } ).delay(500);
	});	*/
	
	
	//InitTopNav();
}


// dom ready listener
//window.addEvent('domready', init);
$(document).ready(function()
{	
	setupClientDrop();
	InitTopNav();
});


