if (!LNSwd) {
	var LNSwd = {};
}

var LNSwdIntervalo = '';
var LNSwdImageCarga = '';
LNSwd.Dialogo = function () {};

LNSwd.Dialogo.VERSION = '1.00';
LNSwd.Dialogo.EXPORT = ['alert', 'confirm', 'prompt', 'ajax', 'ajaxX', 'ajaxImg', 'close', 'scroll', 'resize'];

LNSwd.Dialogo.alert = function (msg, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.alert(msg, options);
};

LNSwd.Dialogo.confirm = function (msg, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.confirm(msg, options);
};

LNSwd.Dialogo.prompt = function(msg, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.prompt(msg, options);
};

LNSwd.Dialogo.ajax = function(msg, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.ajax(msg, options);
};

LNSwd.Dialogo.ajaxX = function(msg, title, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.ajaxX(msg, title, options);
};

LNSwd.Dialogo.ajaxImg = function(msg, title, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.ajaxImg(msg, title, options);
};

LNSwd.Dialogo.close = function(msg, options) {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.close();
};

LNSwd.Dialogo.scroll = function() {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.scroll();
};

LNSwd.Dialogo.resize = function() {
	var Dialogo = new LNSwd.Dialogo();
	return Dialogo.resize();
};

LNSwd.Dialogo.prototype = {
	_options: {
		'height'			: 70,
		'theight'			: 20,
		'bheight'			: 26,
		'Xheight'			: 30,
		'maxheight'			: 0,
		'width' 			: 300,
		'padding' 		: 1,
		'bpadding' 		: 2,
		'cpadding' 		: 2,
		'labelClose'		 : 'Cerrar',
		'labelOk' 		: 'Aceptar',
		'labelCancel' : 'Cancelar',
		'onClose' 			 : function() {
			LNSwd.Dialogo.close();
		},
		'onOk'				: function() {
			LNSwd.Dialogo.close();
		},
		'onCancel'		: function() {
			LNSwd.Dialogo.close();
		}
	},

	_pgzise: {
			'pageWidth':0,
			'pageHeight':0,
			'windowWidth':0,
			'windowHeight':0,
			'yScroll':0,
			'xScroll':0
		},

	init: function() {
		this._pgzise=this._getPageSize();
		this.addOverlay();
		this._options.height=70;
		this._options.theight=24;
		this._options.bheight=26;
		this._options.Xheight=30;
		this._options.maxheight=0;
		this._options.width=300;
		this._options.padding=1;
		this._options.bpadding=2;
		this._options.cpadding=2;
		this._options.labelClose='Cerrar';
		this._options.labelOk='Aceptar';
		this._options.labelCancel='Cancelar';
		this._options.onClose= function() {LNSwd.Dialogo.close();};
		this._options.onOk= function() {LNSwd.Dialogo.close();};
		this._options.onCancel= function() {LNSwd.Dialogo.close();};
	},

	alert: function(msg, options) {
		this.init();
		var opt = this._options;
		opt.height = 120;
		opt.width = 300;
		opt.padding = 2;
		opt.bheight = 26;
		var options = this._extend(this._options, options || {});

		var dwindow = this.getWindow(options.height, options.width, options.padding);
		var dtitle = this.maketitle('Aviso',options.theight,true);
		var miancho=options.width-(options.cpadding*2);
		var mialto= options.height-(options.cpadding*2)-options.theight;
		var msgancho=miancho-(options.cpadding*2);
		var btancho=miancho-(options.bpadding*2);
		var btalto=options.bheight-(options.bpadding*2);
		var msgalto=mialto-options.bheight-(options.cpadding*2);
		dwindow.appendChild(dtitle);
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.className = 'msgboxclassd';
		dmsg.style.width = miancho +'px';
		dmsg.style.height = mialto +'px';
		dmsg.style.margin = options.cpadding+'px';
		dmsg.style.overflow ='hidden';

		var dmsgttx = document.createElement('div');
		dmsgttx.id = 'LNSwddmsgtxt';
		dmsgttx.className = 'msgboxclassd';
		dmsgttx.style.width =  msgancho+'px';
		dmsgttx.style.height = msgalto+'px';
		dmsgttx.style.padding = options.cpadding+'px';
		dmsgttx.style.overflow ='auto';
		dmsgttx.innerHTML = msg;
		dmsg.appendChild(dmsgttx);

		var dbuttons = document.createElement('div');
		dbuttons.id = 'LNSwddbuttons';
		dbuttons.className = 'msgboxclassd';
		dbuttons.style.height = btalto+'px';
		dbuttons.style.margin = options.bpadding+'px';

		var dbuttonOk = document.createElement('button');
		dbuttonOk.className = 'msgboxboton';
		dbuttonOk.appendChild(document.createTextNode(options.labelOk));
		dbuttonOk.onclick = options.onOk;
		dbuttons.appendChild(dbuttonOk);

		dmsg.appendChild(dbuttons);
		
		dwindow.appendChild(dmsg);

		document.body.appendChild(dwindow);
		this.pause(30);
		dbuttonOk.focus();
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	confirm: function(msg, options) {
		this.init();
		var opt = this._options;
		opt.height = 120;
		opt.width = 300;
		opt.padding = 2;
		opt.bheight = 26;
		var options = this._extend(this._options, options || {});
		var dwindow = this.getWindow(options.height, options.width, options.padding);
		var dtitle = this.maketitle('Consulta',options.theight,true);

		var miancho=options.width-(options.cpadding*2);
		var mialto= options.height-(options.cpadding*2)-options.theight;
		var msgancho=miancho-(options.cpadding*2);
		var btancho=miancho-(options.bpadding*2);
		var btalto=options.bheight-(options.bpadding*2);
		var msgalto=mialto-options.bheight-(options.cpadding*2);
				
		dwindow.appendChild(dtitle);
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.className = 'msgboxclassd';
		dmsg.style.width = miancho +'px';
		dmsg.style.height = mialto +'px';
		dmsg.style.margin = options.cpadding+'px';
		dmsg.style.overflow ='hidden';

		var dmsgttx = document.createElement('div');
		dmsgttx.id = 'LNSwddmsgtxt';
		dmsgttx.className = 'msgboxclassd';
		dmsgttx.style.width =  msgancho+'px';
		dmsgttx.style.height = msgalto+'px';
		dmsgttx.style.padding = options.cpadding+'px';
		dmsgttx.style.overflow ='auto';
		dmsgttx.innerHTML = msg;
		dmsg.appendChild(dmsgttx);

		var dbuttons = document.createElement('div');
		dbuttons.id = 'LNSwddbuttons';
		dbuttons.className = 'msgboxclassd';
		dbuttons.style.height = btalto+'px';
		dbuttons.style.margin = options.bpadding+'px';

		var dbuttonOk = document.createElement('button');
		dbuttonOk.className = 'msgboxboton';
		dbuttonOk.appendChild(document.createTextNode(options.labelOk));
		dbuttonOk.onclick = options.onOk;
		dbuttons.appendChild(dbuttonOk);

		var dbuttonCancel = document.createElement('button');
		dbuttonCancel.className = 'msgboxboton';
		dbuttonCancel.appendChild(document.createTextNode(options.labelCancel));
		dbuttonCancel.style.marginLeft = '10px';
		dbuttonCancel.onclick = options.onCancel;
		dbuttons.appendChild(dbuttonCancel);

		dmsg.appendChild(dbuttons);
		dwindow.appendChild(dmsg);
		document.body.appendChild(dwindow);
		dbuttonOk.focus();
		this.pause(30);
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	prompt: function(msg, options) {
		this.init();
		var opt = this._options;
		opt.height = 150;
		opt.width = 300;
		opt.padding = 2;
		opt.bheight = 26;
		var options = this._extend(opt, options || {});

		var dwindow = this.getWindow(options.height, options.width, options.padding);

		var dtitle = this.maketitle('Pedido',options.theight,true);
		dwindow.appendChild(dtitle);
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.className = 'msgboxclassd';
		dmsg.style.height = (options.height-options.padding-(options.cpadding*2)-options.theight-options.bheight-(options.bpadding*2)) +'px';
		dmsg.style.padding = options.cpadding+'px';
		dmsg.innerHTML = msg;
		dwindow.appendChild(dmsg);


		var ddinput = document.createElement('div');
		ddinput.id = 'LNSwdddinput';
		ddinput.className = 'msgboxclassd';
		ddinput.style.height = '26px';
		ddinput.style.padding = '2px';

		var dinput = document.createElement('input');
		dinput.id = 'LNSwddinput';
		dinput.className = 'msgboxinput';
		dinput.style.width = '260px';
		dinput.setAttribute('type', 'text');
		ddinput.appendChild(dinput);
		dwindow.appendChild(ddinput);

		var dbuttons = document.createElement('div');
		dbuttons.id = 'LNSwddbuttons';
		dbuttons.className = 'msgboxclassd';
		dbuttons.style.height = options.bheight+'px';
		dbuttons.style.padding = options.bpadding+'px';

		var dbuttonOk = document.createElement('button');
		dbuttonOk.className = 'msgboxboton';
		dbuttonOk.appendChild(document.createTextNode(options.labelOk));
		dbuttonOk.onclick = function() {
			options.onOk(dinput.value);
		};
		dbuttons.appendChild(dbuttonOk);

		var dbuttonCancel = document.createElement('button');
		dbuttonCancel.className = 'msgboxboton';
		dbuttonCancel.appendChild(document.createTextNode(options.labelCancel));
		dbuttonCancel.style.marginLeft = '10px';
		dbuttonCancel.onclick = options.onCancel;
		dbuttons.appendChild(dbuttonCancel);

		dwindow.appendChild(dbuttons);
		document.body.appendChild(dwindow);
		this.pause(30);
		dinput.focus();
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	ajax: function(msg, options) {
		this.init();
		var opt = this._options;
		opt.height = 110;
		opt.width = 300;
		opt.bheight = 42;
		opt.padding = 2;
		var options = this._extend(this._options, options || {});
		var dwindow = this.getWindow(options.height, options.width, options.padding);
		var dtitle = this.maketitle('Conectando con el Servidor',options.theight,false);
		dwindow.appendChild(dtitle);
		var miancho=options.width-(options.cpadding*2);
		var mialto= options.height-(options.cpadding*2)-options.theight;
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.className = 'msgboxclassd';
		dmsg.style.width = miancho +'px';
		dmsg.style.height = mialto +'px';
		dmsg.style.margin = options.cpadding+'px';

		var dmsgttx = document.createElement('div');
		dmsgttx.id = 'LNSwddmsgtxt';
		dmsgttx.className = 'msgboxclassd';
		dmsgttx.style.width =  miancho-(options.cpadding*2)+'px';
		dmsgttx.style.height = (mialto-(options.cpadding*2)-options.bheight-(options.bpadding*2)) +'px';
		dmsgttx.style.padding = options.cpadding+'px';
		dmsgttx.innerHTML = msg;
		dmsg.appendChild(dmsgttx);

		var dbuttons = document.createElement('div');
		dbuttons.id = 'LNSwddbuttons';
		dbuttons.className = 'msgboxclassd';
		dbuttons.style.height = (options.bheight-(options.bpadding*2))+'px';
		dbuttons.style.padding = options.bpadding+'px';
/*
		var dbuttonOk = document.createElement('img');
		dbuttonOk.src=LNSAjaxImg;
		dbuttons.appendChild(dbuttonOk);
*/
	  dbuttons.innerHTML = '<img src="'+LNSAjaxImg+'" alt="" />';/*'X';*/
		dmsg.appendChild(dbuttons);

		dwindow.appendChild(dmsg);

		document.body.appendChild(dwindow);
		this.pause(30);
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	ajaxX: function(msg, title, options) {
		this.init();
		var pageSize = this._pgzise;
		var opt = this._options;
		opt.height = pageSize.windowHeight-opt.Xheight;
		opt.width = 880;
		opt.padding = 2;

		opt = this._extend(opt, options || {});
		var mialto=opt.height;
		if (opt.maxheight>0) {
				mialto= (opt.height>opt.maxheight) ? opt.maxheight : opt.height;
		}

		var dwindow = this.getWindow(mialto, opt.width, opt.padding);

		var dtitle = this.maketitle(title,opt.theight,true);
		dwindow.appendChild(dtitle);
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.style.padding = '0px';
		dmsg.style.border = '0px';
		dmsg.style.margin = opt.padding+'px';
		dmsg.style.background= '#fff';
		dmsg.style.width = (opt.width-(opt.padding*2))+'px';
		dmsg.style.height = (mialto-opt.theight-(opt.padding*2))+'px';
		dmsg.style.overflow='hidden';
		var tempIFrame=document.createElement('iframe');
		tempIFrame.setAttribute('id','LNSwdlinfo');
		tempIFrame.style.borderWidth='0px';
		tempIFrame.style.borderStyle='none';
		tempIFrame.style.width='100%';
		tempIFrame.style.height='100%';
		tempIFrame.style.overflow='auto';
	  tempIFrame.scrolling='yes';
		tempIFrame.frameBorder = '0';
		dmsg.appendChild(tempIFrame);
		dwindow.appendChild(dmsg);
		document.body.appendChild(dwindow);
		this.pause(30);
  	document.getElementById('LNSwdlinfo').src=msg;
		this.pause(30);
		document.getElementById('LNSwdlinfo').scrolling='yes';
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	ajaxImg: function(msg, title, options) {
		this.init();
		var pageSize = this._pgzise;
		var opt = this._options;
		opt.maxheight=pageSize.windowHeight-opt.Xheight;
		opt.height = pageSize.windowHeight-opt.Xheight;
		opt.width = 880;
		opt.padding = 2;

		opt = this._extend(opt, options || {});
		var mialto=opt.height+opt.theight+(opt.padding*2);
		var miancho=opt.width+(opt.padding*2);
		var mioverflow='hidden';
		if (mialto>opt.maxheight) {
				mialto= opt.maxheight;
				opt.height= mialto-opt.theight-(opt.padding*2);
				var sw=this._getScrollerWidth();
				miancho+=sw;
				opt.width+=sw;
				if (miancho>pageSize.pageWidth) {
					miancho=pageSize.pageWidth-sw-10;
					opt.width=miancho-(opt.padding*2);
				}
				mioverflow='auto';
		}
		var dwindow = this.getWindow(mialto, miancho, opt.padding);
		var dtitle = this.maketitle(title,opt.theight,true);
		dwindow.appendChild(dtitle);
		var dmsg = document.createElement('div');
		dmsg.id = 'LNSwddmsg';
		dmsg.style.padding = '0px';
		dmsg.style.border = '0px';
		dmsg.style.margin = opt.padding+'px';
		dmsg.style.background= '#fff';
		dmsg.style.width = (miancho-(opt.padding*2))+'px';
		dmsg.style.height = (mialto-opt.theight-(opt.padding*2))+'px';
		dmsg.style.overflow='hidden';

		var dmsgttx = document.createElement('div');
		dmsgttx.id = 'LNSwddmsgImg';
		dmsgttx.className = 'msgimgclassd';
		dmsgttx.style.width =  opt.width+'px';
		dmsgttx.style.height = opt.height +'px';
		dmsgttx.style.padding = '0px';
		dmsgttx.style.margin = '0px';
		dmsgttx.innerHTML = 'Cargando...';//'<img src="'+msg+'" alt="" title="Click para cerrar" />';
		dmsgttx.onclick = this._options.onClose;
		dmsgttx.style.overflow=mioverflow;
		dmsg.appendChild(dmsgttx);

		dwindow.appendChild(dmsg);
		document.body.appendChild(dwindow);
		LNSwdImageCarga=msg;
		var imgPreloader = new Image();
		imgPreloader.onload=function(){
			document.getElementById('LNSwddmsgImg').innerHTML = '<img src="'+LNSwdImageCarga+'" alt="" title="Click para cerrar" />';;
    	imgPreloader.onload=function(){};
    	return false;
		};
		imgPreloader.src = LNSwdImageCarga;
		this.pause(30);
		this.pause(60);
		LNSwdIntervalo=window.setInterval('LNSwd.Dialogo.scroll()', 10);
		return this;
	},

	maketitle: function(title, alto, cierra) {
		var dtitle = document.createElement('div');
		dtitle.id = 'LNSwddtitle';
		dtitle.className = 'msgboxclasstitle';
		dtitle.style.height = alto+'px';
		dtitle.style.verticalAlign = 'middle';
		dtitle.style.lineHeight = alto+'px';
		dtitle.style.paddingLeft = '10px';
		if (cierra) {
		 var dbuttonCl = document.createElement('span');
 		 dbuttonCl.id = 'LNSwddtitleX';
 		 dbuttonCl.innerHTML = '<img src="'+LNSAjaxImgClose+'" alt="" />';/*'X';*/
		 dbuttonCl.title = this._options.labelClose;
		 dbuttonCl.onclick = this._options.onClose;
		 dtitle.appendChild(dbuttonCl);
		 if (navigator.appVersion.indexOf("MSIE")!=-1){ this.pause(350); } else { this.pause(50);}
		}
		dtitle.appendChild(document.createTextNode(title));
		return dtitle;
	},

	addOverlay: function() {
		var doverlay = document.createElement('div');
		doverlay.id = 'LNSwddoverlay';
		doverlay.className = 'msgboxoverlay';
		with(doverlay.style) {
			top = '0px';
			left = '0px';
			position = 'absolute';
		}
		var pageSize = this._pgzise;
		doverlay.style.height = ((pageSize.pageHeight>pageSize.windowHeight) ? pageSize.pageHeight : pageSize.windowHeight) +'px';
		doverlay.style.width = '100%';
		this._setOpacity(doverlay, 0.5);
		document.body.appendChild(doverlay);
		this.hideSelectBoxes();
	},

	removeOverlay: function() {
		document.body.removeChild(document.getElementById('LNSwddoverlay'));
		this.showSelectBoxes();
	},

	getWindow: function(height, width, padding) {
		document.body.style.padding = '0';
		var dwindow = document.createElement('div');
		dwindow.id = 'LNSwddwindow';
		dwindow.className = 'msgboxclass';
		var pageSize = this._pgzise;
		var pos = this._realOffset(document.body);
		dwindow.style.top = (parseInt(pageSize.windowHeight/2) - parseInt(height/2) + pos[1])+'px';
		if (pageSize.windowWidth<pageSize.pageWidth) {
			dwindow.style.left =(pageSize.windowWidth>width) ?	(((parseInt(pageSize.windowWidth-width)/2) + pos[0]))+'px' : '0px';
		} else {
			dwindow.style.left =(pageSize.pageWidth>width) ?	(((parseInt(pageSize.pageWidth-width)/2) + pos[0]))+'px' : '0px';
		}
		dwindow.style.height = height+'px';
		dwindow.style.width = width+'px';
		dwindow.style.border = '0px';
		dwindow.style.margin = '0px';
		dwindow.style.position = 'absolute';
		dwindow.style.padding = '0px';
		dwindow.style.textAlign = 'center';
		dwindow.style.overflow = 'hidden';
		return dwindow;
	},

	close: function() {
		if (LNSwdIntervalo!='') window.clearInterval(LNSwdIntervalo);
		LNSwdIntervalo='';
		this.removeOverlay();
		document.body.removeChild(document.getElementById('LNSwddwindow'));
		return this;
	},

	scroll: function() {
		var pageSize = this._getPageSize();
		var opt = this._options;
		var pos = this._realOffset(document.body);
		var xa=document.getElementById('LNSwddwindow');
		var mialto=parseInt(xa.style.height);
		xa.style.top = (parseInt(pageSize.windowHeight/2) - parseInt(mialto/2) + pos[1])+'px';
		return this;
	},

	resize: function() {
		if(document.getElementById('LNSwddwindow')) {
			var xa=document.getElementById('LNSwddwindow');
			var pageSize = this._getPageSize();
			var opt = this._options;
			var pos = this._realOffset(document.body);
			opt.height = pageSize.windowHeight-opt.Xheight;
			var mialto=opt.height;
			if (opt.maxheight>0) {
				mialto= (opt.height>opt.maxheight) ? opt.maxheight : opt.height;
			}
			xa.style.height = mialto+'px';
			if (pageSize.windowWidth<pageSize.pageWidth) {
				xa.style.left =(pageSize.windowWidth>opt.width) ?	(((parseInt(pageSize.windowWidth-opt.width)/2) + pos[0]))+'px' : '0px';
			} else {
				xa.style.left =(pageSize.pageWidth>opt.width) ?	(((parseInt(pageSize.pageWidth-opt.width)/2) + pos[0]))+'px' : '0px';
			}
			xa.style.top = (parseInt(pageSize.windowHeight/2) - parseInt(mialto/2) + pos[1])+'px';
			var dmsg = document.getElementById('LNSwddmsg');
			dmsg.style.width = (opt.width-(opt.padding*2))+'px';
			dmsg.style.height = (mialto-opt.theight-(opt.padding*2))+'px';
		}
		return true;
	},

	_extend: function(destination, source) {
		for (var property in source) {
			destination[property] = source[property];
		}
		return destination;
	},

	_realOffset: function(element) {
		var valueT = 0, valueL = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		valueT = window.pageYOffset;
		valueL = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		valueT = document.body.scrollTop;
		valueL = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		valueT = document.documentElement.scrollTop;
		valueL = document.documentElement.scrollLeft;
	}
		return [valueL, valueT];
	},

	_setOpacity: function(element, value){
		if (typeof element == 'string')
			element= $(element);
		if (value == 1){
			element.style.opacity = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0 ;
			if(/MSIE/.test(navigator.userAgent) && !window.opera)
				element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi,'');
		} else {
			if(value < 0.00001) value = 0;
			element.style.opacity = value;
			if(/MSIE/.test(navigator.userAgent) && !window.opera)
				element.style.filter = element.style.filter.replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')';
		}
		return element;
	},

	_getPageSize: function() {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {
			xScroll = document.body.scrollWidth;
			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;
		}
			xScroll = document.body.scrollWidth;
			yScroll = (document.body.scrollHeight!=0) ? document.body.scrollHeight : window.innerHeight + window.scrollMaxY;

		var windowWidth, windowHeight;
		if (self.innerHeight) {
			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;
		}

		var pageWidth = 0;
		if(document.documentElement.scrollWidth && pageWidth < document.documentElement.scrollWidth) pageWidth = document.documentElement.scrollWidth;

		var pageHeight = 0;
		if(document.body.scrollHeight && pageHeight < document.body.scrollHeight) pageHeight = document.body.scrollHeight;
		if(document.documentElement.scrollHeight && pageHeight < document.documentElement.scrollHeight) pageHeight = document.documentElement.scrollHeight;
		return {
			'pageWidth':pageWidth,
			'pageHeight':pageHeight,
			'windowWidth':windowWidth,
			'windowHeight':windowHeight,
			'yScroll':yScroll,
			'xScroll':xScroll
		};
	},

	pause: function(ms){
		var date = new Date();
		curDate = null;
		do{var curDate = new Date();}
		while( curDate - date < ms);
	},

	showSelectBoxes: function() {
	 var selects = document.getElementsByTagName("select");
	 for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	 }
	 this.showFlash();
	 return true;
	},

	hideSelectBoxes: function(){
	 var selects = document.getElementsByTagName("select");
	 for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	 }
	 this.hideFlash();
	 return true;
	},
	
	showFlash: function(){
		var flashObjects = document.getElementsByTagName("object");
		for (i = 0; i < flashObjects.length; i++) {
			flashObjects[i].style.visibility = "visible";
		}
		var flashEmbeds = document.getElementsByTagName("embed");
		for (i = 0; i < flashEmbeds.length; i++) {
			flashEmbeds[i].style.visibility = "visible";
		}
	},

	hideFlash: function(){
		var flashObjects = document.getElementsByTagName("object");
		for (i = 0; i < flashObjects.length; i++) {
			flashObjects[i].style.visibility = "hidden";
		}
		var flashEmbeds = document.getElementsByTagName("embed");
		for (i = 0; i < flashEmbeds.length; i++) {
			flashEmbeds[i].style.visibility = "hidden";
		}
	},

	_getScrollerWidth: function(){
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    scr.style.overflow = 'hidden';
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';
    scr.appendChild(inn);
    document.body.appendChild(scr);
    wNoScroll = inn.offsetWidth;
    scr.style.overflow = 'auto';
    wScroll = inn.offsetWidth;
    document.body.removeChild(
        document.body.lastChild);
    return (wNoScroll - wScroll);
	}

};

