// reflow page for correct cross-browser footer positioning

function reflow() {
    var bodydiv = document.getElementById("body");
    if (bodydiv != null) {
        bodydiv.style.minHeight = "100%";
    }
}



// workaround for absence of target attributes in xhtml strict

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}



function inputFocus(input, value) {
    if (input.value == value)
        input.value = "";
}
function inputBlur(input, value) {
    if (input.value == "")
        input.value = value;
}



function toggle(id) {
   var item = document.getElementById(id);

   if (item.style.display == "block")
      item.style.display = "none";
   else
      item.style.display = "block";
}



function validateAdmin() {
	var aMsg = new Array();
	var aMandatory = new Array('admUsername','admEmail','admFirstName','admLastName');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fUsername = document.getElementById('admUsername');
	var sUsername = fUsername.value;
	if (sUsername != '' && (sUsername.length < 4 || sUsername.length > 16)) {
		aMsg[aMsg.length] = 'Username should be between 4 to 16 characters';
		highlightLabel(fUsername.previousSibling);
	}

	var fPassword1 = document.getElementById('admPassword1');
	var sPassword1 = fPassword1.value;
	if (sPassword1 != '' && (sPassword1.length < 8 || sPassword1.length > 32)) {
		aMsg[aMsg.length] = 'Password should be between 8 to 32 characters';
		highlightLabel(fPassword1.previousSibling);
	}

	var fPassword2 = document.getElementById('admPassword2');
	var sPassword2 = fPassword2.value;
	if (sPassword2 != sPassword1) {
		aMsg[aMsg.length] = 'Passwords do not match';
		highlightLabel(fPassword2.previousSibling);
	}

	var fEmail = document.getElementById('admEmail');
	var sEmail = fEmail.value;
	if (sEmail != '' && sEmail.length > 255) {
		aMsg[aMsg.length] = 'Email should be less than 255 characters';
		highlightLabel(fEmail.previousSibling);
	}
	else if (sEmail != '' && !validateEmail(sEmail)) {
		aMsg[aMsg.length] = 'Email is invalid';
		highlightLabel(fEmail.previousSibling);
	}

	var fFirstName = document.getElementById('admFirstName');
	var sFirstName = fFirstName.value;
	if (sFirstName != '' && sFirstName.length > 64) {
		aMsg[aMsg.length] = 'First name should be less than 64 characters';
		highlightLabel(fFirstName.previousSibling);
	}

	var fLastName = document.getElementById('admLastName');
	var sLastName = fLastName.value;
	if (sLastName != '' && sLastName.length > 64) {
		aMsg[aMsg.length] = 'Last name should be less than 64 characters';
		highlightLabel(fLastName.previousSibling);
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateStock() {
	var aMsg = new Array();
	var aMandatory = new Array('stockBid','stockOffer','stockTotalVol','stockChange');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fBid = document.getElementById('stockBid');
	var sBid = fBid.value;
	if (sBid != '' && sBid.length > 32) {
		aMsg[aMsg.length] = 'Bid should be less than 32 characters';
		highlightLabel(fBid.previousSibling);
	}

	var fOffer = document.getElementById('stockOffer');
	var sOffer = fOffer.value;
	if (sOffer != '' && sOffer.length > 32) {
		aMsg[aMsg.length] = 'Offer should be less than 32 characters';
		highlightLabel(fOffer.previousSibling);
	}

	var fTotalVol = document.getElementById('stockTotalVol');
	var sTotalVol = fTotalVol.value;
	if (sTotalVol != '' && sTotalVol.length > 32) {
		aMsg[aMsg.length] = 'Total Vol should be less than 32 characters';
		highlightLabel(fTotalVol.previousSibling);
	}

	var fChange = document.getElementById('stockChange');
	var sChange = fChange.value;
	if (sChange != '' && sChange.length > 32) {
		aMsg[aMsg.length] = 'Change % should be less than 32 characters';
		highlightLabel(fChange.previousSibling);
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateArticle(type) {
	var aMsg = new Array();
	var aMandatory = new Array('artTitle','artText');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fTitle = document.getElementById('artTitle');
	var sTitle = fTitle.value;
	if (sTitle != '' && sTitle.length > 255) {
		aMsg[aMsg.length] = 'Title should be less than 255 characters';
		highlightLabel(fTitle.previousSibling);
	}

	if (type == 'all') {
		var fFile = document.getElementById('fileUpload');
		var sFile = fFile.value;
		if (sFile != '' && !validatePdfExt(sFile)) {
			aMsg[aMsg.length] = 'File to be uploaded should be a PDF file';
			highlightLabel(fFile.previousSibling);
		}
		else if (sFile != '') {
			var fFileTitle = document.getElementById('fileTitle');
			var sFileTitle = fFileTitle.value;
			if (sFileTitle == '') {
				aMsg[aMsg.length] = 'Please fill in all mandatory fields';
				highlightLabel(fFileTitle.previousSibling);
			}
			else if (sFileTitle != '' && sFileTitle.length > 255) {
				aMsg[aMsg.length] = 'File title should be less than 255 characters';
				highlightLabel(fFileTitle.previousSibling);
			}
		}
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateFile(type) {
	var aMsg = new Array();
	if (type == 'all')
		var aMandatory = new Array('fileTitle','fileUpload');
	else
		var aMandatory = new Array('fileTitle');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fFileTitle = document.getElementById('fileTitle');
	var sFileTitle = fFileTitle.value;
	if (sFileTitle != '' && sFileTitle.length > 255) {
		aMsg[aMsg.length] = 'File title should be less than 255 characters';
		highlightLabel(fFileTitle.previousSibling);
	}

	if (type == 'all') {
		var fFile = document.getElementById('fileUpload');
		var sFile = fFile.value;
		if (sFile != '' && !validatePdfExt(sFile)) {
			aMsg[aMsg.length] = 'File to be uploaded should be a PDF file';
			highlightLabel(fFile.previousSibling);
		}
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateSubscribe() {
	var aMsg = new Array();
	var aMandatory = new Array('subEmail','subFirstName','subLastName','countryID');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fEmail = document.getElementById('subEmail');
	var sEmail = fEmail.value;
	if (sEmail != '' && sEmail.length > 255) {
		aMsg[aMsg.length] = 'Email should be less than 255 characters';
		highlightLabel(fEmail.previousSibling);
	}
	else if (sEmail != '' && !validateEmail(sEmail)) {
		aMsg[aMsg.length] = 'Email is invalid';
		highlightLabel(fEmail.previousSibling);
	}

	var fFirstName = document.getElementById('subFirstName');
	var sFirstName = fFirstName.value;
	if (sFirstName != '' && sFirstName.length > 64) {
		aMsg[aMsg.length] = 'First Name should be less than 64 characters';
		highlightLabel(fFirstName.previousSibling);
	}

	var fLastName = document.getElementById('subLastName');
	var sLastName = fLastName.value;
	if (sLastName != '' && sLastName.length > 64) {
		aMsg[aMsg.length] = 'Last Name should be less than 64 characters';
		highlightLabel(fLastName.previousSibling);
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateSubscribeHome() {
	var aMsg = new Array();
	var aFields = new Array('subEmail','subFirstName','subLastName','countryID');
	var aMandatory = new Array('countryID');
	var bMissing = false;
	var currField = '';

	for (var i = 0; i < aFields.length; i++) {
		currField = document.getElementById(aFields[i]);
		unhighlightElement(currField);
	}

	var fEmail = document.getElementById('subEmail');
	var sEmail = fEmail.value;
	if (sEmail == 'Email address') {
		bMissing = true;
		highlightElement(fEmail);
	}
	else if (sEmail != '' && sEmail.length > 255) {
		aMsg[aMsg.length] = 'Email should be less than 255 characters';
		highlightElement(fEmail);
	}
	else if (sEmail != '' && !validateEmail(sEmail)) {
		aMsg[aMsg.length] = 'Email is invalid';
		highlightElement(fEmail);
	}

	var fFirstName = document.getElementById('subFirstName');
	var sFirstName = fFirstName.value;
	if (sFirstName == 'First name') {
		bMissing = true;
		highlightElement(fFirstName);
	}
	else if (sFirstName != '' && sFirstName.length > 64) {
		aMsg[aMsg.length] = 'First Name should be less than 64 characters';
		highlightElement(fFirstName);
	}

	var fLastName = document.getElementById('subLastName');
	var sLastName = fLastName.value;
	if (sLastName == 'Last name') {
		bMissing = true;
		highlightElement(fLastName);
	}
	else if (sLastName != '' && sLastName.length > 64) {
		aMsg[aMsg.length] = 'Last Name should be less than 64 characters';
		highlightElement(fLastName);
	}

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightElement(currField);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateUnsubscribe() {
	var aMsg = new Array();
	var aMandatory = new Array('subEmail');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fEmail = document.getElementById('subEmail');
	var sEmail = fEmail.value;
	if (sEmail != '' && sEmail.length > 255) {
		aMsg[aMsg.length] = 'Email should be less than 255 characters';
		highlightLabel(fEmail.previousSibling);
	}
	else if (sEmail != '' && !validateEmail(sEmail)) {
		aMsg[aMsg.length] = 'Email is invalid';
		highlightLabel(fEmail.previousSibling);
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateAlbum() {
	var aMsg = new Array();
	var aMandatory = new Array('albName');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fName = document.getElementById('albName');
	var sName = fName.value;
	if (sName != '' && sName.length > 255) {
		aMsg[aMsg.length] = 'Album name should be less than 255 characters';
		highlightLabel(fName.previousSibling);
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateImage(type) {
	var aMsg = new Array();
	if (type == 'all')
		var aMandatory = new Array('imgUpload');
	else
		var aMandatory = new Array();
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	var fCaption = document.getElementById('imgCaption');
	var sCaption = fCaption.value;
	if (sCaption != '' && sCaption.length > 255) {
		aMsg[aMsg.length] = 'Image caption should be less than 255 characters';
		highlightLabel(fCaption.previousSibling);
	}

	if (type == 'all') {
		var fImg = document.getElementById('imgUpload');
		var sImg = fImg.value;
		if (sImg != '' && !validateImgExt(sImg)) {
			aMsg[aMsg.length] = 'Image to be uploaded should be a gif, jpg, or png file';
			highlightLabel(fImg.previousSibling);
		}
	}

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateForgotPW() {
	var aMsg = new Array();
	var aMandatory = new Array('userEmail');
	var bMissing = false;
	var currField = '';

	resetLabels();

	for (var i = 0; i < aMandatory.length; i++) {
		currField = document.getElementById(aMandatory[i]);
		if (currField.value == '') {
			bMissing = true;
			highlightLabel(currField.previousSibling);
		}
	}
	if (bMissing)
		aMsg[aMsg.length] = 'Please fill in all mandatory fields';

	if (aMsg.length > 0) {
		alert(aMsg.join('\n'));
		return false;
	}
	else
		return true;
}



function validateEmail(email) {
	var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if (regex.test(email))
		return true;
	else
		return false;
}

function validatePdfExt(filename) {
	var dotIndex = filename.lastIndexOf('.');
	var extension = '';

	if (dotIndex != -1) {
		extension = filename.substring(dotIndex+1);
		extension = extension.toLowerCase();
		if (extension == 'pdf')
			return true;
		else
			return false;
	}
	else
		return false;
}

function validateImgExt(filename) {
	var dotIndex = filename.lastIndexOf('.');
	var extension = '';

	if (dotIndex != -1) {
		extension = filename.substring(dotIndex+1);
		extension = extension.toLowerCase();
		if (extension == 'jpg' || extension == 'jpeg' || extension == 'gif' || extension == 'png')
			return true;
		else
			return false;
	}
	else
		return false;
}



function resetLabels() {
	var labels = document.getElementsByTagName('label');
	var currLabel = '';

	for (var i = 0; i < labels.length; i++) {
		currLabel = labels[i];
		currLabel.style.color = '';
	}
}

function highlightLabel(label) {
	if (label.nodeName.toLowerCase() == 'label') {
		label.style.color = 'red';
	}
}

function unhighlightElement(elem) {
	elem.style.color = '';
}

function highlightElement(elem) {
	elem.style.color = 'red';
}



function viewAlbum() {
	var selAlbum = document.getElementById('select_album');
	var albID = selAlbum.options[selAlbum.selectedIndex].value;
	if (albID != '')
		location.href = 'about_gallery.php?id=' + albID;
}



function changeContactType(type) {
	var fRecipient = document.getElementById('contact_recipient');
	var fSubject = document.getElementById('contact_subject');

	if (type == 'general') {
		fRecipient.value = "mayyee@integrax.com.my";
		fSubject.value = "Integrax Website General Enquiry";
	}
	else {
		fRecipient.value = "harunhalimrasip@integrax.com.my";
		fSubject.value = "Integrax Website IR Enquiry";
	}
}



// equalize heights of left/right floated divs
// add 20 (px) to compensate for bottom padding

/*
Derived from a script by Alejandro Gervasio.
Modified to work in FireFox by Stefan Mischook for Killersites.com

How it works: just apply the CSS class of 'column' to your pages' main columns.
*/
matchColumns=function(){

     var divs,contDivs,maxHeight,divHeight,d;

     // get all <div> elements in the document
     divs=document.getElementsByTagName('div');
     contDivs=[];

     // initialize maximum height value
     maxHeight=0;

     // iterate over all <div> elements in the document
     for(var i=0;i<divs.length;i++){

          // make collection with <div> elements with class attribute 'container'
          if(/\bcolumn\b/.test(divs[i].className)){
                d=divs[i];
                contDivs[contDivs.length]=d;

                // determine height for <div> element
                if(d.offsetHeight){
                     divHeight=d.offsetHeight;
                }

                else if(d.style.pixelHeight){
                     divHeight=d.style.pixelHeight;
                }

                // calculate maximum height
                maxHeight=Math.max(maxHeight,divHeight);
          }
     }

     // assign maximum height value to all of container <div> elements
     for(var i=0;i<contDivs.length;i++){
          contDivs[i].style.height=(maxHeight) + "px";
     }
}



// eMail Obfuscator Script 1.31 by Tim Williams - freeware

function obfuscate(type) {

var obfuscated = '';

if (type == 'link')

obfuscated = String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,
99,111,110,116,97,99,116,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
34,62,
99,111,110,116,97,99,116,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
60,47,97,62);

if (type == 'fm_recipient')

obfuscated = String.fromCharCode(60,105,110,112,117,116,32,116,121,112,101,61,34,104,105,100,100,101,110,34,32,110,97,109,101,61,34,114,101,99,105,112,105,101,110,116,34,32,118,97,108,117,101,61,34,
99,111,110,116,97,99,116,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
34,32,47,62);

if (type == 'address_m')

obfuscated = String.fromCharCode(109,97,105,108,116,111,58,
99,111,110,116,97,99,116,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103);

if (type == 'address')

obfuscated = String.fromCharCode(99,111,110,116,97,99,116,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103);

if (type == 'link_jobs')

obfuscated = String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,
106,111,98,115,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
34,62,
106,111,98,115,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
60,47,97,62);

if (type == 'link_billing')

obfuscated = String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,
98,105,108,108,105,110,103,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
34,62,
98,105,108,108,105,110,103,64,119,101,98,112,117,112,112,105,101,115,46,99,111,109,46,115,103,
60,47,97,62);

document.write(obfuscated);

}



/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var menu_about=new Array()
menu_about[0]='<a href="about_corporate.php">Corporate Details</a>'
menu_about[1]='<a href="about_organisation.php">Corporate Organisation &amp; Structure</a>'
menu_about[2]='<a href="about_directors.php">Board of Directors &amp; Key Management</a>'
menu_about[3]='<a href="about_shareholder.php">Shareholder Information</a>'
menu_about[4]='<a href="about_gallery.php">Picture Gallery</a>'

var menu_businesses=new Array()
menu_businesses[0]='<a href="businesses_lumutport.php">Ports and Terminals</a>'
//menu_businesses[1]='<a href="businesses_development.php">Port Projects in Development</a>'
menu_businesses[2]='<a href="businesses_resources.php">Resources</a>'
menu_businesses[3]='<a href="businesses_services.php">Services</a>'

var menu_ir=new Array()
menu_ir[0]='<a href="ir_statements.php">Quarterly Financial Statements</a>'
menu_ir[1]='<a href="ir_annualreports.php">Annual Reports</a>'
menu_ir[2]='<a href="ir_circulars.php">Circulars</a>'
menu_ir[3]='<a href="ir_properties.php">Company Property Interests</a>'
menu_ir[4]='<a href="ir_latestnews.php">Latest News</a>'
menu_ir[5]='<a href="ir_governance.php">Corporate Governance</a>'
menu_ir[6]='<a href="ir_cautionary.php">Cautionary Statement</a>'

var menuwidth='188px' //default menu width
var menubgcolor='white'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu



/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var home_banner=new Array()
home_banner[0]=["pics/home_banner1.jpg", "", ""]
home_banner[1]=["pics/home_banner2.jpg", "", ""]
home_banner[2]=["pics/home_banner3.jpg", "", ""]
home_banner[3]=["pics/home_banner4.jpg", "", ""]
home_banner[4]=["pics/home_banner5.jpg", "", ""]
home_banner[5]=["pics/home_banner6.jpg", "", ""]

var fadebgcolor="white"

////NO need to edit beyond here/////////////

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers

var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}

var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2

if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')

if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}

fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}


fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}

fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}


fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}



// run all necessary functions on page load

function loadAll() {
	//reflow();
	externalLinks();
	matchColumns();
}
window.onload = loadAll;