
/* SUBSCRIBE TO NEWSLETTER POP UP / */
function move_box(an, box) {
  var cleft = 0;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}
var boxdiv;
function show_hide_box(an, width, height, borderStyle) {
  var href = an.href;
  boxdiv = document.getElementById(href);
  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }
  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#fff';
  boxdiv.innerHTML = '<DIV ALIGN="RIGHT"><a href="javascript: document.location.href=document.location.href" style="font: normal 10px verdana, sans-serif; color: #000000;">Close Window</a>&nbsp;&nbsp;</DIV>';
  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;
  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);
  return false;
}

function SendToFriendPopup( URL, Title )
{
  var lov_win = window.open( '/includes/send-to-a-friend.html?p_URL=' + URL + '&p_Title=' + Title, 'Send_To_A_Friend', 
        "width=600,height=400,top=150,left=150,scrollbars=yes,resizable=yes,menubar=no,location=no" );
  lov_win.opener = window;
}

function checkNumeric( input )
{
   var validChars = "0123456789.";
   var isNumber = true;
   var char;

   if( input.length != 16 )
   {
      alert( 'Please enter 16 digits.' );
      document.getElementById( 'Item_27' ).value = "";  // 'Item_27' is used for AAA form only
      isNumber = false;
   } 
   else
   {
      for( i = 0; i < input.length && isNumber == true; i++ ) 
      { 
         char = input.charAt( i ); 
         if( validChars.indexOf( char ) == -1 ) 
         {
            alert( 'Please enter numbers only.' );
            document.getElementById( 'Item_27' ).value = "";  // 'Item_27' is used for AAA form only
            isNumber = false;
         }
      }
   }
   return IsNumber;
}

function checkAlphaNumeric( input )
{
   var numaric = input;

   if( numaric.length != 17 )
   {
      alert( 'Please enter 17 letters and digits.' );
      document.getElementById( 'Item_36' ).value = "";  // 'Item_36' is used for AAA form only
      isNumber = false;
   } 
   else
   {
      for( var j=0; j<numaric.length; j++ )
      {
         var alphaa = numaric.charAt( j );
         var hh = alphaa.charCodeAt( 0 );
         if( ! ( ( hh > 47 && hh<58 ) || ( hh > 64 && hh<91 ) || ( hh > 96 && hh<123 ) ) )
         {
            alert( 'Please enter letters and numbers only.' );
               document.getElementById( 'Item_36' ).value = "";  // 'Item_36' is used for AAA form only
            return false;
         }
      }
   }
   return true;
}


