/*
	TalkShoe Confidential Information
	Copyright (c) 2005 - 2009 
*/

var ErrImage1= new Image(10,10);
ErrImage1.src = "/resources/talkshoe/images/Errors/ErrorBoxTopLeftBorder.gif";
var ErrImage2= new Image(10,10);
ErrImage2.src = "/resources/talkshoe/images/Errors/ErrorBoxTopRightBorder.gif";
var ErrImage3= new Image(10,10);
ErrImage3.src = "/resources/talkshoe/images/Errors/ErrorBoxBotRightBorder.gif";
var ErrImage4= new Image(10,10);
ErrImage4.src = "/resources/talkshoe/images/Errors/ErrorBoxBotLeftBorder.gif";

function ErrorContent(str,type,formName,hiddenBtn){
	var MainErrorWidth = 'width="964"';
	var MainErrorHeight = screen.height;
	var contentStr;
	var msgTitle = '&nbsp;';
	
	if(type == 'error'){
		contentStr = '<div class="errorContentDiv">'+str+'<br/><br/>'
			+'<img src="/resources/talkshoe/images/Errors/errorOK.gif" '
			+'border="0" onclick="hideAlert();" style="cursor:pointer;"/></div>';
		msgTitle = '<div style="color:red;">&nbsp;</div>';
	}else if(type =='confirm'){
		var okBtn = '';
		if(formName == 'goToUrl'){
			if(checkForIE6()){
				okBtn = '<img src="/resources/talkshoe/images/Errors/confirmTrue.gif" '
				+'border="0" style="cursor:pointer;" onclick="location.href=\''+hiddenBtn+'\';hideAlert();"/>'
			}else{
				okBtn = '<a href="javascript:;" onclick="location.href=\''+hiddenBtn+'\';hideAlert();"><img src="/resources/talkshoe/images/Errors/confirmTrue.gif" '
				+'border="0" style="cursor:pointer;" /></a>'			
			}
		}else{
			if(checkForIE6()){
				okBtn = '<img src="/resources/talkshoe/images/Errors/confirmTrue.gif" '
				+'border="0" style="cursor:pointer;" onclick="document.getElementById(\''+formName+':'+hiddenBtn+'\').click();hideAlert();"/>';
			}else{
				okBtn = '<a href="javascript:;" onclick="document.getElementById(\''+formName+':'+hiddenBtn+'\').click();hideAlert();"><img src="/resources/talkshoe/images/Errors/confirmTrue.gif" '
				+'border="0" style="cursor:pointer;"/></a>';
			}
		}
		contentStr = '<div class="confirmContentDiv">'+str+'<br/><br/>'+okBtn
			+'&nbsp;&nbsp;<a href="javascript:;" onclick="hideAlert();"><img src="/resources/talkshoe/images/Errors/confirmFalse.gif" '
			+'border="0" style="cursor:pointer;"/></a></div>';
			
	}else{
		contentStr = '<div class="nonErrorContentDiv">'+str+'<br/><br/>'
			+'<a href="javascript:;" onclick="hideAlert();"><img src="/resources/talkshoe/images/Errors/nonErrorOK.gif" '
			+'border="0" style="cursor:pointer;"/></a></div>';
	}
	
	eContentInfo = '<table border="0" cellspacing="0" cellpadding="0"  '+ MainErrorWidth +
	'id="MainErrorPopTB" class="MainErrorPopTB" style="padding:0px;" align="center" onclick="hideAlert();">'+
		'<tr>'+
			'<td class="MainErrorPopTBTD" align="center" '+MainErrorWidth+' height="'+MainErrorHeight+'">'+
				'<table border="0" cellspacing="0" cellpadding="0" class="MainErrorOuterTB" align="center">'+
					'<tr>'+
						'<td align="center">'+
							'<table border="0" cellspacing="0" cellpadding="0" class="MainErrorInnerTB" '+
							'style="padding:0px;" align="center">'+
								'<tr>'+
									'<td class="MainErrorTopLeft" width="10" height="10" align="right" valign="bottom">&nbsp;</td>'+
									'<td class="MainErrorTopBotMiddle" height="10" align="left" valign="bottom">&nbsp;</td>'+
									'<td class="MainErrorTopRight" width="10" height="10" align="left" valign="bottom">&nbsp;</td>'+
								'</tr>'+
								'<tr>'+
									'<td colspan="3" align="center" valign="top" id="MainErrorContentTDFixed">'+
									'<table border="0" cellspacing="0" cellpadding="0" '+
									'style="margin0px;padding:0px;" align="center">'+
										'<tr>'+
											'<td class="MainErrorMiddleLeft" width="10" align="right" valign="top">&nbsp;</td>'+
											'<td align="left" valign="bottom" class="MainErrorContentTDLeft">'+
												msgTitle+
											'</td>'+
											'<td align="right" class="MainErrorContentTDRight">'+
												'<a href="javascript:;" onclick="hideAlert();" '+
												'class="MainErrorClose">CLOSE - X</a><br />'+
											'</td>'+
											'<td class="MainErrorMiddleRight" width="10" align="left" valign="top">&nbsp;</td>'+
										'</tr>'+
										'<tr>'+
											'<td class="MainErrorMiddleLeft" width="10" align="right" valign="top">&nbsp;</td>'+
											'<td colspan="2" class="MainErrorContentTD" align="center" id="MainErrorContentTD">'+
												contentStr+
											'</td>'+
											'<td class="MainErrorMiddleRight" width="10" align="left" valign="top">&nbsp;</td>'+
										'</tr>'+
									'</table>'+
									'</td>'+
								'</tr>'+
								'<tr>'+
									'<td class="MainErrorBotLeft" width="10" height="10" align="left" valign="top">&nbsp;</td>'+
									'<td class="MainErrorTopBotMiddle" height="10" align="left" valign="top">&nbsp;</td>'+
									'<td class="MainErrorBotRight" width="10" height="10" align="right" valign="top">&nbsp;</td>'+
								'</tr>'+
							'</table>'+
						'</td>'+
					'</tr>'+
				'</table>'+
			'</td>'+
		'</tr>'+
	'</table>';
}

