//
// qAndA-javascript.js
//
// PART 1: Handles <h1> exceptions
var firstH1= new Object;
firstH1= document.getElementsByTagName('H1')[0];
if( firstH1) {
var string;
//
// Offshore company incorporation
//
// offshore-company.html
string= 'Offshore company explained'; // string to look for
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) { // if found, change to
firstH1.innerHTML= 'What is an offshore company?'; // <-- this
//firstH1.innerHTML= '<span style="background-color:orange">Offshore company explained</span><br>' + firstH1.innerHTML;
}
//
// Offshore banking
//
// offshore-banking.html
string= 'Offshore banking benefits'; // string to look for
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) { // if found, change to
firstH1.innerHTML= 'What are the benefits<BR>of offshore banking?'; // <-- this
}
// offshore-banking-haven.html
string= 'Offshore banking haven:<br>Which is the best?';
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) { // caps <BR> for Internet Explorer!
firstH1.innerHTML= 'Which is the best<BR>offshore banking haven?';
}
// offshore-account.html
string= 'Offshore account:<br>What kind do I need?';
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) {
firstH1.innerHTML= 'What kind of offshore<BR>account do I need?';
}
// offshore-numbered-account.html
string= 'Offshore numbered account:<br>What is it?';
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) {
firstH1.innerHTML= 'What is an offshore<BR>numbered account?';
}
// anonymous-bank-account.html
string= 'Anonymous bank account:<br>Can I get one offshore?';
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) {
firstH1.innerHTML= 'Can I get an anonymous<BR>bank account offshore?';
}
// offshore-credit-card.html
string= 'Offshore credit card:<br>How to get one';
if( firstH1.innerHTML.toUpperCase() == string.toUpperCase()) {
firstH1.innerHTML= 'What is an offshore credit card?<BR>How do I get one?';
}
}
// PART 2: Goes through the folowing HTML code...
// <UL id="offshore_bank_accounts">
//   <LI>What are offshore bank accounts?</LI>
//   <LI>Why should I <a href="offshore-bank.html">bank offshore</a>?</LI>
//   <LI>Where are the best <a href="offshore-banks.html">offshore banks</a>?</LI>
//   ...
// </UL>
// and turns all code such as...
// Where are the best <a href="offshore-banks.html">offshore banks</a>?
// into...
// <a href="offshore-banks.html">Where are the best offshore banks?</a>
function qAndALinks( linksBlockID) {
// Pass it the ID of the <UL> block containing the links,
// i.e. call as follows:
// <script language="JavaScript1.2" type="text/javascript" src="/qAndA-javascript.js">
// </script>
// <script language="JavaScript1.2" type="text/javascript">
//   qAndALinks('offshore_bank_account');
// </script>
if( document.getElementById( linksBlockID) ) { // <--important!
var linksUL= new Object;
linksUL= document.getElementById( linksBlockID);
if( linksUL.childNodes) {
var currentLI= new Object;
// For all sub-elements of <UL id="links">
for( var d=0; d<linksUL.childNodes.length; d++) {
currentLI= linksUL.childNodes[d]; // get the <LI> element
if( currentLI.innerHTML) { // <--For Netscape 6 and Opera
if( currentLI.innerHTML.match(/(.*)(\<a +href.*?\>)(.*?)(\<\/a\>)(.*)/i) ) {
currentLI.innerHTML= RegExp.$2 + RegExp.$1 + RegExp.$3 + RegExp.$5 + RegExp.$4;
}
}
}
}
}
}
function checkQuestion() {
// <form action="/cgi-bin/contact.cgi" method="GET" onsubmit="return( checkQuestion())">
if( document.getElementById( 'question').value.match(/\S+/)) {
return( true);
}
else {
alert('Please enter a question, then click Ask.');
return(false)
}
}
// Run this
qAndALinks('offshore_company_incorporation');
qAndALinks('offshore_banking');
qAndALinks('offshore_tax_havens');
