
function popWindow(theURL,winName,features) {
  var newWin
  newWin = window.open(theURL,winName,features);
  newWin.focus();
}
 
function IsIE() {
	return (navigator.appName == "Microsoft Internet Explorer")
}

function createCopyright(siteId)	{

  var siteNZ=101;   // NZ & Business Direct
  var gateway = 1;  // GATEWAY
  var bd = 2;       // BUSINESS DIRECT
  var currentDate = new Date();
  var currentYear = currentDate.getFullYear(); 

  siteId=siteId==void(0) ? 0 : siteId; //Check the existense of the parameter

 if (siteId==siteNZ )
  {
   	  document.write('Copyright &copy; 2002 - '+ currentYear +' Air New Zealand Limited.<BR>');
  }
  else	if (siteId== gateway)   
  {
  	  document.write('Copyright &copy; 2002 - '+ currentYear +' Air New Zealand Limited. &nbsp;');
  }
  else
  { 
 	  document.write('Copyright &copy; 2003 - '+ currentYear +' Air New Zealand Limited.<BR>');
  }	  

}

var submitted = false;

function secureSubmit()
{
	if (submitted == false)
	{
		submitted = true;
		return submitted;
	}
	else
	{
		return false;
	}
}


function TextAreaCtl(objTextArea)
{
   this.setControl = TextAreaCtl_setControl;
   this.setMaxLength = TextAreaCtl_setMaxLength;
   this.getValue = TextAreaCtl_getValue;
   this.m_objTextArea = null;
   if(objTextArea != null)
   {
      this.setControl(objTextArea)
   }
   this.m_maxLength = - 1;
   /* define evenhandler */ this.onMaxLengthReached = null;
   
   function TextAreaCtl_setControl(objTextArea)
   {
      this.m_objTextArea = objTextArea;
      this.m_objTextArea.controller = this;
      this.m_objTextArea.onkeypress = TextAreaCtl_onKeyPress;
      this.m_objTextArea.onpaste = TextAreaCtl_onPaste;
   }
   
   function TextAreaCtl_setMaxLength(lngMaxLength)
   {
      this.m_maxLength = lngMaxLength;
   }
   
   function TextAreaCtl_getValue()
   {
      return(this.m_maxLength != - 1) ? this.m_objTextArea.value.substring(0, this.m_maxLength) : this.m_objTextArea.value;
   }
   
   function TextAreaCtl_onKeyPress(objEvent)
   {
      // exec 
      if((this.value.length >= this.controller.m_maxLength) &&(this.controller.m_maxLength != - 1))
      {
         if(this.value.length > this.controller.m_maxLength)
         {
            this.value = this.value.substring(0, this.controller.m_maxLength);
         }
         if(this.controller.onMaxLengthReached != null)
         {
            this.controller.onMaxLengthReached(objEvent);
            return false;
         }
         else 
         {
            return false;
         }
      }
   }
   
   function TextAreaCtl_onPaste(objEvent)
   {
      // exec 
      var pasteText = window.clipboardData.getData("Text");	
      
      if((this.value.length + pasteText.length >= this.controller.m_maxLength) &&(this.controller.m_maxLength != - 1))
      {
         if(this.value.length + pasteText.length > this.controller.m_maxLength)
         {
            window.clipboardData.setData("Text",pasteText.substring(0,this.controller.m_maxLength - this.value.length));
	         if(this.controller.onMaxLengthReached != null)
	         {
	            this.controller.onMaxLengthReached(objEvent);
	            return false;
	         }
	         else 
	         {
	            return false;
	         }
         }                              
      }
   }         
}  