
var gWin;
var url = ""
url = "http://localhost/cascade/";
url = "http://www.cascadedialogues.org/"
// uses image objects - works with NS 3 or later, or IE 4 or later	

function test()
{
	alert("test");
}

function ImgObject (name,inActSrc,actSrc,selSrc) {  

	
 
 	this.title = name; // title must match name attribute in image tag
 	
	this.swapInactive = swapInactive; //this and next three are method associations 
  	this.swapActive = swapActive;  
	this.swapSelected = swapSelected;

		
	this.inAct = new Image();  
	this.inAct.src = inActSrc;  
	
	this.act = new Image();
  	this.act.src = actSrc;  
	
	this.sel = new Image();  
	this.sel.src = selSrc;

 }


//Top Nav objects
whoImages = new ImgObject('who', url + "images/nav/who_rest.gif",url + "images/nav/who_over.gif", url + "images/nav/who_over.gif");
conceptImages= new ImgObject('concept', url + "images/nav/concept_rest.gif",url + "images/nav/concept_over.gif", url + "images/nav/concept_over.gif");
processImages = new ImgObject('process', url + "images/nav/process_rest.gif",url + "images/nav/process_over.gif", url + "images/nav/process_over.gif");
timelineImages = new ImgObject('timeline01', url + "images/nav/timeline_01_rest.gif",url + "images/nav/timeline_01_over.gif", url + "images/nav/timeling_01_over.gif");
supportImages = new ImgObject('support', url + "images/nav/support_rest.gif",url + "images/nav/support_over.gif", url + "images/nav/suppport_over.gif");
countiesImages = new ImgObject('counties', url + "images/nav/counties_rest.gif",url + "images/nav/counties_over.gif", url + "images/nav/counties_over.gif");
landscapesImages = new ImgObject('landscapes', url + "images/nav/landscapes_rest.gif",url + "images/nav/landscapes_over.gif", url + "images/nav/landscapes_over.gif");
interactImages = new ImgObject('interact', url + "images/nav/interact_rest.gif",url + "images/nav/interact_over.gif", url + "images/nav/interact_over.gif");
eventsImages = new ImgObject('events', url + "images/nav/events_rest.gif",url + "images/nav/events_over.gif", url + "images/nav/events_over.gif");
timeline02Images = new ImgObject('timeline02', url + "images/nav/timeline_02_rest.gif",url + "images/nav/timeline_02_over.gif", url + "images/nav/timeline_02_over.gif");
function swapInactive() {
		//var curPage =	top.iMain.document.images[0].name;
		var curPage =	document.images[0].name;	
		if(curPage.indexOf(this.title)==-1)
		{
			window.document.images[this.title].src = this.inAct.src;
		}
}
function swapActive() {  

		
		window.document.images[this.title].src = this.act.src;
		
}	


