/* General module by Fredrik Schultz [ver$0.3 (2007-11-19)] */


// Browser identification

function Is() {
	var agent   = navigator.userAgent.toLowerCase();
	this.major  = parseInt(navigator.appVersion);
	this.minor  = parseFloat(navigator.appVersion);
	this.ns     = ((agent.indexOf('mozilla')   != -1) &&
								(agent.indexOf('spoofer')    == -1) &&
								(agent.indexOf('compatible') == -1) &&
								(agent.indexOf('opera')      == -1) &&
								(agent.indexOf('webtv')      == -1));
	this.ns4    = (this.ns && (this.major      ==  4));
	this.ns6    = (this.ns && (this.major      >=  5));
	this.ie     = (agent.indexOf("msie")       != -1);
	this.ie3    = (this.ie && (this.major      <   4));
	this.ie4  	= (this.ie && (this.major      >=  4));
	this.ie5    = (this.ie && (this.major      ==  4) &&
								(agent.indexOf("msie 5.0")   != -1));
	this.ieX    = (this.ie && !this.ie3 && !this.ie4);
}

var is = new Is();




//

function hideDiv(divID) {
	getElement(divID).style.display='none';
	return false;
}

function showDiv(divID) {
	getElement(divID).style.display='block';
	return false;
}





function getElement(myName) {
	try { 
		if(document.all[myName]) {
		  return document.all[myName];
		}
	} catch(e) {
		try {
			if(document.getElementById) {
			  return document.getElementById(myName); 
			}
		}
		catch(e) {}
	}
}

function getOffsetTop(obj) {
	var retval=0;
	if(obj.offsetParent) {
		while(obj.offsetParent) {
			retval+=obj.offsetTop;
			obj=obj.offsetParent;
		}
	}
	else if(obj.y) {
		retval=obj.y;
	}
	return retval;
}

function getOffsetLeft(obj) {
	var retval=0;
	if(obj.offsetParent) {
		while(obj.offsetParent) {
			retval+=obj.offsetLeft;
			obj=obj.offsetParent;
		}
	}
	else if(obj.x) {
		retval=obj.x;
	}
	return retval;
}

function isNotEmpty(myobj,txterr) {
	if(myobj.value.length==0) {
		alert(txterr);
		myobj.focus();
		return false;
	}
	return true;
}

function clearField(stext,sobj,foc) {
	if (sobj.value==stext && foc)
		sobj.value = "";
	if (sobj.value=="" && !foc)
		sobj.value = stext;		
}
