var version4 = (navigator.appVersion.charAt(0) == "4"); 

//Random Text Display in Right Panel
var textnumber = 7 ; 
var randomnumber = Math.random() ; 
var rand1 = Math.round( (textnumber-1) * randomnumber) + 1 ; 
text = new Array 
text[1] = "Only 55 percent of 70,150 miles of Georgia's streams support a full range of aquatic life.   Sadly, 16 percent support no aquatic life at all.<br>&nbsp;<br>" 
text[2] = "The highest concentration of pesticides in metro Atlanta's rivers and streams are found during the month of May.<br>&nbsp;<br>" 
text[3] = "Major culprits causing impairment of rivers include metals, pathogens and low dissolved oxygen levels.<br>&nbsp;<br><br>&nbsp;<br>" 
text[4] = "Only 14 percent of the 70,150 total stream and river miles in our state are monitored. (of that percentage nearly 60% do not meet water quality standards).<br>&nbsp;<br><br>&nbsp;<br>" 
text[5] = "More than 800 of Georgia's waterways already fail federal safety regulations for toxic chemicals and cancer-causing agents. Officials statewide blame runoff from parking lots, roofs, streets and new development.<br>&nbsp;<br><br>&nbsp;<br>" 
text[6] = "Pet waste contains as many as 75 diseases and viruses which may make our water unsafe for fishing, swimming and other types of recreation.<br>&nbsp;<br>" 
text[7] = "The Clean Water Campaign is conducting a series of septic tank workshops across metro Atlanta. <a href='../what_can_i_do/septictankworkshops.html'>Click here</a> for more information.<br>&nbsp;<br>" 

var mytext = text[rand1];

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

// Popup Functions
var popupHandle;
numPopups = 0;
popupNames = new Array();
popupReferences = new Array();

function closePopup() {
	if(popupHandle != null && !popupHandle.closed) popupHandle.close();
}

function displayPopup(position,url,name,height,width,evnt) {
	// position=1 POPUP: makes screen display up and/or left, down and/or right 
	// depending on where cursor falls and size of window to open
	// position=2 CENTER: makes screen fall in center
	var properties = "toolbar = 0, location = 0, height = " + height;
	properties = properties + ", width=" + width;
	var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
		screenY = document.body.offsetHeight;
		screenX = window.screen.availWidth;
	} else {
		screenY = window.outerHeight;
		screenX = window.outerWidth;
	}
	
	if(position == 1)	{ // if POPUP not CENTER
		cursorX = evnt.screenX;
		cursorY = evnt.screenY;
		padAmtX = 10;
		padAmtY = 10;
		if((cursorY + height + padAmtY) > screenY) {
			// make sizes a negative number to move left/up
			padAmtY = (-30) + (height * -1);
			// if up or to left, make 30 as padding amount
		}
		if((cursorX + width + padAmtX) > screenX)	{
			padAmtX = (-30) + (width * -1);	
			// if up or to left, make 30 as padding amount
		}
		
		if(navigator.appName == "Microsoft Internet Explorer") {
			leftprop = cursorX + padAmtX;
			topprop = cursorY + padAmtY;
		} else {
			leftprop = (cursorX - pageXOffset + padAmtX);
			topprop = (cursorY - pageYOffset + padAmtY);
		}
	} else {
		leftvar = (screenX - width) / 2;
		rightvar = (screenY - height) / 2;
				
		if(navigator.appName == "Microsoft Internet Explorer") {
			leftprop = leftvar;
			topprop = rightvar;
		} else {
			leftprop = (leftvar - pageXOffset);
			topprop = (rightvar - pageYOffset);
		}
	}
	
	if(evnt != null) {
		properties = properties + ", left = " + leftprop;
		properties = properties + ", top = " + topprop;
	}
	
	closePopup();
	popupHandle = open(url,name,properties);
}

function postit(){
	var fm = document.all.frmKeyword;
	var vKeyword = frmKeyword.txtKeyword.value ;
	var vMonth  = frmKeyword.cboMonth.value;
	var vYear = frmKeyword.cboYear.value;
	var vaction = 'results.asp?txtKeyword=' + vKeyword + '&cboYear=' + vYear + '&cboMonth=' + vMonth;
	openGenPopup('A',vaction,400,300,'toolbar=0,status=0,scrollbars=1,resizable=0');	
}

function AddPopup(name, reference) {
	refIndex = popupNames[name];
	if (refIndex == null) {
		refIndex = numPopups++;
		popupNames[name] = refIndex;
	}
	popupReferences[refIndex] = reference;
}

function openGenPopup(name,url,width,height,attribs){
	var win;

	if (attribs == null) attribs = "hotkeys,resizable,scrollbars,dependent";
	
	if (FocusPopup(name)) {
		var refIndex = popupNames[name];
		win = popupReferences[refIndex];
		win.location = url;
	} else {
		var desc_str = "height=" + height + ",width=" + width + "," + attribs;
		win = window.open(url,name,desc_str);
		AddPopup(name,win);
	}
 
	FocusPopup(name);
	return (win);
}

function openRegister(url) {
		var saveUrl = "returnurl" + "=" + escape (window.location.href);
		saveUrl += ";path=/;domain=.atlantaregional.com";
		document.cookie = saveUrl;

		window.location.href = url;
}

function FocusPopup(name) {
	refIndex = popupNames[name];
	if (refIndex != null && ! popupReferences[refIndex].closed) {
		popupReferences[refIndex].focus();
		return true;
	}
	return false;
}
  
function ClosePopups() {
	for (var i=0; i < popupReferences.length; i++) {
		curRef = popupReferences[i]
		if (curRef != null && !curRef.closed) {
			curRef.close();
		}
		popupReferences[i] = null;
	}
}


//function ClosePopup(name) {
//  refIndex = popupNames[name];
// if (refIndex != null && ! popupReferences[refIndex].closed) {
//    popupReferences[0].close();
//    popupReferences[refIndex] = null;
//    popupNames[name] = null;
//    return true;
//  }
//  return false;
//}
//}


function resetit(){
		document.frmKeyword.txtKeyword.value="";
		document.frmKeyword.cboCategory.value="";
		document.frmKeyword.cboMonth.value="";
}

function resetform(){
		document.frmSearch.Title.value="";
		document.frmSearch.Month.value="";
		document.frmSearch.Date.value="";
		document.frmSearch.Year.value="";
		document.frmSearch.Location.value="";
		document.frmSearch.Category.value="";
		document.frmSearch.Information.value="";
}

