
/* detect browser*/
var ns4 = document.layers;
var op5 = (navigator.userAgent.indexOf('Opera 5')!=-1) 
	||(navigator.userAgent.indexOf('Opera/5')!=-1);
var op6 = (navigator.userAgent.indexOf('Opera 6')!=-1) 
	||(navigator.userAgent.indexOf('Opera/6')!=-1);
var agt=navigator.userAgent.toLowerCase();
var mac = (agt.indexOf('mac')!=-1);
var ie = (agt.indexOf('msie') != -1); 
var mac_ie = mac && ie;

// JavaScript Document 
function ShowPopup(ChapterID, ChapterIDMain, ArticleID)
  {
  var defw = null;

  if (isNaN(ChapterIDMain)) { ChapterIDMain = 1; }
  if (isNaN(ArticleID)) { ArticleID = 0; }
	
  args = "width=500," 
    + "height=700," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=20,"  //NN Only
    + "screeny=20,"  //NN Only
    + "left=20,"	 //IE Only
    + "top=20"       //IE Only

    if ((ArticleID=="") || (ArticleID==null))
		{
		defw = window.open("http://www.europagaai.com/main.asp?onPopup=1&httpref=www.europagaai.com&ChapterID="+ChapterID+"&ChapterIDMain="+ChapterIDMain+"&ArticleID="+0,"",args);
		}
	else
		{
		defw = window.open("http://www.europagaai.com/main.asp?onPopup=1&httpref=www.europagaai.com&ChapterID="+ChapterID+"&ChapterIDMain="+ChapterIDMain+"&ArticleID="+ArticleID,"",args);
		}
		
		
	// add resizeTo for aanvraag formulier : YG 05-07-2006
	if(typeof window.onload != 'function')
	{
		setTimeout(''+defw.resizeTo(790,700)+'',250);
	}
	else
	{
			defw.onload = function(){
				 	var contentWidth = defw.document.body.clientWidth;
					defw.resizeTo(contentWidth,700);
			}
	}
	
	//defw.focus();
 }

/* Searchpart */
function validateForm(form)
  {
  var ErrorMsg = "";
  if (form.searchquery.value == "") {ErrorMsg = "Please specify a search query";}


//  if (form.searchquery.value.match(/(@|#|$|%|^|&|*)/g)) {ErrorMsg = "Please, don't use special Characters.";}
  if (ErrorMsg != "")
    {
    alert(ErrorMsg)
    return false;
    }
  else
    {
    return true;
    }
  }
/* email-address check*/ 
function EmailValid(mailfield) {
   var emailPat = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
   var matchArray = mailfield.match(emailPat);
   if (matchArray == null) { return false;} else {return true;} }

/* function: ValidateStringValue */
function ValidateStringValue(stringVal, allowEmpty, MaxLen, fieldName, testDoubleQuote) {
if ( (allowEmpty!=false) && (allowEmpty!=true) ) { allowEmpty = true; }
if (testDoubleQuote=="") {testDoubleQuote = false; }
if (stringVal.length==0) { if (!allowEmpty) { return "U heeft niet ingevuld bij '" + fieldName + "'"; }else {return;} }
else {
  if ((testDoubleQuote) && (stringVal.indexOf("\"")!=-1)) { return "U kunt geen dubbele aanhalingstekens (\") gebruiken in '" +fieldName + "'." }
  if ((!isNaN(MaxLen)) && (MaxLen!=0) && (stringVal.length > MaxLen)) {return "De tekst bij '" +fieldName + "' is te lang." }}
  return;
  }


/* function: getReferenceHeight */
/* return max available height*/
function getReferenceHeight() {
  var myHeight = 0;
  if( typeof( window.innerHeight) == 'number' ) { myHeight = window.innerHeight; } //Non-IE
  else if( document.documentElement && ( document.documentElement.clientHeight ) ) {myHeight = document.documentElement.clientHeight;} //IE 6+ in 'standards compliant mode'
  else if( document.body && ( document.body.clientHeight ) ) { myHeight = document.body.clientHeight; }   //IE 4 compatible
  return myHeight;
}

/* function: getReferenceWidth */
/* return max available Width*/
function getReferenceWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth) == 'number' ) { myWidth = window.innerWidth; } //Non-IE
  else if( document.documentElement && ( document.documentElement.clientWidth ) ) {myWidth = document.documentElement.clientWidth;} //IE 6+ in 'standards compliant mode'
  else if( document.body && ( document.body.clientWidth ) ) { myWidth = document.body.clientWidth; }   //IE 4 compatible
  return myWidth;
}
//No custom scripts
