msgBox = function()
{
	if(arguments.length>0)
	{
		this.show_msgBox();
		$('#msgBoxHeader').html('<b>'+(arguments[1]?arguments[1]:'Message Box')+'</b>');
		$('#msgBoxText').html(arguments[0]);
		$('#msgBoxContainer').show();
		this.reset_msgBox();
	}
}

with(msgBox) {
	prototype.show_msgBox = function() {
		try {
			if($('#msgBoxContainer')) {
				$('#msgBoxContainer,#msgBoxHideSelect').remove();
			}
			
			if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
				$("body","html").css({height: "100%", width: "100%"});
				$("html").css("overflow","hidden");
				if (document.getElementById("msgBoxHideSelect") === null) {//iframe to hide select elements in ie6
					$("body").append('<iframe id="msgBoxHideSelect"></iframe>'+
						'<div id="msgBoxContainer">'+
							'<table cellspacing="0" cellpadding="0" border="0">'+
								'<tr>'+
									'<td class="tl">&nbsp;</td>'+
									'<td class="t">&nbsp;</td>'+
									'<td class="tr">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td class="l">&nbsp;</td>'+
									'<td id="msgBoxContent">'+
										'<table cellspacing="0" cellpadding="0" border="0">'+
											'<tr>'+
												'<td valign="top" align="left" style="padding-right:15px;"><img src="images/msgbox/point.png" /></td>'+
												'<td>&nbsp;</td>'+
												'<td valign="top" align="right" style="padding-left:15px;">'+
													'<a href="javascript:hide_msgBox();">'+
														'<img src="images/msgbox/close.png" />'+
													'</a>'+
												'</td>'+
											'</tr>'+
											'<tr>'+
												'<td>&nbsp;</td>'+
												'<td align="left" id="msgBoxHeader">&nbsp;</td>'+
												'<td>&nbsp;</td>'+
											'</tr>'+
											'<tr>'+
												'<td>&nbsp;</td>'+
												'<td align="justify" id="msgBoxText">&nbsp;</td>'+
												'<td>&nbsp;</td>'+
											'</tr>'+
											'<tr>'+
												'<td valign="bottom" align="left" style="padding-right:15px;"><img src="images/msgbox/point.png" /></td>'+
												'<td>&nbsp;</td>'+
												'<td valign="bottom" align="right" style="padding-left:15px;"><img src="images/msgbox/point.png" /></td>'+
											'</tr>'+
										'</table>'+
									'</td>'+
									'<td class="r">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td class="bl">&nbsp;</td>'+
									'<td class="b">&nbsp;</td>'+
									'<td class="br">&nbsp;</td>'+
								'</tr>'+
							'</table>'+
						'</div>');
				}
			} else{//all others
				if(document.getElementById("msgBoxContainer") === null) {
					$("body").append(
						'<div id="msgBoxContainer">'+
							'<table cellspacing="0" cellpadding="0" border="0">'+
								'<tr>'+
									'<td class="tl">&nbsp;</td>'+
									'<td class="t">&nbsp;</td>'+
									'<td class="tr">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td class="l">&nbsp;</td>'+
									'<td id="msgBoxContent">'+
										'<table cellspacing="0" cellpadding="0" border="0">'+
											'<tr>'+
												'<td valign="top" align="left" style="padding-right:15px;"><img src="images/msgbox/point.png" /></td>'+
												'<td>&nbsp;</td>'+
												'<td valign="top" align="right" style="padding-left:15px;">'+
													'<a href="javascript:hide_msgBox();">'+
														'<img src="images/msgbox/close.png" />'+
													'</a>'+
												'</td>'+
											'</tr>'+
											'<tr>'+
												'<td>&nbsp;</td>'+
												'<td align="left" id="msgBoxHeader">&nbsp;</td>'+
												'<td>&nbsp;</td>'+
											'</tr>'+
											'<tr>'+
												'<td>&nbsp;</td>'+
												'<td align="justify" id="msgBoxText">&nbsp;</td>'+
												'<td>&nbsp;</td>'+
											'</tr>'+
											'<tr>'+
												'<td valign="bottom" align="left" style="padding-right:15px;"><img src="images/msgbox/point.png" /></td>'+
												'<td>&nbsp;</td>'+
												'<td valign="bottom" align="right" style="padding-left:15px;"><img src="images/msgbox/point.png" /></td>'+
											'</tr>'+
										'</table>'+
									'</td>'+
									'<td class="r">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td class="bl">&nbsp;</td>'+
									'<td class="b">&nbsp;</td>'+
									'<td class="br">&nbsp;</td>'+
								'</tr>'+
							'</table>'+
						'</div>');
				}
			}
			
			var pageWidth = window.innerWidth || self.innerWidth || (document.documentElement&&document.documentElement.clientWidth) || document.body.clientWidth;
			var pageHeight = window.innerHeight || self.innerHeight || (document.documentElement&&document.documentElement.clientHeight) || document.body.clientHeight;
			$("#msgBoxContainer").css({height:pageHeight-20+"px"});
			$("#msgBoxContainer").css({marginLeft: '-' + parseInt((620 / 2),10) + 'px', width: 620 + 'px'});
				if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
					$("#msgBoxContainer").css({marginTop: '-' + parseInt(((pageHeight-20) / 2),10) + 'px'});
				}
				else {
	
				}
				
		} catch(e) {
			
		}
	}
	prototype.reset_msgBox = function() {
		document.getElementById("msgBoxContainer").style.display = "block";
		document.getElementById("msgBoxContainer").style.width = "auto";
		document.getElementById("msgBoxContainer").style.height = "auto";
		document.getElementById("msgBoxContainer").style.marginLeft = "-" + document.getElementById("msgBoxContainer").offsetWidth/2 + "px";
		if(!navigator.appName=="Microsoft Internet Explorer" || navigator.userAgent.indexOf("MSIE 6.0")==-1) {
			document.getElementById("msgBoxContainer").style.marginTop = "-" + document.getElementById("msgBoxContainer").offsetHeight/2 + "px";
		}
	}
}

