function WindowSize()
{
	this.w = 0;
	this.h = 0;
	return this.update();
}
WindowSize.prototype.update = function()
{
	var d = document;
	this.w = 
	  (window.innerWidth) ? window.innerWidth
	: (d.documentElement && d.documentElement.scrollWidth) ? d.documentElement.scrollWidth
	: d.body.clientWidth;
	this.h = 
	  (window.innerHeight) ? window.innerHeight
	: (d.documentElement && d.documentElement.scrollHeight) ? d.documentElement.scrollHeight
	: d.body.clientHeight;
	return this;
};
function PageSize()
{
	this.win = new WindowSize();
	this.w = 0;
	this.h = 0;
	return this.update();
}
PageSize.prototype.update = function()
{
	var d = document;
	this.w = 
	  (window.innerWidth && window.scrollMaxX) ? window.innerWidth + window.scrollMaxX
	: (d.body.scrollWidth > d.body.offsetWidth) ? d.body.scrollWidth
	: d.body.offsetWidth;
	this.h = 
	  (window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY
	: (d.body.scrollHeight > d.body.offsetHeight) ? d.body.scrollHeight
	: d.body.offsetHeight;
	this.win.update();
	if (this.w < this.win.w) this.w = this.win.w;
	if (this.h < this.win.h) this.h = this.win.h;
	return this;
};
function PagePos()
{
	this.x = 0;
	this.y = 0;
	return this.update();
}
PagePos.prototype.update = function()
{
	var d = document;
	this.x =
	  (window.pageXOffset) ? window.pageXOffset
	: (d.documentElement && d.documentElement.scrollLeft) ? d.documentElement.scrollLeft
	: (d.body) ? d.body.scrollLeft
	: 0;
	this.y =
	  (window.pageYOffset) ? window.pageYOffset
	: (d.documentElement && d.documentElement.scrollTop) ? d.documentElement.scrollTop
	: (d.body) ? d.body.scrollTop
	: 0;
	return this;
};
if (!Array.prototype.pop)
{
	Array.prototype.pop = function()
	{
		if (!this.length) return null;
		var last = this[this.length - 1];
		--this.length;
		return last;
	}
}
if (!Array.prototype.push)
{
	Array.prototype.push = function()
	{
		for (var i=0,n=arguments.length;i<n;i++)
			this[this.length] = arguments[i];
		return this.length;
	}
}
if (!Array.prototype.indexOf)
{
	Array.prototype.indexOf = function(value,idx)
	{
		if (typeof(idx) != 'number') idx = 0;
		else if (idx < 0) idx = this.length + idx;
		for (var i=idx,n=this.length;i<n;i++)
			if (this[i] === value) return i;
		return -1;
	}
}
function Browser()
{
	this.name = navigator.userAgent;
	this.isWinIE = this.isMacIE = false;
	this.isGecko = this.name.match(/Gecko\//);
	this.isSafari = this.name.match(/AppleWebKit/);
	this.isKHTML = this.isSafari || navigator.appVersion.match(/Konqueror|KHTML/);
	this.isOpera = window.opera;
	this.hasNS = (document.documentElement) ? document.documentElement.namespaceURI : null;
	if (document.all && !this.isGecko && !this.isSafari && !this.isOpera)
	{
		this.isWinIE = this.name.match(/Win/);
		this.isMacIE = this.name.match(/Mac/);
	}
}
var Browser = new Browser();
if (!window.Event) var Event = new Object;
Event = {
	cache : false,
	getEvent : function(evnt)
	{
		return (evnt) ? evnt : ((window.event) ? window.event : null);
	},
	getKey : function(evnt)
	{
		evnt = this.getEvent(evnt);
		return (evnt.which) ? evnt.which : evnt.keyCode;
	},
	stop : function(evnt)
	{
		try{ evnt.stopPropagation() } catch(err){};
		evnt.cancelBubble = true;
		try{ evnt.preventDefault() } catch(err){};
		return (evnt.returnValue = false);
	},
	register : function(object, type, handler)
	{
		if (type == 'keypress' && (Browser.isKHTML || object.attachEvent)) type = 'keydown';
		if (type == 'mousewheel' && Browser.isGecko) type = 'DOMMouseScroll';
		if (!this.cache) this.cache = [];
		if (object.addEventListener)
		{
			this.cache.push([object,type,handler]);
			object.addEventListener(type, handler, false);
		}
		else if (object.attachEvent)
		{
			this.cache.push([object,type,handler]);
			object.attachEvent(['on',type].join(''),handler);
		}
		else
		{
			object[['on',type].join('')] = handler;
		}
	},
	deregister : function(object, type, handler)
	{
		if (type == 'keypress' && (Browser.isKHTML || object.attachEvent)) type = 'keydown';
		if (type == 'mousewheel' && Browser.isGecko) type = 'DOMMouseScroll';
		if (object.removeEventListener)
			object.removeEventListener(type, handler, false);
		else if (object.detachEvent)
			object.detachEvent(['on',type].join(''), handler);
		else
			object[['on',type].join('')] = null;
	},
	deregisterAll : function()
	{
		if (!Event.cache) return
		for (var i=0,n=Event.cache.length;i<n;i++)
		{
			Event.deregister(Event.cache[i]);
			Event.cache[i][0] = null;
		}
		Event.cache = false;
	}
};
Event.register(window, 'unload', Event.deregisterAll);

function InitializeXMLHttpRequest(req)
{
    if (req != null)
       req.abort();
       
	try{ 
		req=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e){    
		try { req=new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(oc){ req=null;}
	}
	if(!req && typeof XMLHttpRequest!="undefined")
		req = new XMLHttpRequest();
	
	return req;	
}

var pos=0;
var posmax=0;
var step=10;
var scrl = false;
var posup = null;
var posdwn = null;
var mp = false;
function uup(id1, id2){
	posup=setInterval("up('"+id1+"', '"+id2+"')",50);
	return true;
}
function up(id1, id2){
	var commentcontainer = document.getElementById(id1);
	var commentslist = document.getElementById(id2);
	posmax = commentslist.scrollHeight - commentcontainer.clientHeight;
	if (posdwn){
		window.clearInterval(posdwn);
	};
	if (pos<0){
		pos=0;
	}
	if (pos>posmax){
		pos=posmax;
	}
	if (pos>0){
		pos-=step;
		if (pos<0){
			pos=0;
		}
		commentcontainer.scrollTop = pos;
	}else{ 
		if (posup){
			window.clearInterval(posup);
		};
	};
}
function cup(){
	if (posup){
		window.clearInterval(posup);
	};
	return true;
}
function cdwn(){
	if (posdwn){
		window.clearInterval(posdwn);
	};
	return true;
}
function udwn(id1, id2){
	posdwn=setInterval("dwn('"+id1+"', '"+id2+"')",50);
	return true;
}
function dwn(id1, id2){
	var commentcontainer = document.getElementById(id1);
	var commentslist = document.getElementById(id2);
	posmax = commentslist.scrollHeight - commentcontainer.clientHeight;
	if (posup){
		window.clearInterval(posup);
	};
	if (pos<0){
		pos=0;
	}
	if (pos>posmax){
		pos=posmax;
	}
	if ((pos<=posmax)){
		pos+=step;
		if (pos>posmax){
			pos=posmax;
		}
		commentcontainer.scrollTop = pos;
	}else{
		if (posdwn){
			window.clearInterval(posdwn);
		};
	}
}
function bstepu(){
	step=20;
	return true;
}
function sstepu(){
	step=10;
	return true;
}
function bstepd(){
	step=20;
	return true;
}
function sstepd(){
	step=10;
	return true;
}


function toggleLayer( layers, id )
{
	for ( i=0; i < layers.length; i++ )
	{
		hideLayer(layers[i]);
	}
	if( id > -1 && id < layers.length )
		showLayer(layers[id]);
}

function toggleLayer2( layers, id, suffix )
{
	for ( i=0; i < layers.length; i++ )
	{
		hideLayer(layers[i] + suffix);
	}
	if( id > -1 && id < layers.length )
		showLayer(layers[id] + suffix);
}
function toggleIcon3( layers, id, buttons )
{
	if( id > -1 && id < layers.length ) {
		var button = null;
		for ( i=0; i < layers.length; i++ ) {
			button = document.getElementById(buttons[i]);
			if(button) {
				button.className = buttons[i];
			}
		}
		button = document.getElementById(buttons[id]);
		if(button) {
			button.className = buttons[id] + "active";
			button.blur();
		}
		toggleLayer( layers, id );
	}
}


function showLayer(id)
{
	var lyr = document.getElementById(id);
	if( lyr )
		lyr.style.display = "block";
}

function hideLayer(id)
{
	var lyr = document.getElementById(id);
	if( lyr )
		lyr.style.display = "none";
}

function comboboxesVisiwind(visible) {
	if (document.all) {	
		var selects = document.getElementsByTagName("SELECT");
		for(var i=0; i<selects.length; i++) {
			if ( visible ) {
			  selects[i].style.visibility="visible";
			} else {	
			  selects[i].style.visibility="hidden";
			}
		}
    }
}

function hideLayerComboboxes(id)
{
	var elem = document.getElementById(id);
	if(elem){
		elem.style.display = 'none';
		comboboxesVisiwind(true);
	}			
}

function josKeyDown(iKeyCode, sFunc, e)
{
	if (e == null)
		e = window.event;
	var target = e.target ? e.target : e.srcElement;
	if (e.keyCode == iKeyCode)
	{
		if ( target && iKeyCode == 13 )
			target.blur();
		eval(unescape(sFunc));
		return false;
	}
}
function checkMail(eml)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(eml)) 
		return true;
	else 
		return false;
}
function getElementPosition(elemID){
	var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	while (offsetTrail){
		offsetLeft += offsetTrail.offsetLeft;
		offsetTop += offsetTrail.offsetTop;
		offsetTrail = offsetTrail.offsetParent;
	}
	if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
	}
	return {left:offsetLeft,top:offsetTop};
}
function urlencode(str) {
	str = escape(str);
	str = str.replace('+', '%2B');
	str = str.replace('%20', '+');
	str = str.replace('*', '%2A');
	str = str.replace('/', '%2F');
	str = str.replace('@', '%40');
	return str;
}

