//id = window.setTimeout("fade()", 100);
//id = window.setTimeout("scr()", 100);

function fade()
{
	if ((document.body.style.opacity == 0.00) || (document.body.style.opacity == "") && (navigator.appName != "Microsoft Internet Explorer"))
	{
		document.body.style.opacity="0.00";
		id = window.setTimeout("fade_body()", 100);
	}
}


function fade_body()
{
	if(navigator.appName != "Microsoft Internet Explorer")
	{
		if(document.body.style.opacity=="")
		{
			document.body.style.opacity="0.00";
		}
		var ps = document.body.style.opacity;
		ps = parseFloat(ps);
		if (ps <= 0.99)
		{
			ps = ps + 0.03;
			document.body.style.opacity=ps;
			id = window.setTimeout("fade_body()", 10);
		}
		else
		{
			document.body.style.opacity="1.00";
		}
	}
}


function scr()
{
	if (document.getElementById("scroll"))
	{
		document.getElementById("scroll").style.cursor='pointer';
		document.getElementById("scroll").onclick = function(){scrolltop();};
		if (navigator.appName != "Microsoft Internet Explorer")
		{
			document.getElementById("scroll").style.opacity='0.20';
			document.getElementById("scroll").onmouseover = function(){document.getElementById("scroll").style.opacity="0.20"; hbutton();};
			document.getElementById("scroll").onmouseout = function(){document.getElementById("scroll").style.opacity="1.00"; obutton();clearTimeout(hid);};
		}
		if(navigator.userAgent.indexOf("Safari") <= 0)
		{
			show_button();
		}
	}
}


function show_button()
{
	if(navigator.userAgent.indexOf("Safari") <= 0)
	{
		if (document.documentElement.scrollTop <= 0)
		{
			document.getElementById("scroll").style.display="none";
		}
		else
		{
			document.getElementById("scroll").style.display="inline-block";
		}
		id = window.setTimeout("show_button()", 100);
	}
}


function hbutton()
{
	var ops = document.getElementById("scroll").style.opacity;
	ops = parseFloat(ops);
	if (ops <= 0.99)
	{
		ops = ops + 0.06;
		document.getElementById("scroll").style.opacity = ops;
		hid = window.setTimeout("hbutton()", 10);
	}
	else
	{
		document.getElementById("scroll").style.opacity = "1.00";
	}
}


function obutton()
{
	var ops = document.getElementById("scroll").style.opacity;
	ops = parseFloat(ops);
	if (ops >= 0.20)
	{
		ops = ops - 0.06;
		document.getElementById("scroll").style.opacity = ops;
		oid = window.setTimeout("obutton()", 10);
	}
	else
	{
		document.getElementById("scroll").style.opacity = "0.20";
	}
}


function scrolltop()
{
	if(navigator.userAgent.indexOf("Safari") > 0)
	{
		scroll(0,0);
	}
	else
	{
		left();
	}
}


function left()
{
	var lpos = document.documentElement.scrollLeft;
	lpos = parseInt(lpos);
	if (lpos > 0)
	{
		lpos = lpos - (lpos/10);
		if (lpos < 1)
		{
			lpos=0;
		}
		document.documentElement.scrollLeft = lpos;
		id = window.setTimeout("left()", 1);
	}
	else
	{
		lpos = 0;
		document.documentElement.scrollLeft = lpos;
		id = window.setTimeout("up()", 1);
	}
}


function up()
{
	var pos = document.documentElement.scrollTop;
	pos = parseInt(pos);
	if (pos > 0)
	{
		pos = pos - (pos/20);
		if (pos < 1)
		{
			pos=0;			
		}
		document.documentElement.scrollTop = pos;
		id = window.setTimeout("up()", 1);
	}
}




function c(box)
{
	box.value="";
	box.style.color="#333333";
}
function t(box)
{
	box.style.color="#c5c5c5";
}

function hv(p)
{
	p.src="images/go-button2.png";
}

function ot(p)
{
	p.src="images/go-button.png";
}

function dn(p)
{
	p.src="images/go-button3.png";
}

function dnp(p)
{
	p.src="images/go-button2.png";
}


function hv2(p)
{
	p.src="images/leftgo2.png";
}

function ot2(p)
{
	p.src="images/leftgo.png";
}

function dn2(p)
{
	p.src="images/leftgo3.png";
}

function dnp2(p)
{
	p.src="images/leftgo2.png";
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

// Tooltips:
function showit() {
	if(drag) {
		if (document.documentElement) {
			var X = event.clientX + document.documentElement.scrollLeft;
			var Y = event.clientY + document.documentElement.scrollTop;
		} else {
			if (document.body) {
				var X = event.clientX + document.body.scrollLeft;
				var Y = event.clientY + document.body.scrollTop;
			} else {
				var X = event.clientX;
				var Y = event.clientY;
			}
		}
		var obj = document.getElementById('tip');
		obj.style.left = X + 10 + "px";
		obj.style.top = Y + 10 + "px";
		if (obj.style.display != 'block') {
			obj.style.display='block';
		}
	}
}

function showitMOZ(e) {
	if(drag) {
		var obj = document.getElementById('tip');
		obj.style.left = e.pageX + 10 + "px";
		obj.style.top = e.pageY  + 10 + "px";
		if (obj.style.display != 'block') {
			obj.style.display='block';
		}
	}
}

function tagTip(text) {
	var obj = document.getElementById('tip');
	obj.innerHTML = text;
	drag = true;
	if (!document.all) {
	  window.onmousemove=showitMOZ;
	} else {
	  document.onmousemove=showit;
	}
}

function unTip() {
  document.getElementById('tip').style.display='none';
  drag = false;
}