function hide_msgBox() {
	$("#msgBoxContainer").fadeOut("fast",function(){$('#msgBoxContainer,#msgBoxHideSelect').trigger("unload").unbind().remove();});
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
}




/************************************************************************/

confirmBox = function()
{
	if(arguments.length>0)
	{
		this.show_confirmBox();
		$('#confirmBoxContent').html(arguments[0]);
		
		
		var control = "";
			
		if(arguments[1]) {
			var params = arguments[1];
			for(var i=0; i<params.length;i++) {
				if(params[i]['sFile']) {
					control += control==""?"":"&nbsp;&nbsp;";
					control += '<a href="javascript:'+params[i]['oFunction']+'();"><img src="images/buttons/'+params[i]['sFile']+'.png" /></a>';
				} else {
					control += control==""?"":"&nbsp;&nbsp;";
					control += '<a href="javascript:'+params[i]['oFunction']+'();">'+params[i]['sName']+'</a>';
				}
			}
		}
		
		$('#confirmBoxControl').html(control);
		
		$('#confirmBoxContainer').show();
		this.reset_confirmBox();
	}
}

with(confirmBox) {
	prototype.show_confirmBox = function() {
		try {
			if($('#confirmBoxContainer')) {
				$('#confirmBoxContainer,#confirmBoxHideSelect').remove();
			}
			
			if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
				$("body","html").css({height: "100%", width: "100%"});
				$("html").css("overflow","hidden");
				if (document.getElementById("confirmBoxHideSelect") === null) {//iframe to hide select elements in ie6
					$("body").append('<iframe id="confirmBoxHideSelect"></iframe>'+
						'<div id="confirmBoxContainer">'+
							'<table cellspacing="10" cellpadding="0" border="0">'+
								'<tr>'+
									'<td id="confirmBoxContent" align="left">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td id="confirmBoxControl" align="right">&nbsp;</td>'+
								'</tr>'+
							'</table>'+
						'</div>');
				}
			} else{//all others
				if(document.getElementById("confirmBoxContainer") === null) {
					$("body").append(
						'<div id="confirmBoxContainer">'+
							'<table cellspacing="10" cellpadding="0" border="0">'+
								'<tr>'+
									'<td id="confirmBoxContent" align="left">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td id="confirmBoxControl" align="right">&nbsp;</td>'+
								'</tr>'+
							'</table>'+
						'</div>');
				}
			}
			
			var pageWidth = window.innerWidth || self.innerWidth || (document.documentElement&&document.documentElement.clientWidth) || document.body.clientWidth;
			var pageHeight = window.innerHeight || self.innerHeight || (document.documentElement&&document.documentElement.clientHeight) || document.body.clientHeight;
			$("#confirmBoxContainer").css({height:pageHeight-20+"px"});
			$("#confirmBoxContainer").css({marginLeft: '-' + parseInt((620 / 2),10) + 'px', width: 620 + 'px'});
				if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
					$("#confirmBoxContainer").css({marginTop: '-' + parseInt(((pageHeight-20) / 2),10) + 'px'});
				}
				else {
	
				}
				
		} catch(e) {
			
		}
	}
	prototype.reset_confirmBox = function() {
		document.getElementById("confirmBoxContainer").style.display = "block";
		document.getElementById("confirmBoxContainer").style.width = "auto";
		document.getElementById("confirmBoxContainer").style.height = "auto";
		document.getElementById("confirmBoxContainer").style.marginLeft = "-" + document.getElementById("confirmBoxContainer").offsetWidth/2 + "px";
		if(!navigator.appName=="Microsoft Internet Explorer" || navigator.userAgent.indexOf("MSIE 6.0")==-1) {
			document.getElementById("confirmBoxContainer").style.marginTop = "-" + document.getElementById("confirmBoxContainer").offsetHeight/2 + "px";
		}
	}
}

function hide_confirmBox() {
	$("#confirmBoxContainer").fadeOut("fast",function(){$('#confirmBoxContainer,#confirmBoxHideSelect').trigger("unload").unbind().remove();});
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
}










/*
if (window.addEventListener) window.addEventListener("load", aaa, false);
if (window.attachEvent) window.attachEvent("onload", aaa);

function aaa() {
	new msgBox('hello world','Testing');
}*/