function SubmitWithEnter(Object)
{
   var boton = 0;  
   
   if (event.which)
      boton = event.which; 
      
    if (event.keyCode)
      boton = event.keyCode;  
 
    if (boton == 13)
    {
      /* si ha sido ejecutado desde el login */
      if (Object.id == 'LoginForm_tbUser' || Object.id == 'LoginForm_tbPassword')
      {
        if (document.getElementById('LoginForm_tbUser').value.length > 0 && document.getElementById('LoginForm_tbPassword').value.length > 0)
            __doPostBack('LoginForm$lbLogIn',''); 
       
       return; 
      }
    
     /* si ha sido ejecutado desde la búsqueda */
      if (Object.id == 'SearchPortal1_txtSearch')
      {     
        if (document.getElementById('SearchPortal1_txtSearch').value.length > 0)
           __doPostBack('SearchPortal1$btnSearch',''); 
       
       return; 
      }
    } 
}

function ShowDetails(objId)
{
    var objDivId = objId.substring(0,objId.indexOf("_Button")); 
    
    var objDiv = document.getElementById(objDivId); 
     
    if (objDiv.style.display == 'block')
    {
       objDiv.style.display = "none";     
    }
    else
    {
      objDiv.style.display = "block";     
    }         
}

function ChangeStyle(objId)
{   
    var objDiv = document.getElementById(objId); 
    
    if (objDiv.className=='LinkFile_hover')
		objDiv.setAttribute('className','LinkFile');
	else
		objDiv.setAttribute('className','LinkFile_hover');   
}


function RedirectSubscription(sPostingName)
{
   var sPosting = ''; 
   
   if (sPostingName.length > 0)
   {
      sPosting =  '?PostingName=' + sPostingName;  
   }

  	if (document.all)
	{								  
		var sDLGResult; 
		sDLGResult = window.showModalDialog('/WebApplicationCMS/CustomDialogs/SubscriptionRequired.aspx' + sPosting, document ,'scroll:no;dialogHeight:250px;dialogWidth:410px;edge:sunken;center:Yes;help:No;resizable:No;status:No;');

		if (sDLGResult == 'Accepted') 
		{
				document.location.href = '/es/Home/Registration?EditMode=F2573239-084C-4acf-B57E-096D2557B74F';
		}
		else
		{
				;
		}
	}
	else 											
	   document.location.href = '/WebApplicationCMS/CustomDialogs/SubscriptionRequired.aspx' + sPosting;
}


function CheckText(textarea, maxnum)
{

     if (textarea.value.length > maxnum)
     {
         var oldval = textarea.value; 
         
         textarea.value = oldval.substring(0,maxnum); 
         
         alert('El campo sólo permite ' + maxnum + ' caracteres.');       
     }
}


