/* written by Gabrijel Gavranovic
   Gavro, 2007

   based on code by gene cutler and from apple.com, oreilly.com
*/

var set1 = new Array(	"Application Courses","Consultancy","Design","Scripting","Automation",
			"Networking","Webdevelopment","Volume Hosting","Software Engineering","Programming Courses",
			"Development Support","Specialized Hosting");
var w;
var h;
var txt1;
var gecko;

function set_up() {
	w = window_width() - 80;
	h = window_height() - 80;
	var i;

	//var num_from_1 = Math.floor(2*Math.random()) + 1;
	var num_from_1 = set1.length;
	txt1 = new Array(num_from_1);
	for (i=0; i < num_from_1; ++i) { txt1[i] = set1[Math.floor(set1.length*Math.random())]; }

	var agt = navigator.userAgent.toLowerCase();
	if (agt.indexOf('gecko' != -1) && agt.indexOf('like gecko') == -1)
		gecko = 1;
	else
		gecko = 0;
}

function bubble() {
	var div_name;
	var s;
	var i;
	var x;

	for (i=0; i < txt1.length; ++i) {
		div_name = "div_" + (i+1);
		s = getStyleObject(div_name);
		s.top = Math.round(h*Math.random()) + "px";
		s.left = Math.round(w*Math.random()) + "px";
		if (gecko == 0)	s.zIndex=-1;
		else s.zIndex=3;
		if (Math.round(Math.random()+1) == 1)
			document.getElementById(div_name).innerHTML = set1[i];
		else
			document.getElementById(div_name).innerHTML = "";
	}

	s = getStyleObject("stuff");
	s.zIndex=10;
	setTimeout("bubble()",10000);
}

function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        return document.layers[objectId];
    }
	return false;
}

function window_width() {
	if (typeof( window.innerWidth ) == 'number') {
		return window.innerWidth;
	} else if( document.documentElement && document.documentElement.clientWidth ) {
		return document.documentElement.clientWidth;
    } else if( document.body && document.body.clientWidth) {
		return document.body.clientWidth;
	} else {
		return 800;
    }
}

function window_height() {
	if (typeof( window.innerHeight ) == 'number') {
		return window.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		return document.documentElement.clientHeight;
    } else if( document.body && document.body.clientHeight) {
		return document.body.clientHeight;
	} else {
		return 500;
    }
}

function pauseOnClick() {
	document.body.onclick= "";
	setTimeout("document.body.onclick = \"bubble()\"",1000);
}

var last_txt;
function switch_txt(t1,t2) {
	if (last_txt == t2) {
		document.laundromat.src = t1;
		last_txt = t1;
	} else {
		document.laundromat.src = t2;
		last_txt = t2;
	}
}