function urldecode(str) {
	str = str.replace('+', ' ');
	str = unescape(str);
	return str;
}
var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}

var _DAY_INDEX = 0;
var _MONTH_INDEX = 1;
var _YEAR_INDEX = 2;
var _HOUR_INDEX = 3;



function DateTimeSelector ( val, text, dateonly, prefixname, suffixname, startyear, endyear, direction, disabled, labcolor, bgcolor, errlabcolor, errbgcolor ) {
	this.dateonly = dateonly;
	this.disabled = disabled;
	this.start_year = startyear;
	this.end_year = endyear;
	this.direction = true;
	if(direction == 'asc')
		this.direction = true;
	else if (direction == 'desc')
		this.direction = false;
	else 
		this.direction = direction;

	this.dayname = prefixname + "day" + suffixname;
	this.monthname = prefixname + "month" + suffixname;
	this.yearname = prefixname + "year" + suffixname;
	this.hourname = prefixname + "hour" + suffixname;
	this.isPostbackname = prefixname + "isPostback" + suffixname;
	this.container = null;
	this.ispostback = null;
	this.labelElement = null;
	this.dayElement = null;
	this.monthElement = null;
	this.yearElement = null;
	this.hoursElement = null;
	this.text = text;
	this.value = new Array(4);
	this.errorLabelColor = errlabcolor;
	this.errorSelectBGColor = errbgcolor;
	this.labelColor = labcolor;
	this.selectBGColor = bgcolor;

	this.initSelector(val);
}
	
