function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}



function loadHomeText() {
	var no = readCookie('text');
	//alert(no);
	no = Math.round(no);
	no = no+1;
	if (no > noArticles-1) no = 0;
	
	dynDiv = document.getElementById('homeDynText');
	dynDiv.innerHTML = articles[no];
	createCookie('text',no);
}

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));

var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1));
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_opera = (agt.indexOf("opera") != -1);
var is_opera4 = (is_opera && (is_major == 4));
var is_opera5 = (is_opera && (is_major == 5));
var is_opera5up = (is_opera && (is_major >= 5));

var is_domcom = ((is_nav6up)||(is_ie5up)||(is_opera5up))
var is_mac    = (agt.indexOf("mac")!=-1);
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1)));

var _timeout	= 500;

function getElementById(_id) {

	var _el;

	if(is_domcom) {
		_el	= document.getElementById(_id);
	} else if(is_ie4) {
		_el	= document.all[_id];
	}

	return _el;
}

function _showMenu(_objID) {
	var _obj	= getElementById(_objID);
	if(_obj) {
		_obj.style.display	= 'block';
	}
}

function _hideMenu(_objID) {
	var _obj	= getElementById(_objID);
	if(_obj) {
		_obj.style.display	= 'none';
	}
}

/*************************************************
 *	shows element with id passed as parameter
 *************************************************/
function doOver(_id) {

	var _el	= getElementById(_id);
	if(_el) {
		if(_el.timer) {
			clearTimeout(_el.timer);
		}
		 _showMenu(_id);
	}
}

/*************************************************
 *	hides element with id passed as parameter
 *************************************************/

var time

function doOut(_id) {

	var _el	= getElementById(_id);

	if(_el) {
		var _timer	= setTimeout("_hideMenu('" + _id + "')", _timeout);
		_el.timer	= _timer;
	}
}

function checkContactForm() {
	if (document.getElementById('name').value == "") {
		alert ("Please fill in your name!");
		return false;
	}
	else if (!isValidEmail(document.getElementById('email').value)) {
		alert("Please fill in your e-mail!");
		document.getElementById('email').focus();
		return false;
	}
	else if (document.getElementById('comments').value == "") {
		alert ("Please fill in your comment/question!");
		return false;
	}
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}