
// JavaScript Document
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(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; }
}


var iSize=16;
var sDefaultSearchValue='search aiga austin';

function checkSearchValue(oSearch,oFocus){
	if(!oSearch)return;
	/* trim white space */
	oSearch.value=trim(oSearch.value);
	if(oFocus && oSearch.value==sDefaultSearchValue)oSearch.value='';
	else if(!oFocus && oSearch.value=='')oSearch.value=sDefaultSearchValue;
}

function trim(s){
	return s.replace(/[\s]{2,}/,' ').replace(/^[\s]+/,'').replace(/[\s]+$/,'');
}

function loadAigaAustin(){
	/* load up search box default text and events */
	var oSearch=document.getElementById('input');
	if(oSearch){
		checkSearchValue(oSearch,false);
		oSearch.onfocus=function (){checkSearchValue(this,true)};
		oSearch.onblur=function (){checkSearchValue(this,false)};
	}
}
window.onload=loadAigaAustin;

function customize(sPref,iMod){
	var oDate=new Date();
	var oNewDate=new Date(oDate.getFullYear()+1,oDate.getMonth(),oDate.getDate());
	if(document.getElementById){
		var oStyle=document.body.style;
		var bReturn=true;
		if(sPref=='reset'){
			oStyle.fontFamily='\'Trebuchet MS\',arial,sans-serif';
			oStyle.fontSize='16px';
			iSize=16;
			/* set cookie to expire last year */
			oNewDate=new Date(oDate.getFullYear()-1,oDate.getMonth(),oDate.getDate());
			setCookie('fontFamily','sans',oNewDate,'/');
			setCookie('fontSize','16',oNewDate,'/');
			bReturn=false;
		}else if(sPref=='font'){
			oStyle.fontFamily=iMod?'georgia,serif':'\'Trebuchet MS\',arial,sans-serif';
			setCookie('fontFamily',iMod?'serif':'sans',oNewDate,'/');
			bReturn=false;
		}else if(sPref=='size'){
			var iDefault=16;
			if(iMod==1){
				if(iSize>=20){
					alert('You are already at the largest font size available. If you still have trouble reading the site, you may wish to adjust the font size preferences in your web browser.');
					bReturn=false;
				}else{
					iSize++;
				}
			}else if(iMod==-1){
				if(iSize<=14){
					alert('You are already at the smallest font size available.');
					bReturn=false;
				}else{
					iSize--;
				}
			}else{
				iSize=iDefault;
			}
			oStyle.fontSize=iSize+'px';
			setCookie('fontSize',iSize,oNewDate,'/');
			bReturn=false;
		}
	}
	return bReturn;
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

/* add or remove element className */
function modClass(bAdd,oElement,sClassName){
	if(bAdd){/* add class */
		if(oElement.className.indexOf(sClassName)==-1)oElement.className+=' '+sClassName;
	}else{/* remove class */
		if(oElement.className.indexOf(sClassName)!=-1){
			if(oElement.className.indexOf(' '+sClassName)!=-1)oElement.className=oElement.className.replace(' '+sClassName,'');
			else oElement.className=oElement.className.replace(sClassName,'');
		}
	}
	return oElement.className; /* return new className */
}


/* Output any object's prop:values in new console window (for debugging purposes only) */
function getObjProps(oObj){
	var oConsole = window.open('','console','width=500,height=500,scrollbars,resizable');
	oConsole.document.open("text/plain");
	oConsole.focus();
	var aProps = new Array();
	for(prop in oObj) aProps[aProps.length] = prop + ': ' + oObj[prop];
	aProps.sort();
	for(var i=0;i<aProps.length;i++){
		oConsole.document.writeln(aProps[i]);
		// moz doesn't recognize new doc as plaintext so add HTML line breaks
		if(isMoz || (isMac && isIE)) oConsole.document.write('<br>');
	}
	oConsole.document.close();
}



/* -- font resize  script-- */

var tags = new Array( 'div','td','tr','p','b','table','strong','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd','span', 'body', 'form');
var pixelArray =  new Array('11','12','13','14','15','16','17');
var emArray =  new Array('0.7','0.9','1.0','1.5','2.0','2.5','3');
var initSize = 2;

function fontSizer(inc,unit) {
	if (!document.getElementById) 
		return;
	var size = initSize;
		size += inc;
	if (size < 0 ) {
		size = 0;
}
	if (size > 6 ) {
		size = 6;
}
		initSize = size;
			getBody = document.getElementById('enrg_copy');
		// getBody = document.getElementsByTagName('body')[0];
		getBody.style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;

// REMOVED BELOW TO CONTROL ONLY THE - CONTENT - AREA
/*
	for (i = 0 ; i < tags.length ; i++ ) {
		getallTags = getBody.getElementsByTagName(tags[i]);
	for (k = 0 ; k < getallTags.length ; k++) 
		getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;
	}
*/
// END REMOVED SECTION
}

/* -- font resize  script-- */


function customize(sPref,iMod){
	var oDate=new Date();
	var oNewDate=new Date(oDate.getFullYear()+1,oDate.getMonth(),oDate.getDate());
	if(document.getElementById){
		var oStyle=document.body.style;
		var bReturn=true;
		if(sPref=='reset'){
			oStyle.fontFamily='\'Trebuchet MS\',arial,sans-serif';
			oStyle.fontSize='16px';
			iSize=16;
			/* set cookie to expire last year */
			oNewDate=new Date(oDate.getFullYear()-1,oDate.getMonth(),oDate.getDate());
			setCookie('fontFamily','sans',oNewDate,'/');
			setCookie('fontSize','16',oNewDate,'/');
			bReturn=false;
		}else if(sPref=='font'){
			oStyle.fontFamily=iMod?'georgia,serif':'\'Trebuchet MS\',arial,sans-serif';
			setCookie('fontFamily',iMod?'serif':'sans',oNewDate,'/');
			bReturn=false;
		}else if(sPref=='size'){
			var iDefault=16;
			if(iMod==1){
				if(iSize>=20){
					alert('You are already at the largest font size available. If you still have trouble reading the site, you may wish to adjust the font size preferences in your web browser.');
					bReturn=false;
				}else{
					iSize++;
				}
			}else if(iMod==-1){
				if(iSize<=10){
					alert('You are already at the smallest font size available.');
					bReturn=false;
				}else{
					iSize--;
				}
			}else{
				iSize=iDefault;
			}
			oStyle.fontSize=iSize+'px';
			setCookie('fontSize',iSize,oNewDate,'/');
			bReturn=false;
		}
	}
	return bReturn;
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

/* add or remove element className */
function modClass(bAdd,oElement,sClassName){
	if(bAdd){/* add class */
		if(oElement.className.indexOf(sClassName)==-1)oElement.className+=' '+sClassName;
	}else{/* remove class */
		if(oElement.className.indexOf(sClassName)!=-1){
			if(oElement.className.indexOf(' '+sClassName)!=-1)oElement.className=oElement.className.replace(' '+sClassName,'');
			else oElement.className=oElement.className.replace(sClassName,'');
		}
	}
	return oElement.className; /* return new className */
}




