function WindowOpenSendFisicalPoints(pointsValue, trackingNumber, orderId)
{
   var w = 800, h = 600;
   if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
   }
   var popW = 730, popH = 900;
   var leftPos = (w-popW)/2, topPos = (h-popH)/2;
   
   var add = '';
   
   if(pointsValue != null)
   {
      if(add == '')
         add = add + '?';
      else
         add = add + '&';
                  
      add = add + 'points=' + pointsValue;
   }

   if(trackingNumber != null)
   {
      if(add == '')
         add = add + '?';
      else
         add = add + '&';
                  
      add = add + 'trackingnumber=' + trackingNumber;
   }
      
   if(orderId != null)
   {
      if(add == '')
         add = add + '?';
      else
         add = add + '&';
                  
      add = add + 'orderid=' + orderId;
   }
   
   window.open('FormOrderAndPoints.aspx' + add , 'name' , 'width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',location=no,toolbar=no,menubar=no,status=no,scrollbars=yes');
}

function WindowOpenPopup(title)
{
   var w = 800, h = 600;
   if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
   }
   var popW = 517, popH = 500;
   var leftPos = (w-popW)/2, topPos = (h-popH)/2;
   
   window.open('popup.aspx?title=' + title , 'information' , 'width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',location=no,toolbar=no,menubar=no,status=no,scrollbars=yes');
}

function realisatie()
{
   var w = 800, h = 600;
   if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
   }
   var popW = 379, popH = 242;
   var leftPos = (w-popW)/2, topPos = (h-popH)/2;
   window.open("http://www.amercom.nl/realisatie/realisatie.html","realisatiepopup","width="+popW+",height="+popH+",top="+topPos+",left="+leftPos+",scrollbars=no");
}

function focusField(firstfield, secondfield) 
{
	if ((document.getElementById(firstfield)!=null) && (document.getElementById(secondfield)!=null))
	{
		if (document.all.item(firstfield).value == '') 
		{
			document.all.item(firstfield).focus();
		}
		else 
		{
			document.all.item(secondfield).focus();
		}
	}
}

function doCheckSocialSecurityNumber(source, arguments)
{
   var IsCorrect = false;
   var TextboxValue = arguments.Value;
   var intTotalValue = 0;
   var intMultiPlyArray = new Array("9","8","7","6","5","4","3","2");

   if(TextboxValue.length == 8)
   {
      TextboxValue = 0 + TextboxValue;
   }
   
   if(TextboxValue.length == 9)
   {
      if(!isNaN(TextboxValue))
      {
         for(var i=0; i<8; i++)
         {
            intTotalValue = parseInt(intTotalValue + parseInt(TextboxValue.substr(i,1) * intMultiPlyArray[i]));
         }
         if(parseInt(intTotalValue % 11) == parseInt(TextboxValue.substr(TextboxValue.length-1,1)))
         {
            IsCorrect = true;
         }
      }
   }  
   arguments.IsValid = IsCorrect;
}

function isIE()
{

	if(navigator.userAgent.toLowerCase().indexOf('msie') > -1)
	{
		return true;
	}
	else
	{
		return false;
	}		
}

function doCheckBankAccount(source, arguments)
{
   var IsCorrect = false;
   var TextboxValue = arguments.Value;
   var intTotalValue = 0;
   var intMultiPlyArray = new Array("9","8","7","6","5","4","3","2","1");

   if(TextboxValue.length > 8 && TextboxValue.length < 11)
   {

      if(TextboxValue.length == 9 || TextboxValue.length == 10)
      {
         if(!isNaN(TextboxValue))
         {
            for(var i=0; i<9; i++)
            {
               intTotalValue = parseInt(intTotalValue + parseInt(TextboxValue.substr(i,1) * intMultiPlyArray[i]));
            }
            if(parseInt(intTotalValue % 11) == parseInt(TextboxValue.substr(TextboxValue.length-1,1)))
            {
               IsCorrect = true;
            }
         }
      }

   }
   else
   {
      if(TextboxValue.length < 9)
      {
         //POSTBANK
         IsCorrect = true;
      }
      else
      {
         IsCorrect = false;
      }
   }
   arguments.IsValid = IsCorrect;
}