DateTimeSelector.prototype.initSelector = function (val) {
	var self = this;
	try {
		if ( val ) {
			self.value[_DAY_INDEX] = val[_DAY_INDEX];
			self.value[_MONTH_INDEX] = val[_MONTH_INDEX];
			self.value[_YEAR_INDEX] = val[_YEAR_INDEX];
			self.value[_HOUR_INDEX] = val[_HOUR_INDEX];
		} else {
			self.value[_DAY_INDEX] = 0;
			self.value[_MONTH_INDEX] = 0;
			self.value[_YEAR_INDEX] = 0;
			self.value[_HOUR_INDEX] = 0;
		}
	}
	catch(err)
	{
		self.value[_DAY_INDEX] = 0;
		self.value[_MONTH_INDEX] = 0;
		self.value[_YEAR_INDEX] = 0;
		self.value[_HOUR_INDEX] = 0;
	}
	self.build();
}
	
DateTimeSelector.prototype.GetHTML = function() {
	var self = this;
	return self.container.outerHTML;
}
	
DateTimeSelector.prototype.build = function() {
	var self = this;
	self.container = document.createElement("p");
	self.container.className = 'dateselector';
	self.ispostback = document.createElement("input");
	self.ispostback.type = 'hidden';
	self.ispostback.id = self.isPostbackname;
	self.ispostback.name = self.isPostbackname;
	self.ispostback.value = 1;
	self.container.appendChild(self.ispostback);
	
	self.dayElement = self.buildDaySelector();
	self.dayElement.style.backgroundColor = self.selectBGColor;
	self.dayElement.style.width = '40px';
	if( self.text ) {
		self.labelElement = document.createElement("label");
		self.labelElement.appendChild(document.createTextNode(self.text));
		self.labelElement.setAttribute("for",self.dayElement.id);
		self.labelElement.style.color = self.labelColor;
		self.labelElement.style.marginRight = '5px';
		self.container.appendChild(self.labelElement);
		//self.container.appendChild(document.createTextNode(' '));
	}
	self.container.appendChild(self.dayElement);
	self.container.appendChild(document.createTextNode(' '));
	self.monthElement = self.buildMonthSelector();
	self.monthElement.style.backgroundColor = self.selectBGColor;
	self.monthElement.style.width = '40px';
	self.container.appendChild(self.monthElement);
	self.container.appendChild(document.createTextNode(' '));
	self.yearElement = self.buildYearSelector();
	self.yearElement.style.backgroundColor = self.selectBGColor;
	self.yearElement.style.width = '50px';
	self.container.appendChild(self.yearElement);
	
	if (!self.dateonly)
	{
		self.container.appendChild(document.createTextNode(' '));
		self.hoursElement = self.buildHoursSelector();
		self.hoursElement.style.backgroundColor = self.selectBGColor;
		self.hoursElement.style.width = '55px';
		self.container.appendChild(self.hoursElement);
	}
	
	clear = document.createElement("span");
	clear.style.clear = 'both';
	self.container.appendChild(clear); 
//	self.container.setAttribute("style","background-color:green;");
	self.setDisable();
}

