WSGLayout.prototype = new Object();
WSGLayout.prototype.constructor = WSGLayout;
WSGLayout.superclass = null;

function WSGLayout() {		
};

WSGLayout.prototype.getSpace = function (height){
	var str = new StringBuffer();
	str.append('<table cellspacing="0" cellpadding="0" border="0" align="center">');
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="' + height + '"></td>');
		str.append('</tr>');
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getButtons = function (windowId, labels, funcNames, showCancelButton){
	var str = new StringBuffer();
	var bundle = new WSGResourceBundle();
	str.append('<table cellspacing="0" cellpadding="0" border="0" align="center">');
		str.append('<tr>');	
			for ( var i = 0; i < labels.length; i++) {
				str.append('<td align="right">');
					str.append('<table title="' + labels[i] + '" class="wsg-button" cellpadding="0" cellspacing="0" border="0" onclick="' + funcNames[i] + '">');
						str.append('<tr>');
							str.append('<td><img src="' + wsgImagesLocation + 'button_l.gif"></td>');
							str.append('<td class="wsg-button-label">' + labels[i] + '</td>');
							str.append('<td><img src="' + wsgImagesLocation + 'button_r.gif"></td>');										
						str.append('</tr>');
					str.append('</table>');                                                                                                                                                                      
				str.append('</td>');
				str.append('<td width="10"></td>');				
			}			
			if (showCancelButton) {
				str.append('<td align="' + ((labels != null) ? 'left' : 'center') + '">');
					str.append('<table title="' + bundle.BUTTON_LABEL_CANCEL + '" class="wsg-button" cellpadding="0" cellspacing="0" border="0" onclick="new WSGWindow().closeDefaultButton(\'' + windowId + '\');">');
						str.append('<tr>');
							str.append('<td><img src="' + wsgImagesLocation + 'button_l.gif"></td>');
							str.append('<td class="wsg-button-label">' + bundle.BUTTON_LABEL_CANCEL + '</td>');
							str.append('<td><img src="' + wsgImagesLocation + 'button_r.gif"></td>');										
						str.append('</tr>');
					str.append('</table>');                                                                                                                                                                      
				str.append('</td>');	
			}
		str.append('</tr>');
	str.append('</table>');
	str.append('<table><tr><td height="10"></td></tr></table>');
	return str.toString();
};

WSGLayout.prototype.getAJAXLoader = function (message){
	var str = new StringBuffer();
	str.append('<table cellspacing="0" cellpadding="0" border="0" align="center">');
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
		str.append('</tr>');			
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'ajax-loader.gif"></td>');
		str.append('</tr>');
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
		str.append('</tr>');		
		str.append('<tr>');	
			str.append('<td align="center" class="wsg-text-grey">' + message +'</td>');
		str.append('</tr>');
		str.append('<tr>');	
		 str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	    str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getAJAXLoaderWithProgressBar = function (message){
	var str = new StringBuffer();
	str.append('<table cellspacing="0" cellpadding="0" border="0" align="center">');
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
		str.append('</tr>');			
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'ajax-loader.gif"></td>');
		str.append('</tr>');
		str.append('<tr>');	
			str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
		str.append('</tr>');		
		str.append('<tr>');	
			str.append('<td align="center" id="progressBarTable">');
				str.append('<table width="102" height="8" style="background-image: url(\'' + wsgImagesLocation + 'progress_bar_bg.gif\'); background-repeat: no-repeat;" cellpadding="0" cellspacing="0">');
					str.append('<tr>');
						str.append('<td align="left" id="progressBar">&nbsp;</td>');
					str.append('</tr>');
				str.append('</table>');
			str.append('</td>');
		str.append('</tr>');		
		str.append('<tr>');	
			str.append('<td height="24" align="center" class="wsg-text-grey" id="loaderPercent"></td>');
		str.append('</tr>');
		str.append('<tr>');	
		str.append('<td align="center" class="wsg-text-grey" id="loaderText">' + message +'</td>');
		str.append('</tr>');
		str.append('<tr>');	
		 str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	    str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getWHAJAXLoader = function (message, width, height){
	var str = new StringBuffer();
	str.append('<table width="' + ((width != null) ? width : '100%') +'" ' + ((height != null) ? 'style="height:' + height + ';"' : '') + ' cellspacing="0" cellpadding="0" border="0" align="center">');
	str.append('<tr>');	
	str.append('<td align="center">');
	str.append('<table cellspacing="0" cellpadding="0" border="0" align="center">');
	str.append('<tr>');
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');			
	str.append('<tr valign="bottom">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'ajax-loader.gif"></td>');
	str.append('</tr>');
	str.append('<tr valign="top">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');		
	str.append('<tr valign="top">');	
	str.append('<td align="center" class="wsg-text-grey">' + message +'</td>');
	str.append('</tr>');
	str.append('<tr>');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="16"></td>');
	str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      	
	str.append('</td>');
	str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getListAJAXLoader = function (message, width, height){
	var str = new StringBuffer();
	str.append('<table width="' + ((width != null) ? width : '100%') +'" ' + ((height != null) ? 'style="height:' + height + ';"' : '') + ' cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-message-err-box">');
	str.append('<tr>');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');			
	str.append('<tr valign="bottom">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'ajax-loader.gif"></td>');
	str.append('</tr>');
	str.append('<tr valign="top">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');		
	str.append('<tr valign="top">');	
	str.append('<td align="center" class="wsg-text-grey">' + message +'</td>');
	str.append('</tr>');
	str.append('<tr>');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="16"></td>');
	str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getSortListAJAXLoader = function (message, width, height){
	var str = new StringBuffer();
	str.append('<table width="' + ((width != null) ? width : '100%') +'" ' + ((height != null) ? 'style="height:' + height + ';"' : '') + ' cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-list-message-box">');
	str.append('<tr>');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');			
	str.append('<tr valign="bottom">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'ajax-loader.gif"></td>');
	str.append('</tr>');
	str.append('<tr valign="top">');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="10"></td>');
	str.append('</tr>');		
	str.append('<tr valign="top">');	
	str.append('<td align="center" class="wsg-text-grey">' + message +'</td>');
	str.append('</tr>');
	str.append('<tr>');	
	str.append('<td align="center"><img src="' + wsgImagesLocation + 'blank.gif" height="16"></td>');
	str.append('</tr>');					
	str.append('</table>');                                                                                                                                                                      
	return str.toString();
};

WSGLayout.prototype.getMessage = function(messageType, text) {
	var str = new StringBuffer();
	str.append('<table width="100%" cellspacing="0" cellpadding="0" border="0" style="padding: 10px;"><tr><td id="msgId">');
	str.append('<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-message-err-box">');
		str.append('<tr>');
			str.append('<td width="50%"></td>');
			str.append('<td width="36">');
			str.append(this.getImageByMessageType(messageType));
			str.append('</td>');
			str.append('<td>&nbsp;&nbsp;</td>');
			str.append('<td nowrap="nowrap" class="wsg-message-err" align="left" id="msgTxtId">');
			str.append(text);
			str.append('</td>');
			str.append('<td width="50%"></td>');
		str.append('</tr>');
	str.append('</table>');
	str.append('</td></tr></table>');
	return str.toString();
};

WSGLayout.prototype.getWindowFormMessage = function(messageType, text) {
	var str = new StringBuffer();
	str.append('<table width="100%" cellspacing="0" cellpadding="0" border="0" style="padding: 10px;padding-top:0px;"><tr><td>');
	str.append('<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-message-err-box">');
	str.append('<tr>');
	str.append('<td width="50%"></td>');
	str.append('<td width="36">');
	str.append(this.getImageByMessageType(messageType));
	str.append('</td>');
	str.append('<td>&nbsp;&nbsp;</td>');
	str.append('<td nowrap="nowrap" class="wsg-message-err" align="left">');
	str.append(text);
	str.append('</td>');
	str.append('<td width="50%"></td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td></tr></table>');
	return str.toString();
};

WSGLayout.prototype.getMessageNoPadding = function(messageType, text) {
	var str = new StringBuffer();
	str.append('<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-message-err-box">');
	str.append('<tr>');
	str.append('<td width="50%"></td>');
	str.append('<td width="36">');
	str.append(this.getImageByMessageType(messageType));
	str.append('</td>');
	str.append('<td>&nbsp;&nbsp;</td>');
	str.append('<td nowrap="nowrap" class="wsg-message-err" align="left">');
	str.append(text);
	str.append('</td>');
	str.append('<td width="50%"></td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td></tr></table>');
	return str.toString();
};

WSGLayout.prototype.getMessageWithSizeNoPadding = function(messageType, text, width, height) {
	var str = new StringBuffer();
	str.append('<table width="' + ((width != null) ? width : '100%') +'" ' + ((height != null) ? 'style="height:' + height + ';"' : '') + ' cellspacing="0" cellpadding="0" border="0" align="center" class="wsg-message-err-box">');
	str.append('<tr>');
	str.append('<td width="50%"></td>');
	str.append('<td width="36">');
	str.append(this.getImageByMessageType(messageType));
	str.append('</td>');
	str.append('<td>&nbsp;&nbsp;</td>');
	str.append('<td nowrap="nowrap" class="wsg-message-err" align="left">');
	str.append(text);
	str.append('</td>');
	str.append('<td width="50%"></td>');
	str.append('</tr>');
	str.append('</table>');
	str.append('</td></tr></table>');
	return str.toString();
};
WSGLayout.prototype.getImageByMessageType = function (messageType) {
	var str = new StringBuffer();
	if (WSG_MESSAGE_TYPE_SUCCESS == messageType) {
		str.append('<img src="' + wsgImagesLocation + WSG_ICON_SUCCESS + '" border="0">');
	} else if (WSG_MESSAGE_TYPE_WARNING == messageType) {
		str.append('<img src="' + wsgImagesLocation + WSG_ICON_INFO + '" border="0">');
	} else if (WSG_MESSAGE_TYPE_INFO == messageType) {
		str.append('<img src="' + wsgImagesLocation + WSG_ICON_INFO + '" border="0">');
	} else if (WSG_MESSAGE_TYPE_QUESTION == messageType) {
		str.append('<img src="' + wsgImagesLocation + WSG_ICON_INFO + '" border="0">');
	} else {
		str.append('<img src="' + wsgImagesLocation + WSG_ICON_ERROR + '" border="0">');
	}
	return str.toString();
};
WSGLayout.prototype.getDefaultCloseButton = function(windowId, focusFieldId) {
	var bundle = new WSGResourceBundle();
	return this.getSpace(5) + this.getButtons(windowId, new Array(bundle.BUTTON_LABEL_OK), new Array('new WSGWindow().closeDefaultButton(\'' + windowId + '\'); if (document.getElementById(\'' + focusFieldId + '\') != undefined) {document.getElementById(\'' + focusFieldId + '\').focus();}'), false);
};