function doCheckEmail(strTextBoxId){
   Email = document.getElementById(strTextBoxId).value;
   
   if(Email != "")
   {
      
	   var re = new RegExp("^[A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)*[@][A-Za-z0-9-][A-Za-z0-9-]+([.-][A-Za-z0-9-]+)*[.]([A-Za-z]){2,6}$");
	   if (Email != "") {
		   if (!re.test(Email)) {
		      alert('Je hebt geen geldig e-mailadres opgegeven');
			   return false;
		   }
		   else {
			   return true;
		   }
	   }
	}
	else
	{
	   alert('Je hebt geen e-mailadres opgegeven');
	   return false;
	}
}

function EnterPressed(objEvent, controlToPostBack)
{

    if((objEvent.which && objEvent.which == 13) || (objEvent.keyCode && objEvent.keyCode == 13))
    {
      __doPostBack(controlToPostBack, '');
      return false;
    } else
    {
      return true;
    }
}

function EnterPressedOrNumericInput(objEvent, controlToPostBack)
{
   var charCode = (objEvent.which) ? objEvent.which : objEvent.keyCode
   if((charCode == 13))
   {
      __doPostBack(controlToPostBack, '');
      return false;
   }
   else
   {
      return FilterNonNumericInput(objEvent);
   }
}  

function FilterNonNumericInput(objEvent)
{
	var charCode = (objEvent.which) ? objEvent.which : objEvent.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function EnterPressedOptions(objEvent, eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit)
{

    if((objEvent.which && objEvent.which == 13) || (objEvent.keyCode && objEvent.keyCode == 13))
    {
      WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit));
      return false;
    } else
    {
      return true;
    }
}  

var objMenuCountry = null, objMenuLanguage = null, objNavigation = null;
function doPulldownShow(strMenuID) {

	if(document.getElementById(strMenuID).style.display!='block')
	{
		clearTimeout(objMenuCountry);
		clearTimeout(objMenuLanguage);
		clearTimeout(objNavigation);
		
		if (strMenuID == 'lyrChangecountry')
		{
			if(document.getElementById('lyrChangelanguage'))
			{
				document.getElementById('lyrChangelanguage').style.display = 'none';
			}
			if(isBrowserNS6()) document.getElementById('divNavigation').style.visibility = 'hidden';
		}
		if (strMenuID == 'lyrChangelanguage')
		{
			if(document.getElementById('lyrChangecountry'))
			{
				document.getElementById('lyrChangecountry').style.display = 'none';
			}
			if(isBrowserNS6()) document.getElementById('divNavigation').style.visibility = 'hidden';
		}

		document.getElementById(strMenuID).style.display = 'block';	
	}
	else
	{
		document.getElementById(strMenuID).style.display='none';
		if(isBrowserNS6()) document.getElementById('divNavigation').style.visibility = 'visible';
	}
}

function doPulldownHide(strMenuID) {

	if (strMenuID == 'lyrChangecountry')
	{
		objMenuCountry = setTimeout("document.getElementById('lyrChangecountry').style.display = 'none'", 300);
	}
	
	if (strMenuID == 'lyrChangelanguage')
	{
		objMenuLanguage = setTimeout("document.getElementById('lyrChangelanguage').style.display = 'none'", 300);
	}
}

function doHideMenu(strMenuID) {
	document.getElementById(strMenuID).style.display = 'none';
}

var strULname = '';
function doMenuLearnMoreAbout(strModuleID) {
	
	if (document.getElementById('div_' + strModuleID).style.display=='none')
	{
		strULname = 'ul_' + strModuleID;
						
		document.getElementById('div_' + strModuleID).style.display='block';		
		setTimeout("document.getElementById(strULname).className='learnmoreabout-true'", 1);
	}
	else
	{
		strULname = 'ul_' + strModuleID;		
		document.getElementById('div_' + strModuleID).style.display='none';		
		setTimeout("document.getElementById(strULname).className='learnmoreabout-false';", 1);
	}
	
}

