// JavaScript Document
//	var TRACE = true; // Falsify in PRoduction!!!!!!!!!!!!
	var TRACE = false; // Falsify in PRoduction!!!!!!!!!!!!

	var theamp = "&#64;";
	var thedot = "&#46;";
	var POCDdomain = "POCD" + thedot + "com" + thedot + "au";
	var POCDNZdomain = "POCD" + thedot + "co" + thedot + "nz";
	var POCDinfoeaddress = "info"  + theamp + POCDdomain;
	var POCDNZeaddress = "adminz"  + theamp + POCDNZdomain;
	var saleseaddress = "sales" + theamp + POCDdomain;


	function quotebutton ( subjectin, salutationin, firstnamein, lastnamein, useridin, sitedomainin) {
		additionforSpecificDomain = '';
		if ( NZsite ) additionforSpecificDomain = 'NZ';
		if ( LOCALsite ) additionforSpecificDomain = 'MP';
		subject = document.title;
		if ( typeof subjectin !== undefined ) subject =  subjectin;
		subject = subject.replace('POCD','');
		salutation = 'Dear';
		if ( typeof salutationin !== undefined ) salutation = salutationin;
		firstname = 'POCD' + additionforSpecificDomain;
		if ( typeof firstnamein !== undefined ) firstname = firstnamein;
		lastname = '';
		if ( typeof lastnamein !== undefined ) lastname = lastnamein;
		userid = 'admin';
		if ( typeof useridin !== undefined ) userid = useridin;
		sitedomain = '';
		if ( typeof sitedomainin !== undefined ) sitedomain = sitedomainin;
		article = " a ";
		firstletter = subject.substring(0,1);	// get first letter of subject
		if ( isVowelRegEx(firstletter)) article = " an ";
		title = 'Open an email message to let us know you want a quotation on' + article  + subject;
		document.write ('<a href="mailto:' + salutation + ' ' + firstname + ' ' + lastname + '  <' + userid);
		document.write ('@');
		document.write (sitedomain + '>?subject=POCD' + additionforSpecificDomain + ' quote request: '); 
		document.write ( subject + '&body= Dear ' + firstname + ',  I would like a quote on '  + subject + ' please">');
		document.write ('<img src="img/gui/pocd_quotebutton.gif" width="144" height="30" border="0" alt="Open an email message to let us know you want a quotation on' + article  + subject + '" title="' + title + '"></a>');
		return;
	}
	
	
	function demobutton ( subjectin, salutationin, firstnamein, lastnamein, useridin, sitedomainin) {
		additionforSpecificDomain = '';
		if ( !NZsite ) { //	only allow for Australian Site
			if ( LOCALsite ) additionforSpecificDomain = 'MP';
			subject = document.title;
			if ( typeof subjectin !== undefined ) subject =  subjectin;
			subject = subject.replace('POCD','');
			salutation = 'Dear';
			if ( typeof salutationin !== undefined ) salutation = salutationin;
			firstname = 'POCD' + additionforSpecificDomain;
			if ( typeof firstnamein !== undefined ) firstname = firstnamein;
			lastname = '';
			if ( typeof lastnamein !== undefined ) lastname = lastnamein;
			userid = 'admin';
			if ( typeof useridin !== undefined ) userid = useridin;
			sitedomain = '';
			if ( typeof sitedomainin !== undefined ) sitedomain = sitedomainin;
			article = " a ";
			firstletter = subject.substring(0,1);	// get first letter of subject
			if ( isVowelRegEx(firstletter)) article = " an ";
			title = 'Open an email message to let us know you want a demonstration of'  + article  + subject;
			document.write ('<a href="mailto:' + salutation + ' ' + firstname + ' ' + lastname + '  <' + userid);
			document.write ('@');
			document.write (sitedomain + '>?subject=POCD' + additionforSpecificDomain + ' demonstration request: '); 
			document.write ( subject + '&body= Dear ' + firstname + ',  I would like an obligation-free demonstration of '  + subject + ' please">');
			document.write ('<img src="img/gui/pocd_demobutton.gif" width="144" height="30" border="0" alt="Open an email message to let us know you want an obligation-free demonstration of' + article  + subject + '" title="' + title + '"></a>');
		} // END OFif ( !NZsite ) { //	only allow for Australian Site
		return;
	}

	function emailink ( subjectin, classin) {
		subject = document.title;
		if ( typeof subjectin !== undefined ) subject =  subjectin;
		subject = subject.replace('POCD','');
		document.write ('<a');
		if ( typeof classin !== undefined ) document.write (' class="' + classin + '"');
		document.write (' href="mailto:admin');
		document.write ('@');
		document.write ('POCD.com.au?subject=POCD: ' + subject + '"');
		document.write ('>email POCD</a>');
		return;
	}	
	function showeaddress ( user, displayclass ) {
		var useclass = true;
		if(!displayclass)  { //no class specified so dont use span.
			if (displayclass=="none") { // specifically do not use class
				useclass = false;
			}
		}
		if (useclass ) {
			document.write ('<span class="' + displayclass + '">');
		}
		document.write ( user +  theamp + POCDdomain );
		if (useclass ) {
			document.write ('</span>');
		}
		return true;
	}

	function emailinkNZ ( subjectin, classin) {
		subject = document.title;
		if ( typeof subjectin !== undefined ) subject =  subjectin;
		subject = subject.replace('POCD','');
		document.write ('<a');
		if ( typeof classin !== undefined ) document.write (' class="' + classin + '"');
		document.write (' href="mailto:adminz');
		document.write ('@');
		document.write ('pocd.co.nz?subject=POCD NZ: ' + subject + '"');
		document.write ('>email POCD New Zealand</a>');
		return;
	}
	function showeaddressNZ ( user, displayclass ) {
		var useclass = true;
		if(!displayclass)  { //no class specified so dont use span.
			if (displayclass=="none") { // specifically do not use class
				useclass = false;
			}
		}
		if (useclass ) {
			document.write ('<span class="' + displayclass + '">');
		}
		document.write ( user +  theamp + POCDNZdomain );
		if (useclass ) {
			document.write ('</span>');
		}
		return true;
	}
	
	function hideDiv( divid) { 
		if (TRACE)window.alert ("hiding div " + divid);
		if ( document.all ) eval( "document.all." + divid + ".style.display = 'none'"); //IS IE 4 or 5 (or 6 beta) 
		if ( document.layers ) document.layers[divid].display = 'none'; //IS NETSCAPE 4 or below 
		if (TRACE) window.alert ( "document.getElementById(" + divid + ").style.display (" +  document.getElementById(divid).style.display + ") being set to 'none'");
		if ( document.getElementById && !document.all ) document.getElementById(divid).style.display = 'none'; //everything else
	}	// END function hideDiv
		
	function showDiv( divid) { 
		if (TRACE)window.alert ("showing div " + divid);
		if (document.all)  eval( "document.all." + divid + ".style.display = 'block'");  //IS IE 4 or 5 (or 6 beta) 
		if (document.layers) document.layers[divid].display = 'block';  //IS NETSCAPE 4 or below 
		if (TRACE) window.alert ( "document.getElementById(" + divid + ").style.display (" +  document.getElementById(divid).style.display + ") being set to 'block'");
		if (document.getElementById &&!document.all) 	document.getElementById(divid).style.display = 'block';  //everything else
	} 	// END function showDiv
	

	
	function isVowel(char) {
		if (char.length == 1)   {
			var vowels = new Array('a','e','i','o','u','A','E','I','O','U');
			var isVowel = false;
			for(e in vowels)     {
				if(vowels[e] == char)  isVowel = true;
			}
		return isVowel;   }
	} 
	
	
	function isVowelRegEx(char) {
		if (char.length == 1)   {
			return /[aeiouAEIOU]/.test(char);
		}
	} 