DateTimeSelector.prototype.buildDaySelector	= function() {
	var self = this;
	var daySelector = document.createElement("select");
	daySelector.id = self.dayname;
	daySelector.name = self.dayname;
	daySelector.options[0] = new Option("", 0);
	for (var n=1; n < 32; n++) {
		daySelector.options[n] = new Option(n, n);
	}
	if( !self.value[_DAY_INDEX] )
	{
//		daySelector.options[0].selected = true;
		daySelector.selectedIndex = 0;
	} else {
//		daySelector.options[self.value[_DAY_INDEX]].selected = true;
		daySelector.selectedIndex = self.value[_DAY_INDEX];
	}
	return daySelector;
}

DateTimeSelector.prototype.buildMonthSelector = function () {
	var self = this;
	var monthSelector = document.createElement("select");
	monthSelector.id = this.monthname;
	monthSelector.name = this.monthname;
	monthSelector.options[0] = new Option("", 0);
	for (var n=1; n < 13; n++) {
		monthSelector.options[n] = new Option(n, n);
	}
	if( !this.value[_MONTH_INDEX] )
	{
//		monthSelector.options[0].selected = true;
		monthSelector.selectedIndex = 0;
	} else {
//		monthSelector.options[self.value[_MONTH_INDEX]].selected = true;
		monthSelector.selectedIndex = self.value[_MONTH_INDEX];
	}
	return monthSelector;
}
	
DateTimeSelector.prototype.buildYearSelector = function () {
	var self = this;
	var yearSelector = document.createElement("select");
	yearSelector.id = self.yearname;
	yearSelector.name = self.yearname;
	yearSelector.options[0] = new Option("", 0);
	var today       = new Date();
    var strYear     = today.getFullYear();	
    if(!self.start_year)
     self.start_year = strYear;
    if (self.value[ _YEAR_INDEX ] != 0 && self.value[ _YEAR_INDEX ] < self.start_year)
     self.start_year = self.value[ _YEAR_INDEX ];
    if(!self.end_year)
     self.end_year = strYear;
    if (self.value[ _YEAR_INDEX ] != 0 && self.value[ _YEAR_INDEX ] > self.end_year)
     self.end_year = self.value[ _YEAR_INDEX ];
	i = 1;
	if ( self.direction == true ) {
		for (var n = self.start_year; n <= self.end_year; n++) {
			yearSelector.options[i] = new Option(n, n);
			i++;
		}
	} else {
		for (var n=self.end_year; n >= self.start_year; n--) {
			yearSelector.options[i] = new Option(n, n);
			i++;
		}
	}
	if( !self.value[_YEAR_INDEX] )
	{
//		yearSelector.options[0].selected = true;
		yearSelector.selectedIndex = 0;
	} else {
		if ( self.direction == true ) {
//			yearSelector.options[ self.value[ _YEAR_INDEX ] - self.start_year + 1 ].selected = true;
			yearSelector.selectedIndex = self.value[ _YEAR_INDEX ] - self.start_year + 1;
		} else {
//			yearSelector.options[ self.end_year - self.value[ _YEAR_INDEX ] + 1 ].selected = true;
			yearSelector.selectedIndex = self.end_year - self.value[ _YEAR_INDEX ] + 1 ;
		}
	}
	return yearSelector;
}
	
