function byid(id){
		return document.getElementById(id);
	}
	function NSS_getPageSize() {
		var xScroll, yScroll;		
		if (window.innerHeight && window.scrollMaxY) {
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else {
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}
		if(xScroll < windowWidth){
			pageWidth = xScroll;
		} else {
			pageWidth = windowWidth;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
		return arrayPageSize;
	}
	
	function NSS_getPageScroll() {
		var xScroll, yScroll;
		if (self.pageYOffset) {
			yScroll = self.pageYOffset;
			xScroll = self.pageXOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {	
			yScroll = document.documentElement.scrollTop;
			xScroll = document.documentElement.scrollLeft;
		} else if (document.body) {
			yScroll = document.body.scrollTop;
			xScroll = document.body.scrollLeft;
		}
		arrayPageScroll = new Array(xScroll,yScroll)
		return arrayPageScroll;
	}

	function alerta(mesaj,width,height) {
		NSS_win('alerta','',mesaj,width,height,true)
	}
	function close_alerta() {
		NSS_winClose('alerta');
	}
	
	function NSS_win(id,caption,mesaj,width,height,closebtn) {
		if (!byid('NSS_winover_'+id)) {
			var over_div=document.createElement('DIV');
			over_div.id='NSS_winover_'+id;
			over_div.className='NSS_winover';
			document.body.appendChild(over_div);
		}
		if (!byid('NSS_win_'+id)) {
			var alerta_div=document.createElement('DIV');
			alerta_div.id='NSS_win_'+id;
			alerta_div.className='NSS_win';
			document.body.appendChild(alerta_div);
		}
		if (width==null) width=360;
		if (height==null) height=200;
		var page_size=NSS_getPageSize();
		var over_div=byid('NSS_winover_'+id);
		var alerta_div=byid('NSS_win_'+id);
		over_div.style.display='block';
		over_div.style.width=page_size[0]+'px';
		over_div.style.height=page_size[1]+'px';
		over_div.NSS_win_id=id;
		over_div.onclick=function () {NSS_winClose(this.NSS_win_id);return false;};
		var page_scroll=NSS_getPageScroll();
		alerta_div.style.display='block';
		alerta_div.style.width=width+'px';
		alerta_div.style.left=(page_size[0]-width-20)/2+'px';
		var top_top=(page_size[3]-height)/2+page_scroll[1];
		if (top_top<1) top_top=1;
		alerta_div.style.top=top_top+'px';
		alerta_div.innerHTML=(caption?'<div class="NSS_win_caption" style="width:'+(width-60)+'px;"><span>'+caption+'</span></div>':'')+'<a class="NSS_win_close" href="#" onclick="NSS_winClose(\''+id+'\');return false;">x</a><div class="NSS_win_content" id="NSS_win_content_'+id+'" style="height:'+(height-30)+'px;">'+mesaj+'</div>';
	}
	function NSS_winClose(id) {
		var over_div=byid('NSS_winover_'+id);
		var alerta_div=byid('NSS_win_'+id);
		over_div.parentNode.removeChild(over_div);
		alerta_div.parentNode.removeChild(alerta_div);
	}