



var A_TPL4v;

function customOnLoad( strPageName ) {
	
	if( strPageName == "home" )
		InitialiseScrollableArea();
}

/* Extension written by David G. Miles (http://www.z3roadster.net/dreamweaver/) 
based in part on code written by Thomas Brattli (http://www.bratta.com)*/
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/

function verifyCompatibleBrowser(){ 
	this.ver=navigator.appVersion 
	this.dom=document.getElementById?1:0 
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
	this.ie4=(document.all && !this.dom)?1:0; 
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0; 
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
	return this 
} 
bw=new verifyCompatibleBrowser() 
  
var speed=50 
var loop = false, timer 
 
function ConstructObject(obj,nest){ 
	nest=(!nest) ? '':'document.'+nest+'.' 
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
	this.up=MoveAreaUp;this.down=MoveAreaDown; 
	this.MoveArea=MoveArea; this.x; this.y; 
	this.obj = obj + "Object" 
	eval(this.obj + "=this") 
	return this 
} 
function MoveArea(x,y){ 
	this.x=x;this.y=y 
	this.css.left=this.x 
	this.css.top=this.y 
} 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
	this.MoveArea(0,this.y-move) 
	if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 
function MoveAreaUp(move){ 
	if(this.y<0){ 
	this.MoveArea(0,this.y-move) 
	if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
function PerformScroll(speed){ 
	if(initialised){ 
		//loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
	} 
} 
function CeaseScroll(){ 
	loop=false 
	if(timer) clearTimeout(timer) 
} 
var initialised; 
function InitialiseScrollableArea(){ 
	objContainer=new ConstructObject('divContainer') 
	objScroller=new ConstructObject('divContent','divContainer') 
	objScroller.MoveArea(0,0) 
	objContainer.css.visibility='visible' 
	initialised=true; 

} 

function displayStatusMsg(msgStr) { 
  status=msgStr;
  document.returnValue = true;
}

function preloadImages() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
	var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { 
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}

function swapImage() { 
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);


function mainOnLoad(){
	preloadImagesNav();
	
	if( A_TPL4v != null )
		InitialiseScrollableArea();
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	
	if (document.images /*&& (preloadFlag == true)*/) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		nav_04_over = newImage("images/nav-over_01.jpg");
		nav_04_over = newImage("images/nav-over_02.jpg");
		nav_04_over = newImage("images/nav-over_03.jpg");
		nav_04_over = newImage("images/nav-over_04.jpg");
		nav_04_over = newImage("images/nav-over_06.jpg");
		nav_04_over = newImage("images/nav-over_08.jpg");
		
		preloadFlag = true;
	}
}




function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}


	
function toggle( objRadio, divName, radioOnValue ) {
	
	if ( ( obj = MM_findObj( divName ) ) != null ) {
	
		if (obj.style)
			obj=obj.style; 
	
		if( objRadio.value == radioOnValue ) {			 
			v = 'visible';	
			d = "inline";
		}	
		else {
			v = 'hidden'
			d = "none";
		}	
		
		obj.display = d;
		obj.visibility = v; 
		
	}
}

function showHide( divName, boolShow ) {
	
	if ( ( obj = MM_findObj( divName ) ) != null ) {
	
		if (obj.style)
			obj=obj.style; 
	
		if( boolShow ) {			 
			v = 'visible';	
			d = "inline";
		}	
		else {
			v = 'hidden'
			d = "none";
		}	
		
		obj.display = d;
		obj.visibility = v; 
		
	}
}

function showHideGroup( divNameShow, strDivs ) {
	
	aryDivs = strDivs.split( "," );
	
	for ( i=0; i<aryDivs.length; i++ ) {
		
		boolShowHide = ( divNameShow == aryDivs[i] );
						
		showHide( aryDivs[i], boolShowHide );
	}
}


var aryUserVals = new Array();
	
function showHideWithImage( divName, objA, divNameHead, txtHead ) {

	if( aryUserVals[divName] == undefined )
		aryUserVals[divName] = false;
		
	aryUserVals[divName] = !aryUserVals[divName];
	
	showHide( divName, aryUserVals[divName] );
	
	objNameHead = MM_findObj( divNameHead );
	
	if( aryUserVals[divName] ) {
		
		objA.innerHTML = "<img src=\"site/images/minus_sign.jpg\" border=\"0\" />";	
		objNameHead.innerHTML = "<font color=\"#fb0f00\" />" + txtHead + "</font>";
	}
	else {
		
		objA.innerHTML = "<img src=\"site/images/plus_sign.jpg\" border=\"0\" />";
		objNameHead.innerHTML = "<font color=\"#282828\" />" + txtHead + "</font>";
	}
	
	//objA.innerHTML = ( aryUserVals[divName] ) ? "<img src=\"images/minus_sign.jpg\" border=\"0\" />" : "<img src=\"images/plus_sign.jpg\" border=\"0\" />";
}


function changeSelects( valSel1, valToEnable, div ) {
	
	var boolDisable = ( valSel1 != valToEnable );
	var strShowHide = ( !boolDisable ) ? "show" : "hide";
	
	MM_showHideLayers( div, '', strShowHide );
				
	return boolDisable;
}

function jumpTO( strURL ) {

	if( strURL != "" )
		window.location.href = strURL;
}

function submitForm( valSel1, valToEnable, sel2, div ) {

	var boolDisable = changeSelects( valSel1, valToEnable, div );
	
	if( valSel1 != "" ) {
		
		var strURL = ( boolDisable ) ? valSel1 : sel2.value;
		
		jumpTO( strURL );
		
	}
}

function confirmDelete( strImageName ) {
	return confirm( "Are you sure you want to delete " + strImageName + "?" ) ;
}


var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
	 strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
	 strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
	 "resizable,location,height="+ 
	 strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}


function fixPNG(myImage) 
{
   var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
   
   if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}



function buildNav() {
  if (!document.getElementsByTagName) return;
  
  var try5 = document.getElementById("nav5");
  try5.className = "hide";
  
  var table = document.createElement("table");
  table.className = "nav2";
  var tbody = document.createElement("tbody");
  table.appendChild(tbody);
  var tr = document.createElement("tr");
  tbody.appendChild(tr);
  
  var lis = try5.getElementsByTagName("li");
  var tds = new Array();
  for (var i=0; i<lis.length; i++) {
      tds[i] = document.createElement("td");
	  if (lis[i].className) {
	  	tds[i].className = lis[i].className;
	  }
	  tds[i].appendChild(lis[i].removeChild(lis[i].firstChild));
      tr.appendChild(tds[i]);
  }
  try5.parentNode.replaceChild(table,try5);

}

function fileNameToString( strFileName ) {
	
	if( strFileName.lastIndexOf('/') == -1 ) //w in
		strFileName = strFileName.substring(strFileName.lastIndexOf('\\')+1,strFileName.lastIndexOf('.'));
	else // mac, linux
		strFileName = strFileName.substring(strFileName.lastIndexOf('/')+1,strFileName.lastIndexOf('.'));
	
	strFileName = strFileName.replace(/_/g,' ');
	strFileName = strFileName.replace(/-/g,' ');
	strFileName = toTitleCase( strFileName );
	
	return strFileName;
}

function toTitleCase(str) {
	
    return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}

function CreateBookmarkLink( title, url ) {

if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
} 
else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}
