	// Author:  ws123.net  Sergey V Musenko  info@ws123.net

	// check is string empty
	function isEmpty(s) {
		var filter=/[^\s]+/;
		return !filter.test(s);
	}
	function tmp() {
	  l=s.length;
	  if(!l)return true;
	  for(i=0;i<l;i++) {c=s.charAt(i);if(c!=" "&&c!="\r"&&c!="\n"&&c!="\t") return false;}
	  return true;
	}
	// alltrim
	function trim(v) {
		var l,s,d;
		l=v.length;
		while(l>0&&(v.charAt(l-1)==' '||v.charAt(l-1)=='\n'||v.charAt(l-1)=='\t'))l--;
		s=0;
		while(s<l&&(v.charAt(l-1)==' '||v.charAt(l-1)=='\n'||v.charAt(l-1)=='\t'))s++;
		d='';
		for(i=s;i<l;i++) d+=v.charAt(i);
		return d;
	}
	// check email
	function checkMail(s) {
		var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		return filter.test(s);
	}
	// cross-browser cancelBubble=true;
	function stopBubble(o) {
		if(self.event) self.event.cancelBubble=true; // stopPropagation()
	}

	// screen resolution
	var swidth=0;
	var sheight=0;
	if(self.screen) {     // for NN4 and IE4
		swidth = screen.width
		sheight = screen.height
	} else if(self.java) {   // for NN3 with enabled Java
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize();       
		swidth = scrsize.width; 
		sheight = scrsize.height; 
	}

	// This is for Mozilla/FireFox events model:
	// cancelBubble will not work; so deny it for all links!
	function MozStopEvent(ev) { ev.stopPropagation();	}
	function InitMozStopEvent() { // call it from <body onLoad=''>
		if(!self.event && document.links && document.links.length) {
			for(i=0;i<document.links.length;i++) document.links[i].addEventListener("click",MozStopEvent,false);
		}
	}
	function mark(o,m) { // Mozilla and IE need this
		if(self.event && navigator.userAgent.indexOf("MSIE")<0) return;
		if(m>0)	o.style.backgroundColor="#ffffff";
		else	o.style.backgroundColor="#eeeeee";
	}