function errorPop(errorStr){
	ErrorContent(errorStr,'error','','');
	document.getElementById('AlertDiv').innerHTML = eContentInfo;
	if(((browser=="Internet Explorer" || browser=="InternetExplorer") && (version >= "6"))
	 ||((browser=="Gecko") && (version > "4"))
	 ||((browser=="Opera") && (version >= "8"))
	 ||((browser=="Safari") && (version >= "5"))){
		$("div#AlertDiv").show();
	}else{
		document.getElementById('AlertDiv').style.display = "";
	}
}

function errorConfirm(confirmStr,formName,hiddenBtn){
		ErrorContent(confirmStr,'confirm',formName,hiddenBtn);
		document.getElementById('AlertDiv').innerHTML = eContentInfo;
		if(((browser=="Internet Explorer" || browser=="InternetExplorer") && (version >= "6"))
		 ||((browser=="Gecko") && (version > "4"))
		 ||((browser=="Opera") && (version >= "8"))
		 ||((browser=="Safari") && (version >= "5"))){
			$("div#AlertDiv").show();
		}else{
			document.getElementById('AlertDiv').style.display = "";
		}
}

function nonErrorPop(nonErrorStr){
	ErrorContent(nonErrorStr,'non-error','','');
	document.getElementById('AlertDiv').innerHTML = eContentInfo;
	if(((browser=="Internet Explorer" || browser=="InternetExplorer") && (version >= "6"))
	 ||((browser=="Gecko") && (version > "4"))
	 ||((browser=="Opera") && (version >= "8"))
	 ||((browser=="Safari") && (version >= "5"))){
		$("div#AlertDiv").show();
	}else{
		document.getElementById('AlertDiv').style.display = "";
	}
}

function hideAlert(){
	document.getElementById('AlertDiv').blur();
	document.getElementById('AlertDiv').style.height = "0px";

	if(((browser=="Internet Explorer" || browser=="InternetExplorer") && (version >= "6"))
	 ||((browser=="Gecko") && (version > "4"))
	 ||((browser=="Opera") && (version >= "8"))
	 ||((browser=="Safari") && (version >= "5"))){
		$("div#AlertDiv").fadeOut("slow");
	}else{
		document.getElementById('AlertDiv').style.display = "none";
	}
}