

function CreateXmlHttp()
{
	var result = null;
	//Creating object of XMLHTTP in IE
	try
	{
		result = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			result = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			result = null;
		}
	}
	
   //Creating object of XMLHTTP in Mozilla and Safari
 
	if (result == null || typeof XMLHttpRequest == "undefined")
		result = new XMLHttpRequest();
	
	return result;
}

var hdStatusField;
var xmlhttp;

function applyHDStatus() {
	if (xmlhttp.readyState == 4) {
		document.getElementById(hdStatusField).innerHTML = "Estimated response time: " + xmlhttp.responseText;
	}
}

function checkHDWaitTime(field) {
	hdStatusField = field;
	
	xmlhttp = CreateXmlHttp();
	if (xmlhttp == null)
		return;


	var url = "/cgi-bin/hdInfo.pl";

	xmlhttp.onreadystatechange = applyHDStatus;
	xmlhttp.open( "GET", url, true);
	xmlhttp.send( null );
}


var screenIndex = 0;
var baseImgSrc = "images/screen/";
var screenPics;
var doScroll = true;
var doneAutoInit = false;

function scrollScreen(right,wrap) {
	if (!wrap)
		doScroll = false; // is manual so stop auto

	if (right) {
		if (screenIndex >= screenPics.length - 1) {
			if (!wrap)
				return;
			screenIndex = -1;
		}

		screenIndex++;
		if (screenIndex >= screenPics.length - 1)
			document.getElementById("goRight").style.visibility = "hidden";
		else document.getElementById("goRight").style.visibility = "visible";

		document.getElementById("goLeft").style.visibility = "visible";
	}
	else {
		if (screenIndex <= 0)
			return;

		screenIndex--;
		if (screenIndex == 0)
			document.getElementById("goLeft").style.visibility = "hidden";
		else document.getElementById("goLeft").style.visibility = "visible";

		document.getElementById("goRight").style.visibility = "visible";
	}
	document.getElementById('screenPic').src = baseImgSrc + screenPics[screenIndex];
}

function autoscrollScreen() {
	if (doScroll)
		scrollScreen( true, true );
}

function startScreenScolling(imgs) {
	screenPics = imgs;

	setInterval( 'autoscrollScreen()', 3000 );
}

function writeTXButton(lang) {
	var pageURL = encodeURIComponent(document.URL);

	document.write( "<a href=\"http://translate.google.com/translate?js=n&amp;prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=" + pageURL + "&amp;sl=en&amp;tl=" + lang + "&amp;history_state0=\">" );
	document.write( "<img src=\"/images/icon/flag_" + lang + ".png\" border=\"0\"></a>" );
}

function showTX() {

	writeTXButton( 'de' );
	writeTXButton( 'es' );
	writeTXButton( 'fr' );
	writeTXButton( 'it' );
	writeTXButton( 'ja' );
	writeTXButton( 'zh-CN' );
}


var digg_url;
function showLinks() {
	digg_url = document.URL;
	digg_window = 'new';


	document.write( "<center>" );
	document.write( "<table><tr><td>" );
	document.write( "<script src=\"http://digg.com/tools/diggthis.js\" type=\"text/javascript\"></script>" );

	document.write( "</td><td style=\"width: 20px;\">" );
	document.write( "</td><td style=\"text-align: center;\">" );

	document.write( "<a href=\"http://delicious.com/save\" onclick=\"window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;\"><img src=\"http://static.delicious.com/img/delicious.small.gif\" height=\"30\" width=\"30\" alt=\"Delicious\" border=\"0\" target=\"_blank\"/><br>del.icio.us</a>" );

	document.write( "</td><td style=\"width: 20px;\">" );
	document.write( "</td><td style=\"text-align: center;\">" );

	document.write( "<a href=\"http://www.stumbleupon.com/submit?url=" + encodeURIComponent(document.URL) + "&amp;title=" + encodeURIComponent(document.title) + "\" target=\"_blank\"><img border=0 src=\"http://cdn.stumble-upon.com/images/32x32_su_solid.gif\" alt=\"StumbleUpon\" border=\"0\"><br>StumbleUpon</a>" );
	document.write( "</td></tr></table>" );

	document.write( "</center>" );
}