// this function gets the cookie, if it exists
function doGetCookie(name) {
	
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;
	if ((!start) && ( name != document.cookie.substring( 0, name.length ) ) )
	{
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}


function doSetCookie(name, value, expires, path, domain, secure) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	// if the expires variable is set, make the correct expires time, the
	// current script below will set it for x number of days, to make it
	// for hours, delete * 24, for minutes, delete * 60 * 24
	
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function doDeleteCookie(name, path, domain) {
	if (doGetCookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function doPositionDivs()
{
	if (document.getElementById('lyrChangecountry') != null) {
		document.getElementById('lyrChangecountry').style.left = 604 + document.getElementById('main').offsetLeft;
	}
	if (document.getElementById('lyrChangelanguage') != null) {
		document.getElementById('lyrChangelanguage').style.left = 604 + document.getElementById('main').offsetLeft;
	}
}

function openWindow(strUrl, strWindowName, astrValues, strOptions, strType)
{
	switch(strType)
	{
		case "modal"	:	window.showModalDialog(strUrl, astrValues, strOptions);
							break;
		case "modeless"	:	window.showModelessDialog(strUrl, astrValues, strOptions);
							break;
		case "normal"	:	window.open(strUrl, strWindowName, strOptions);
							break;
		default			:	window.open(strUrl, strWindowName, strOptions);
							break;
	}
}


function toggleDiv(strDivID)
{
	if(document.getElementById(strDivID).style.display=='none')
	{
		document.getElementById(strDivID).style.display='block';
	}
	else
	{
		document.getElementById(strDivID).style.display='none';
	}
}

function showDiv(strDivID)
{
	document.getElementById(strDivID).style.display='block';
}

function hideDiv(strDivID)
{
	document.getElementById(strDivID).style.display='none';
}

function doShowEnquete()
{
   openWindow("PopUp.aspx?action=enquete", "", "", "", "normal");
}

function showHidePopup(popupReferenceObject, popupDiv, bgDiv, arrHide)
{
   var popup = document.getElementById(popupDiv);
   
   if (popup.style.display == "block" || popup.style.display == "")
   {
      popup.style.display = "none";
      
		if(bgDiv != null)
		{
		   var bg = document.getElementById(bgDiv);
         bg.style.display = "none";
      }
      
      if(arrHide != null && arrHide.length > 0)
      {
         for(var i=0;i<arrHide.length;i=i+1) 
         {
            document.getElementById(arrHide[i]).style.visibility = "visible";
         }
      }
   }
   else
   {
      popup.style.display = "block";
      
      if(popupReferenceObject != null)
      {
         var refobj = document.getElementById(popupReferenceObject);
         
	      var coors = findPos(refobj);
	      popup.style.top = coors[1] + 'px';
	      popup.style.left = coors[0] + 'px';
		}
		
		if(bgDiv != null)
		{
		   var bg = document.getElementById(bgDiv);
         bg.style.display = "block";
      }

      // allways fix the 'popups' to a predefined top position
	  popup.style.top = '38px';
      
      if(arrHide != null && arrHide.length > 0)
      {
         for(var i=0;i<arrHide.length;i=i+1) 
         {
            document.getElementById(arrHide[i]).style.visibility = "hidden";
         }
      }
   }
}

function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function showbg(codediv)
{
   var divje = document.getElementById( codediv );
   if (divje.style.display == "block" || divje.style.display == "")
   {
      divje.style.display = "none";
   }
   else
   {
      divje.style.display = "block";
   }
}


function hidebg(codediv)
{
	document.getElementById(codediv).style.display = "none";
}


function visibilityon(codediv)
{
   var divje = document.getElementById( codediv );
   if (divje.style.visibility == "visible" || divje.style.visibility == "")
   {
      divje.style.visibility = "hidden";
   }
   else
   {
      divje.style.visibility = "visible";
   }
}

function visibilityoff(codediv)
{
	document.getElementById(codediv).style.visibility = "hidden";
}