	    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
     
       
       function messages(intTipoMessage, strMessage, objDivControl)
       {
            this.message = strMessage;
            this.showMessage = messages.showMessage(intTipoMessage, strMessage, objDivControl)
            
       }

		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
     
       messages.showMessage = messages_showMessage; 
       function messages_showMessage(intTipoMessage, strMessage, objDivControl)
       {
       var strHTMLMessage = "";
       if(objDivControl)
	   {
            switch(intTipoMessage)
            {
                case 0: //SI ESTA OK
                    strHTMLMessage = getHTMLMessageOK(strMessage, objDivControl.id);     
                    break;
                case 1: // SI ES ERROR
                    strHTMLMessage = getHTMLErrorCLIENT(strMessage, objDivControl.id);     
                    break;   
                case 2: // SI ES LOADING
                     strHTMLMessage = getLoading(strMessage);    
                    break;   
                default: // EN OTRO CASO
                    strHTMLMessage = "";     
                    break;
            }
	
            	objDivControl.innerHTML = strHTMLMessage;
		}
				
       }
       
       /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
      
       function getHTMLMessageOK(strMessage, strDiv)
       {
       
            var strHTML="";
                strHTML+= '<!-- mensaje de error-->' +
							'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
										'<tr class="tr5">'+
										  '<td width="5">&nbsp;</td>'+
										  '<td>&nbsp;</td>'+
										  '<td width="5">&nbsp;</td>'+
										'</tr>'+
										'<tr>'+
										  '<td width="5">&nbsp;</td>'+
										  '<td><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
											  '<tr>'+
												'<td><table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">'+
													'<tr class="tr5">'+
													  '<td width="4" align="left" valign="top"><img src="/images/messageOkLeftTop.gif" /></td>'+
													  '<td valign="top"><img src="/images/messageOkLineHorizontal.gif" width="100%" height="1" /></td>'+
													  '<td width="4" align="right" valign="top"><img src="/images/messageOkRightTop.gif" /></td>'+
													'</tr>'+
												'</table></td>'+
											  '</tr>'+
											  '<tr>'+
												'<td><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
													'<tr>'+
													  '<td width="1" background="/images/messageOkLineVertical.gif"><img src="/images/messageOkLineVertical.gif" width="1" height="5" /></td>'+
													  '<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
														  '<tr>'+
															'<td width="6">&nbsp;</td>'+
															'<td width="25" valign="top"><img src="/images/OKmessage.gif" hspace="5" vspace="5" /></td>'+
															'<td class="cssItext">' + strMessage + '</td>'+
															'<td width="10" align="right" valign="top"><a href="javascript:closeMessage(0,\'' + strDiv + '\');">'+
															  '<img src="/images/CerrarVentana.gif" width="10" height="9" hspace="5" vspace="5" border="0" />'+
															'</a>'+
															'</td>'+
														  '</tr>'+
													  '</table></td>'+
													  '<td width="1" align="right" background="/images/messageOkLineVertical.gif"><img src="/images/messageOkLineVertical.gif" width="1"/></td>'+
													'</tr>'+
												'</table></td>'+
											  '</tr>'+
											  '<tr>'+
												'<td valign="top"><table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">'+
													'<tr class="tr5">'+
													  '<td width="4" align="left" valign="top"><img src="/images/messageOkLeftDown.gif" width="7" height="8" /></td>'+
													  '<td valign="baseline"><img src="/images/messageOkLineHorizontal.gif" width="100%" height="1" /></td>'+
													  '<td width="4" align="right" valign="top"><img src="/images/messageOkRightDown.gif" width="7" height="8" /></td>'+
													'</tr>'+
												'</table></td>'+
											  '</tr>'+
										  '</table></td>'+
										  '<td width="5">&nbsp;</td>'+
										'</tr>'+
										'<tr class="tr5">'+
										  '<td width="5">&nbsp;</td>'+
										  '<td>&nbsp;</td>'+
										  '<td width="5">&nbsp;</td>'+
										'</tr>'+
									  '</table>'+
									'<!-- end mensaje error-->';
                return strHTML;
       }
      
       /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
       function getHTMLErrorCLIENT(strMessage, strDiv)
       {
       var strHTML="";
                strHTML += '<!-- mensaje de error-->'+
							'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
                                '<tr class="tr5">'+
                                  '<td width="5">&nbsp;</td>'+
                                  '<td>&nbsp;</td>'+
                                  '<td width="5">&nbsp;</td>'+
                            '</tr>'+
                                '<tr>'+
                                  '<td width="5">&nbsp;</td>'+
                                  '<td><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
                                    '<tr>'+
                                      '<td><table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">'+
                                        '<tr class="tr5">'+
                                          '<td width="4" align="left" valign="top"><img src="/images/messageErrorLeftTop.gif" /></td>'+
                                          '<td valign="top"><img src="/images/messageErrorLine.gif" width="100%" height="1" /></td>'+
                                          '<td width="4" align="right" valign="top"><img src="/images/messageErrorRightTop.gif" /></td>'+
                                        '</tr>'+
                                      '</table></td>'+
                                    '</tr>'+
                                    '<tr>'+
                                      '<td><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
                                        '<tr>'+
                                          '<td width="1" background="/images/messageErrorVerticalLine.gif"><img src="/images/messageErrorVerticalLine.gif" width="1" /></td>'+
                                          '<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
                                            '<tr>'+
                                              '<td width="20" valign="top"><img src="/images/ErrorPeq.gif" width="16" height="16" hspace="5" vspace="5" /></td>'+
                                              '<td class="cssItext">' + strMessage + '</td>'+
                                              '<td width="5" valign="top"><a href="javascript:closeMessage(0, \''+ strDiv +'\');">'+
                                                '<img src="/images/CerrarVentana.gif" hspace="5" vspace="5" border="0" />'+
                                              '</a>'+
                                              '</td>'+
                                            '</tr>'+
                                          '</table></td>'+
                                          '<td width="1" align="right" background="/images/messageErrorVerticalLine.gif"><img src="/images/messageErrorVerticalLine.gif" width="1"/></td>'+
                                        '</tr>'+
                                      '</table></td>'+
                                    '</tr>'+
                                    '<tr>'+
                                      '<td valign="top"><table width="100%" height="5" border="0" cellpadding="0" cellspacing="0">'+
                                        '<tr class="tr5">'+
                                          '<td width="4" align="left" valign="top"><img src="/images/messageErrorLeftDown.gif" /></td>'+
                                          '<td valign="baseline"><img src="/images/messageErrorLine.gif" width="100%" height="1" /></td>'+
                                          '<td width="4" align="right" valign="top"><img src="/images/messageErrorRightDown.gif" /></td>'+
                                        '</tr>'+
                                      '</table></td>'+
                                    '</tr>'+
                                  '</table></td>'+
                                  '<td width="5">&nbsp;</td>'+
                            '</tr>'+
                                '<tr class="tr5">'+
                                  '<td width="5">&nbsp;</td>'+
                                  '<td>&nbsp;</td>'+
                                  '<td width="5">&nbsp;</td>'+
                            '</tr>'+
                              '</table>'+
							         '<!-- end mensaje error-->';
            return strHTML;
       }

		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
	   function closeMessage(intEstado, strDiv)
	   {
			if(this.document.getElementById(strDiv))
			{
				var objDiv = this.document.getElementById(strDiv);
		   		switch(intEstado)
		   		{
			   		case 0:
			   			objDiv.innerHTML = '';
			   		break;
			   	}
			}
	   }

		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
	   
	   function getLoading(strMessage)
	   {
		var strHTML = '';
			if(strMessage=='')
			{
				strMessage = 'Cargando';
			}
			strHTML = '<img border="0" src="/images/loading.gif"> <font class="cssItext">' + strMessage + '</font>';
		return strHTML;
	   }
	  
	  
		function displaySoluciones()
		{
			var strHTML ='';
			var objLyrSoluciones = this.document.getElementById('lyr_soluciones');
			var objLyrConteiner = this.document.getElementById('_solucionesConteiner');
			var idEstado;
				if(objLyrConteiner.innerHTML=='')
				{
					idEstado = 1;
				}
				else
				{
					idEstado = 0;
				}
			switch(idEstado)
			{
				case 0:
					strHTML = '';
					//objLyrSoluciones.style.z-index=1;
					//objLyrConteiner.style.height=40;
					objLyrConteiner.style.display = 'none';	
					//objLyrConteiner.style.height=0;
				break;
				
				case 1:
					strHTML = '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#2C82C0">'+
						'<tr>'+
						  '<td width="5">&nbsp;</td>'+
						  '<td><table width="100%" border="0" cellspacing="0" cellpadding="0">'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/soluciones.aspx" class="cssHeaderMenu">Nuestros Productos</a></td>'+
							'</tr>'+	
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+					
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/solucionesSMS/smsConnector.aspx" class="cssHeaderMenu">SMS Connector</a> </td>'+
							'</tr>'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/solucionesSMS/smsVision.aspx" class="cssHeaderMenu">SMS Vision </a></td>'+
							'</tr>'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/solucionesSMS/smsEnterprise.aspx" class="cssHeaderMenu">SMS Enterprise </a></td>'+
							'</tr>'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/solucionesSMS/solucionesMobile.aspx" class="cssHeaderMenu">Soluciones Mobile</a></td>'+
							'</tr>'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
							'<tr>'+
							  '<td height="25"><img src="/images/bullet.gif" width="13" height="8" border="0" /> <a href="/solucionesSMS/smsWeb.aspx" class="cssHeaderMenu">SMS Web</a></td>'+
							'</tr>'+
							'<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+									
						  '</table></td>'+
						  '<td width="5">&nbsp;</td>'+
						'</tr>'+
						 '<tr class="tr5">'+
							  '<td>&nbsp;</td>'+
							'</tr>'+
					  '</table>';
					objLyrConteiner.style.height=160;
					objLyrConteiner.style.display = 'inline';
					//objLyrConteiner.style.height=160;
				break;
			}
			objLyrConteiner.innerHTML = strHTML;
		}


		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
	

        function replaceSubstring(inputString, fromString, toString) 
		{
		   var temp = inputString;
		   if (fromString == "") {
			  return inputString;
		   }
		   if (toString.indexOf(fromString) == -1) { 
			  while (temp.indexOf(fromString) != -1) {
				 var toTheLeft = temp.substring(0, temp.indexOf(fromString));
				 var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
				 temp = toTheLeft + toString + toTheRight;
		   }
		   } else {
			  var midStrings = new Array("~", "`", "_", "^", "#");
			  var midStringLen = 1;
			  var midString = "";
			  while (midString == "") {
				 for (var i=0; i < midStrings.length; i++) {
					var tempMidString = "";
					for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
					if (fromString.indexOf(tempMidString) == -1) {
					   midString = tempMidString;
					   i = midStrings.length + 1;
					}
				 }
			  } 
			  while (temp.indexOf(fromString) != -1) {
				 var toTheLeft = temp.substring(0, temp.indexOf(fromString));
				 var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
				 temp = toTheLeft + midString + toTheRight;
			  }
			  while (temp.indexOf(midString) != -1) {
				var toTheLeft = temp.substring(0, temp.indexOf(midString));
				var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
				temp = toTheLeft + toString + toTheRight;
				}
				}
			  return temp; 
				}
