﻿// JScript-Datei

function openPopupUnternehmensgruppe()
{
    var popupUnternehmensgruppe = window.open("http://www.nestle.de/corporate/Templates/Pages/unternehmensgruppe.html","unternehmensgruppePopup","width=355,height=370,resizable=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no");
    popupUnternehmensgruppe.focus();
}

function popWindow (url,name,params) {
    pwin=window.open(url, name, params);
    pwin.focus();
    return false;
} 

function getDivHeight(teaserId, contentId)
{
	if (teaserId != null && contentId != null)
	{
		var mainContent = document.getElementById(contentId).offsetHeight;
		var teaserheight = mainContent + 'px';
		document.getElementById(teaserId).style.height = teaserheight;
		document.getElementById(contentId).style.height = teaserheight;
	}
}

function ClientTestBodyLength(oSrc,eDiv,ev)
{
  if(oSrc)
  {
		var realContent = oSrc.value.replace(/\n/g,'');
		var errorDiv = document.getElementById(eDiv);
		var maxLength = 199;
		if((ev.charCode > 0) || (ev.keyCode > 32))
		{
			maxLength = 198;
		}
		if(ev.keyCode == 8)
		{
			maxLength = 200;
		}
		if(realContent.length >= maxLength)
		{
			if((ev.keyCode != 8) && (ev.keyCode != 46))
			{
				if(! ev.preventDefault)
				{
				  ev.returnValue = false;
				}
				else
				{
					ev.preventDefault();	
				}
				errorDiv.style.visibility = 'visible';
			}
		}
		if(realContent.length > maxLength)
     {   
       errorDiv.style.visibility = 'visible';
     }
     else
     {
				errorDiv.style.visibility = 'hidden';
				return true;
     }
  }
}