function slideSwitch()
{
	var $active = $('#slideshow a.active');

	if ( $active.length == 0 ) $active = $('#slideshow a:last');

	var $next =  $active.next().length ? $active.next() : $('#slideshow a:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1600, function() {
			$active.removeClass('active last-active');
		});
}

function get_top_message()
{
	$.ajax({type: 'GET',
		url: '/cgi-bin/top_message.cgi',
		dataType: 'json',
		cache: false,
		async: true,
		success: function(json, status) {
			$('#Message1').html(json.Message1);
			$('#Message2').html(json.Message2);
			$('#Message3').html(json.Message3);
			$('#News').html(json.News);
			$('#slideshow').html(json.Slide);
		},
		error: function() {
			$('#Message1').html('');
			$('#Message2').html('');
			$('#Message3').html('');
			$('#News').html('');
			$('#slideshow').html('');
		}
	});
}

function get_top_message_s()
{
	$.ajax({type: 'GET',
		url: '/cgi-bin/top_message.cgi?mode=short',
		dataType: 'json',
		cache: false,
		async: true,
		success: function(json, status) {
			$('#Message1').html(json.Message1);
			$('#Message2').html(json.Message2);
			$('#Message3').html(json.Message3);
			$('#News').html(json.News);
			$('#slideshow').html(json.Slide);
		},
		error: function() {
			$('#Message1').html('');
			$('#Message2').html('');
			$('#Message3').html('');
			$('#News').html('');
			$('#slideshow').html('');
		}
	});
}

function get_top_message_n(id)
{
	var msg_id = "#Message" + id;

	$.ajax({type: 'GET',
		url: '/cgi-bin/top_message.cgi?mode=ids&id=' + id,
		dataType: 'json',
		cache: false,
		async: true,
		success: function(json, status) {
			$(msg_id).html(json.Message);
		}
	});
}

function get_solutions()
{
	$("#Solution1").load("/solutions/solution1.htm .SolutionMainColumn", function(){ $('#sol1').hide(); });
	$("#Solution2").load("/solutions/solution2.htm .SolutionMainColumn", function(){ $('#sol2').hide(); });
	$("#Solution3").load("/solutions/solution3.htm .SolutionMainColumn", function(){ $('#sol3').hide(); });
	$("#Solution4").load("/solutions/solution4.htm .SolutionMainColumn", function(){ $('#sol4').hide(); });
	$("#Solution5").load("/solutions/solution5.htm .SolutionMainColumn", function(){ $('#sol5').hide(); });
	$("#Solution6").load("/solutions/solution6.htm .SolutionMainColumn", function(){ $('#sol6').hide(); });
}

function toggle_id(id)
{
	var aid = "#" + id;
	$(aid).toggle();
	return false;
}

function contact_us(mode, puroduct)
{
	product = encodeURI(puroduct);
	location.href = '/contact/contact.html?mode=' + mode + '&product=' + product;
	return false;
}