DateTimeSelector.prototype.buildHoursSelector = function () {
	var self = this;
	var hourSelector = document.createElement("select");
	hourSelector.id = self.hourname;
	hourSelector.name = self.hourname;
	for (var n=0; n < 24; n++) {
		hourSelector.options[n] = new Option(n+":00", n);
	}
	if( !this.value[_HOUR_INDEX] )
	{
		hourSelector.options[0].selected = true;
	} else {
		hourSelector.options[self.value[_HOUR_INDEX]].selected = true;
	}
	return hourSelector;
}

DateTimeSelector.prototype.validate = function () {
	var self = this;
	var isValid = true;
	if ( !self.disabled ) {
		isValid = self.checkSelection(self.dayElement) && isValid;
		isValid = self.checkSelection(self.monthElement) && isValid;
		isValid = self.checkSelection(self.yearElement) && isValid;
	}
	self.setLabelColor( !isValid );
	return isValid;
}

DateTimeSelector.prototype.checkSelection = function (el) {
	var self = this;
	if ( el.selectedIndex == 0 ) {
		el.style.backgroundColor = self.errorSelectBGColor;
		return false;
	}
	else
	{
		el.style.backgroundColor = self.selectBGColor;
		return true;
	}
}
 
DateTimeSelector.prototype.getDateTimeValue = function () {
	var self = this;
	if ( self.validate ) {
		if (self.dateonly)
		{
			return new Date(self.yearElement.value, self.monthElement.value - 1, self.dayElement.value);
		} else {
			return new Date(self.yearElement.value, self.monthElement.value - 1, self.dayElement.value, self.hoursElement.value);
			
		}
	}
	return false;
}
DateTimeSelector.prototype.setLabelColor = function ( hasError ) {
	var self = this;
	if( self.labelElement )
	{
		if ( hasError ) {
			self.labelElement.style.color = self.errorLabelColor;
		}
		else
		{
			self.labelElement.style.color = self.labelColor;
		}
	}
}
DateTimeSelector.prototype.setDisable = function ( ) {
	var self = this;
	if(self.labelElement)
		self.labelElement.disabled = self.disabled;
	self.dayElement.disabled = self.disabled;
	self.monthElement.disabled = self.disabled;
	self.yearElement.disabled = self.disabled;
	if(self.hoursElement)
		self.hoursElement.disabled = self.disabled;
}

function MessageDlg( _id, _text, _title, _type ) {
	switch (_type) {
		case 1:
			this.className = 'alertbox';
		break;
		default:
			this.className = 'paymentnotify';
		break;
	}
	this.text = _text;
	this.id = _id;
	this.title = _title;
	this.initDlg();
}

MessageDlg.prototype.initDlg = function() {
	var self = this;
	var elem = document.getElementById(self.id);
	if ( elem )
		document.body.removeChild( elem );
	elem = document.createElement('div');
	elem.setAttribute('id', self.id);
	elem.className = self.className;
	var titl = document.createElement('p');
	titl.className = 'alerttitle';
	titl.appendChild(document.createTextNode(self.title));
	elem.appendChild(titl);
	var txt = document.createElement('p');
	txt.className = 'alerttext';
	txt.innerHTML = self.text;
	elem.appendChild(txt);
	var btns = document.createElement('p');
	btns.className = 'alertbuttons';
	var closebtn = document.createElement('a');
	closebtn.appendChild(document.createTextNode('close'));
	closebtn.style.cursor = 'pointer';
	Event.register(closebtn, "click", function() {
		self.destroy(self.id);
	});
	btns.appendChild(closebtn);
	elem.appendChild(btns);
	elem.style.position = 'absolute';
	elem.style.zIndex = '1000';
	elem.style.display = 'block';
	document.body.appendChild(elem);
	var y = window.scrollY || document.body.scrollTop || document.documentElement.scrollTop || 0;
	elem.style.top = (document.body.clientHeight/2 + y - 116) + 'px';
	elem.style.left = '50%';
	var dx = -(378/2);
	elem.style.margin = '0 0 0 ' + dx + 'px';
	comboboxesVisiwind(false);
}

MessageDlg.prototype.destroy = function(id) {
	var self = this;
	var elem = document.getElementById(id);
	if ( elem )
		document.body.removeChild( elem );
//	comboboxesVisiwind(true);
}


function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ) 
	{
		return null;
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}