  // MobilePower Web Site methods - Ben Jay May 2003 
  var siteTag = 'au1'; 
 
  // include urchin web analysis: 
  document.write('<script src="/' + siteTag + '/__utm.js"></script>'); 
 
 
  // #########################################################/ 
  // check the email address is reasonable: 
 
  function checkEmail(email) 
  { 
    if(!isValidEmail(email)) 
    { 
      alert('The email address is invalid.\n It should be similar to:\n\n yourname@yourcompany.com\n\nWith no spaces. Please enter it again.'); 
      return false; 
    } 
    return true; 
  } 
 
  // #########################################################/ 
  // check the email address is reasonable: 
 
  function isValidEmail(email) 
  { 
    if(isblank(email)) 
      return false; 
 
    email = email.toLowerCase(); 
 
    //  check for one '@': 
    var sections = email.split('@'); 
    if(sections.length != 2) 
      return false; 
 
    // now split into sections on '.': 
    var username = sections[0].split('.'); 
    var domain = sections[1].split('.'); 
    if(domain.length < 2) 
      return false; 
 
    // check the username: 
    for(var i = 0; i < username.length; i++) 
      if(!isValidEmailSection(username[i])) 
        return false; 
 
    // check the domain: 
    for(var i = 0; i < domain.length; i++) 
      if(!isValidEmailSection(domain[i])) 
        return false; 
 
    return true; 
  } 
 
  // #########################################################/ 
  // check this section of an email address is valid 
  // a-z 0-9 - . _ 
 
  function isValidEmailSection(sec) 
  { 
    if(sec.length < 1) 
      return false; 
 
    for(var i = 0; i < sec.length; i++) 
    { 
      var cc = sec.charCodeAt(i); 
      if( ((cc < 97) || (cc > 122)) && 
          ((cc < 48) || (cc > 57)) && 
          ((cc < 45) || (cc > 46)) && 
          (cc != 95) ) 
  	  return false; 
    } 
    return true; 
  } 
 
  // #########################################################/ 
 
  function showCountryList(start, selected) 
  { 
    document.writeln('<SELECT ' + start + '>'); 
 
    var countries = [ 'AU','Australia',
'NZ','New Zealand' ]; 
 
    for(var i = 0; i < countries.length; i = i+2) 
    { 
      var html = '<OPTION value="' + countries[i] + '"'; 
      if(countries[i] == selected) 
        html += ' selected'; 
      html += '>' + countries[i+1] + '</OPTION>'; 
      document.writeln(html); 
    } 
    document.writeln('</SELECT>'); 
  } 
 
  // #########################################################/ 
 
  function showYearList(start, selected, full) 
  { 
//    var currentYear = 2004;  
    var currentYear = (new Date()).getFullYear(); 
 
    document.writeln('<SELECT ' + start + '>'); 
    var maxYear = currentYear + 10; 
    if(full) 
    { 
      maxYear = currentYear + 1; 
      currentYear = currentYear - 5; 
      if(selected == ' ') 
        document.writeln('<OPTION value=" " selected> </OPTION>'); 
      else 
        document.writeln('<OPTION value=" "> </OPTION>'); 
    } 
 
    for(var i = currentYear; i < maxYear; i++) 
    { 
      var html = '<OPTION value="' + i + '"'; 
      if(i == selected) 
        html += ' selected'; 
      html += '>' + i + '</OPTION>'; 
      document.writeln(html); 
    } 
    document.writeln('</SELECT>'); 
  } 
 
  // #########################################################/ 
 
  function showMonthList(start, selected, full) 
  { 
    document.writeln('<SELECT ' + start + '>'); 
 
    var list = [' ',' ', '01','01', '02','02', '03','03', '04','04', '05','05', '06','06', '07','07', '08','08', '09','09', '10','10', '11','11', '12','12']; 
    var start = 2; 
    var end = list.length -2; 
    if(full) 
      start = start - 2; 
 
    for(var i = start; i <= end; i = i+2) 
    { 
      var html = '<OPTION value="' + list[i] + '"'; 
      if(list[i] == selected) 
        html += ' selected'; 
      html += '>' + list[i+1] + '</OPTION>'; 
      document.writeln(html); 
    } 
    document.writeln('</SELECT>'); 
  } 
 
  // #########################################################/ 
  // function call, embedded within notes etc in the database: 
 
  function pl(linkOb, linkValue) 
  { 
    linkOb.href='/au1/e/Page.Filler?_page=b/plink&ps=' + linkValue; 
  } 
 
  // #########################################################/ 
  // if a number ends with .0, remove it 
 
  function trimdp(str) 
  { 
    if(str.lastIndexOf('.0') == str.length -2) 
      str = str.substring(0, str.length -2); 
 
    document.write(str); 
  } 
 
  // #########################################################/ 
 
  function magnitude(str) 
  { 
    num = str.valueOf(); 
 
    if(num > 999) 
    { 
      num = num / 1000; 
      str = num.toString() + "K"; 
    } 
    else if(num > 999999) 
    { 
      num = num / 1000000; 
      str = num.toString() + "M"; 
    } 
 
    document.write(str); 
  } 
 
  // #########################################################/ 
  // check there is a value: 
 
  function isblank(str) 
  { 
    for(var i = 0; i < str.length; i++) 
    { 
      var ch = str.charAt(i); 
      if((ch != ' ') && (ch != '\n') && (ch != '\t')) 
        return false; 
    } 
    return true; 
  } 
 
  // #########################################################/ 
  // check there is a value: 
 
  function validCardNo(val, min, max) 
  { 
    var count = 0; 
    for(var i = 0; i < val.length; i++) 
    { 
      var ch = val.charAt(i); 
      if((ch == '0') || (ch == '1')|| (ch == '2') || (ch == '3') || (ch == '4') ||  
         (ch == '5') || (ch == '6') || (ch == '7') || (ch == '8') || (ch == '9')) 
        count++; 
      else if(ch != ' ') 
        return false; 
    } 
 
    if((count.valueOf() < min) || ((count.valueOf() > max) && (max > -1))) 
      return false; 
 
    return true; 
  } 
 
  // #########################################################/ 
 
  function showHelp(helpTopic) 
  { 
    var win = window.open('/' + siteTag + '/e/Page.Filler?_page=help/' + helpTopic, '_help','status=no,menubar=no,toolbar=no,resizable=yes,scrollbars=yes, width=650, height=400'); 
    win.focus(); 
    return false; 
  } 
 
  // #########################################################/ 
 
  function stockMessage(level, order, central) 
  { 
    if(level > 0) 
      document.write('In Stock'); 
    else if(order > 0) 
      document.write('On Order'); 
    else if(central > 0) 
      document.write('On Request<BR>(8 Days)'); 
    else 
      document.write('Order On Request'); 
  } 
 
  // #########################################################/ 
 
  function report(ob) 
  { 
    reportN(ob, 20); 
  } 
 
  // #########################################################/ 
 
  function reportN(ob, num) 
  { 
    mes = ''; 
    i = 0; 
    for(a in ob) 
    { 
      mes += "[" + a + " : " + ob[a] + "]\n"; 
      i++; 
      if(i > num) 
      { 
        alert(mes); 
        i = 0; 
        mes = ""; 
      } 
    } 
    alert(mes); 
  } 
 
  // #########################################################/ 
 
  function writePromo(wrap) 
  { 
    var imageSrc=' '; 
    var imageAlt='Long Life External Universal Laptop Battery'; 
    var imageLink='/au1/b/ubp0767b.html'; 
 
    if(imageSrc.length > 1) 
    { 
      var span = ''; 
      if(wrap) 
  	span=' colspan="2"'; 
      document.writeln('          <TR>'); 
      document.write('            <TD valign="top"' + span + '>'); 
      if(imageLink != '') 
        document.write('<A href="' + imageLink + '">'); 
      document.write('<IMG src="/au1/i/promo/' + imageSrc + '" height="61" width="200" border="0" alt="' + imageAlt + '">'); 
      if(imageLink != '') 
        document.write('</A>'); 
      document.writeln('</TD>'); 
      document.writeln('          </TR>'); 
    } 
  } 
 
  // #########################################################/ 
 
  function writeBsi() 
  { 
    var src = ' '; 
    if(src.length > 1) 
      document.writeln('<br><img style="float: right; margin-right: 20px;" src="/au1/i/logos/' + src + '>'); 
  } 
 
  // #########################################################/ 

