var activeHomePanel = "redPanel";

function showTabPanel(selectedPanel)
{
	if((document.getElementById(activeHomePanel) != null)&&
	  (newPanel = document.getElementById(selectedPanel) != null)&&
	  (activeHomePanel != selectedPanel))
	  {	
		$('#' + activeHomePanel).hide();
		$('#' + selectedPanel).show();
		activeHomePanel = selectedPanel;
	  }
}

function splashScreenSwitch() 
{
    var $active = $('#splashScreen IMG.active');

    if ( $active.length == 0 ) $active = $('#splashScreen IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#splashScreen IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 3000, function() {
            $active.removeClass('active last-active');
        });
} 

/*function slideSwitch() 
{
	var $active = $('.activeScreen');

    if ( $active.length == 0 ) $active = $('#splashScreen .slideShowScreen:last');

    var $next =  $active.next().length ? $active.next()
        : $('#splashScreen .slideShowScreen:first');

    $active.addClass('lastActiveScreen');

    $next.css({opacity: 0.0})
        .addClass('activeScreen')
        .animate({opacity: 1.0}, 3000, function() {
            $active.removeClass('activeScreen lastActiveScreen');
        });
	
}*/

$(function() 
{
	setInterval( "splashScreenSwitch()", 10000 );
});


function showContactUsForm()
{
	$('#contactUsTint').show();
	$('#contactUsForm').show('drop');
}

function hideContactUsForm()
{	
	$('#contactUsForm').hide('drop');
	$('#contactUsTint').hide();
}

function showSupportTicketForm()
{
	$('#supportTicketTint').show();
	$('#supportTicketForm').show('drop');
}

function hideSupportTicketForm()
{	
	$('#supportTicketForm').hide('drop');
	$('#supportTicketTint').hide();
}

var currentDropDown;
function showMenu(x)
{
	if(currentDropDown && currentDropDown != x){
		$("#" + currentDropDown).slideUp("slow");
	}
	if ($("#" + x).is(":hidden")){
		currentDropDown = x;
		$("#" + x).slideDown("slow",function(){if ($.browser.msie){this.style.removeAttribute('filter');}});
	}
}
function hideMenu(){
	$("#" + currentDropDown).slideUp("slow");
}
function hideMenu2(e){

	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	
	var str = '<' + tg.tagName + ' id="' + tg.id + '" class="' + tg.className + '" />  ' + '<' + reltg.tagName + ' id="' + reltg.id + '" class="' + reltg.className + '" />';
	
	if(reltg.id == 'productDropDown' || reltg.id == 'servicesDropDown')
	{		
		return;
	}
	
	if(reltg != null)
	{
		while (reltg && reltg != tg && reltg.tagName != 'BODY')
		{	
			reltg = reltg.parentNode;
			if(reltg)
			{
				if (reltg == tg || reltg.id == 'menuBar' ||  reltg.id == 'productDropDown' || reltg.id == 'servicesDropDown' || (reltg.className && reltg.className.match('autoPad')))
				{				
					return;
				}
			}
		}
		
	}
	else
	{
		return;
	}
	hideMenu();
	return false;

}
