function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}



// -------------- BROWSER DETECTION


if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

// SCROLLING NEWS by frankiezafe.net
// limitations: only one scrolling on each page!!!

function cleanVar(x) { var tmp=x.toString(); if (tmp.indexOf('px')>-1) { tmp=tmp.substring(0,tmp.indexOf('px')); x=parseInt(tmp); } return x; }

var maskBox = new Array();
var scrollingBox = new Array();
var scrollingSetting = new Array();
	scrollingSetting.speed = -1;
	scrollingSetting.current = 0;
	scrollingSetting.active = false;

function InitScrolling(mask,scrol) {
	if (
		((browser = "Internet Explorer")&&(OS = "Windows"))||
		((browser = "Netscape Navigator")&&(OS = "Windows"))
		) {
		maskBox.id = mask; 
		scrollingBox.id = scrol;
		if (
			(document.getElementById(scrollingBox.id))&&
			(document.getElementById(maskBox.id))
			) {
			maskBox.obj = document.getElementById(maskBox.id);
			scrollingBox.obj = document.getElementById(scrollingBox.id);
			PrepareScrolling();
		}
		scrollingSetting.active = true;
	}
}

function PrepareScrolling() {
	maskBox.obj.style.position = 'relative';
	maskBox.h = cleanVar(scrollingBox.obj.offsetHeight);
	maskBox.obj.style.height = maskBox.h+'px';
	maskBox.obj.style.overflow = 'hidden';
	scrollingBox.obj.style.position = 'relative';
	scrollingBox.obj.style.top = '0px';
	scrollingBox.obj.innerHTML += scrollingBox.obj.innerHTML;
}

function switchScroll(val) {
	scrollingSetting.active = val;
}

function animateScrolling() {
	if (
		(document.getElementById(scrollingBox.id))&&
		(document.getElementById(maskBox.id)) &&
		(scrollingSetting.active)
		) {
		scrollingSetting.current +=scrollingSetting.speed;
		if (Math.abs(scrollingSetting.current)>Math.abs(maskBox.h)) { scrollingSetting.current = 0; }
		scrollingBox.obj.style.top = scrollingSetting.current+'px';
	}
}

window.setInterval('animateScrolling()',40);