function swapSelected() {  
		window.document.images[this.title].src = this.sel.src;

}	

 function setSelectedDialogPage(daPage)
{
		document.who.src=url + "images/nav/who_rest.gif"; 
		document.concept.src=url + "images/nav/concept_rest.gif";
		document.process.src= url + "images/nav/process_rest.gif";
		document.timeline01.src= url + "images/nav/timeline_01_rest.gif";
		
	   switch(daPage) 
	   {
	        case 'whoPage' :
	            document.who.src=url + "images/nav/who_over.gif";
	            break;
			
			case 'conceptPage' :
	            document.concept.src=url + "images/nav/concept_over.gif";
	            break;
			case 'processPage' :
				document.process.src= url + "images/nav/process_over.gif";
	            break;
	
			case 'timeline01Page' :
	            	document.timeline01.src= url + "images/nav/timeline_01_over.gif";
	            break;
			case 'supportPage' :
	            	document.support.src= url + "images/nav/support_over.gif";
	            break;				
		}
	}
 function setSelectedRegionPage(daPage)
{
		document.counties.src=url + "images/nav/counties_rest.gif"; 
		document.landscapes.src=url + "images/nav/landscapes_rest.gif";
		document.interact.src= url + "images/nav/interact_rest.gif";
				
	   switch(daPage) 
	   {
	        case 'countiesPage' :
	            document.counties.src=url + "images/nav/counties_over.gif";
	            break;
			
			case 'landscapesPage' :
	            document.landscapes.src=url + "images/nav/landscapes_over.gif";
	            break;
			case 'interactPage' :
				document.interact.src= url + "images/nav/interact_over.gif";
	            break;
		}
	}
 function setSelectedVisionPage(daPage)
{
		document.events.src=url + "images/nav/events_rest.gif"; 
		//document.timeline02.src=url + "images/nav/timeline_02_rest.gif";
				
	   switch(daPage) 
	   {
	        case 'eventsPage' :
	            document.events.src=url + "images/nav/events_over.gif";
	            break;
			
			case 'timeline02' :
	            document.timeline02.src=url + "images/nav/timeline_02_over.gif";
	            break;
		}
	}	
 /*for iframe support
 function setSelectedPage(daPage)
{
	//reload in frame if not in one already
	if (testLocation())
	{
		top.iNav.document.who.src=url + "images/nav/who_rest.gif"; 
		top.iNav.document.concept.src=url + "images/nav/concept_rest.gif";
		top.iNav.document.process.src= url + "images/nav/process_rest.gif";
		top.iNav.document.timeline.src= url + "images/nav/timeline_01_rest.gif";
		
		//alert(daPage);
	   switch(daPage) 
	   {
	        case 'who' :
	            top.iNav.document.who.src=url + "images/nav/who_over.gif";
	            break;
			
			case 'concept' :
	            top.iNav.document.concept.src=url + "images/nav/concept_over.gif";
	            break;
			case 'process' :
				top.iNav.document.process.src= url + "images/nav/process_over.gif";
	            break;
	
			case 'timeline' :
	            	top.iNav.document.timeline.src= url + "images/nav/timeline_01_over.gif";
	            break;
			case 'catalogPageImages' :
	            top.banner.document.nav_catalog.src=url + "images/nav_catalog_on.gif";
	            break;
			case 'loginMnuPageImages' :
	            top.banner.document.nav_login.src=url + "images/nav_login_on.gif";
	            break;			
				
		}
	}
	*/
	function testLocation()
	{
		var theTest = true;
		if (top.location == self.location)	
		{
			curPage = self.location;
			setCookie("curPage", curPage);
			location.replace("index.html");
			theTest = false;
		}
		return theTest;
	}

	function doLeftBlurb(mainCat)
	{
		var theContent="";
	   switch(mainCat) 

	{
	        case 'dialog' :
				theContent += "<strong>Save the Date!</strong><br/>";
				theContent += "<strong>CLC's Conservation Awards Breakfast is May 19</strong><br/><br>";
				theContent += "<a href='http://www.cascadeland.org/cab/'  class='white'>Join us for the release of <em>The Cascade Agenda</em> </a>";						
				break;
			case 'regions' :
				theContent += "<strong>Save the Date!</strong><br/>";
				theContent += "<strong>CLC's Conservation Awards Breakfast is May 19</strong><br/><br>";
				theContent += "<a href='http://www.cascadeland.org/cab/'  class='white'>Join us for the release of <em>The Cascade Agenda</em> </a>";	
				break;
			case 'vision' :
				theContent += "<strong>Save the Date!</strong><br/>";
				theContent += "<strong>CLC's Conservation Awards Breakfast is May 19</strong><br/><br>";
				theContent += "<a href='http://www.cascadeland.org/cab/'  class='white'>Join us for the release of <em>The Cascade Agenda</em> </a>";	
					break;
		}
document.write(theContent);
	}
	var homeBodySrc = new Array(6);
	homeBodySrc[0] = new Image();
	homeBodySrc[0].src = 'images/field.jpg';
	homeBodySrc[1] = new Image();
	homeBodySrc[1].src = 'images/field2.jpg';
	homeBodySrc[2] = new Image();
	homeBodySrc[2].src = 'images/field3.jpg';
	homeBodySrc[3] = new Image();
	homeBodySrc[3].src = 'images/field4.jpg';
	homeBodySrc[4] = new Image();
	homeBodySrc[4].src = 'images/field5.jpg';
	homeBodySrc[5] = new Image();
	homeBodySrc[5].src = 'images/field6.jpg';
	

function getNewHomeImage()
{
	var i = Math.floor(Math.random() * 6);
	window.document.images['homeBodyImage'].src = homeBodySrc[i].src;
}


	var homeBannerSrc = new Array(6);
	homeBannerSrc[0] = new Image();
	homeBannerSrc[0].src = 'images/top_right_01.jpg';
	homeBannerSrc[1] = new Image();
	homeBannerSrc[1].src = 'images/top_right_02.jpg';
	homeBannerSrc[2] = new Image();
	homeBannerSrc[2].src = 'images/top_right_03.jpg';
	homeBannerSrc[3] = new Image();
	homeBannerSrc[3].src = 'images/top_right_04.jpg';
	homeBannerSrc[4] = new Image();
	homeBannerSrc[4].src = 'images/top_right_05.jpg';
	homeBannerSrc[5] = new Image();
	homeBannerSrc[5].src = 'images/top_right_06.jpg';
	homeBannerSrc[6] = new Image();
	homeBannerSrc[6].src = 'images/top_right_07.jpg';
	homeBannerSrc[7] = new Image();
	homeBannerSrc[7].src = 'images/top_right_08.jpg';
	homeBannerSrc[8] = new Image();
	homeBannerSrc[8].src = 'images/top_right_09.jpg';
	homeBannerSrc[9] = new Image();
	homeBannerSrc[9].src = 'images/top_right_10.jpg';

function getNewBannerImage()
{
	var i = Math.floor(Math.random() * 6);
	window.document.images['homeBannerImage'].src = homeBannerSrc[i].src;
}
var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function invi(flag)
{
	if (!DHTML) return;
	var x = new getObj('text');
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}


function move(amount)
{
	if (!DHTML) return;
	var x = new getObj('regionsMenu');
	texttop += amount;
	x.style.top = texttop;
}

function moveDIV(divName, amount)
{
	if (!DHTML) return;
	var x = new getObj(divName);
	x.style.top = amount;
}
function changeCol(col)
{
	if (!DHTML) return;
	var x = new getObj('text');
	x.style.color = col;
}	




function launchPost(cat, username)
{
	var url;
	url = "doPost.aspx?cat="+cat;
	url+= "&username="+username;
	var winName = "Post a Comment";
	if (!gWin || gWin.closed)
	{
		var left = " " + window.screen.width - 850;
		var vWin = window.open( url);
		vWin.opener = self;
		gWin = vWin;
	}	

	gWin.focus();	


}
