//global JS include for all pages.  May consider breaking 
//child content functions into separate include file.

//used for test only.  remove for production			
function showTestBox(){
	var testingBox=document.getElementById("testBox");
		testingBox.style.visibility='visible;'
}

/*////////////////////////////////////////////////////////////////////////////////////
// getURLValue('string')
// used for grabbing query strings from the document href object.  The function 
// looks for the '?' to start its search.  All name value pairs are delimited by '&'
// you pass it a string and the function returns a value...so....
// if your url looks like this:  http://www.foo.com/index.html?fooVals=13&stackCount=9
// calling getURLValue('fooVals'); would retrun 13.
///////////////////////////////////////////////////////////////////////////////////*/
function getURLValue(name) {
	var url = document.location.href; 
	var searchStart = url.indexOf('?');
		if (searchStart < 0){ 
		return null;
	}
	var searchString = url.substring(searchStart+1);
	var namePosition = searchString.indexOf(name);
		if (namePosition < 0){
		return null;
	}
	var pairIndicatorPos = searchString.indexOf('=',(namePosition+1));
		if (pairIndicatorPos < 0){
		return null;
	}	
	var nextDelimitor = searchString.indexOf('&', pairIndicatorPos);
		if (nextDelimitor < 0){ 
		var endOfValue = searchString.length;
	}
		else{
		var endOfValue = nextDelimitor;
	}
		if (pairIndicatorPos == (endOfValue-1)) {
		return null;
	}
	var value = searchString.substring((pairIndicatorPos+1), endOfValue);
	return unescape(value);
}

/* function for swapping the content iFrame
toDo:  consider writing one block of code and passing the argument to complete 
the URL string.  This will work fine for now, but will be a little tough to maintain
*/
function swapContent(contentName){
	var stateName = getURLValue('state');
	if (stateName == 'mn'||stateName == 'mn#'){
		if (contentName == 'back'){
				window.contentFrame.location = 'javascript:history.back(1)';
				}
		if (contentName == 'about'){
				window.contentFrame.location = 'content/mn/mn-about.html';
				}
		if (contentName == 'propLand'){
				window.contentFrame.location = 'content/mn/mn-propLand.html';		
				}
		if (contentName == 'news'){
				window.contentFrame.location = 'content/mn/mn-news.html';		
				}
		if (contentName == 'contact'){
				window.contentFrame.location = 'content/mn/mn-contact.asp';		
				}
		else{
			return false;
		}
	}
	else if (stateName == 'il'){
	if (contentName == 'back'){
				window.contentFrame.location = 'javascript:history.back(1)';
				}
		if (contentName == 'about'){
				window.contentFrame.location = 'content/il/il-about.html';
				}
		if (contentName == 'propLand'){
				window.contentFrame.location = 'content/il/il-propLand.html';		
				}
		if (contentName == 'news'){
				window.contentFrame.location = 'content/il/il-news.html';		
				}
		if (contentName == 'contact'){
				window.contentFrame.location = 'content/il/il-contact.html';		
				}
		else{
			return false;
		}
		
	}
	else if (stateName == 'wi'){
	if (contentName == 'back'){
				window.contentFrame.location = 'javascript:history.back(1)';
				}
		if (contentName == 'about'){
				window.contentFrame.location = 'content/wi/wi-about.html';
				}
		if (contentName == 'propLand'){
				window.contentFrame.location = 'content/wi/wi-propLand.html';		
				}
		if (contentName == 'news'){
				window.contentFrame.location = 'content/wi/wi-news.html';		
				}
		if (contentName == 'contact'){
				window.contentFrame.location = 'content/wi/wi-contact.asp';		
				}
		else{
			return false;
		}
		
	}

else{
		return false;
		}		
}

	
// rollover the header images -- temporary hack that seems to work fine
//  replace with more elegant example when time permits.

function mnrollOn(whichFile){
var currentPage = parent.document.varForm.onImageName.value;
	if (currentPage != whichFile){
		if (whichFile == 'back'){
				document.back.src = 'images/mn/mn-nav-back_on.gif';
				}
		if (whichFile == 'about'){
				document.about.src = 'images/mn/mn-nav-about-on.gif';
				}
		if (whichFile == 'prop'){
				document.prop.src = 'images/mn/mn-nav-prop-on.gif';
				}
		if (whichFile == 'news'){
				document.news.src = 'images/mn/mn-nav-news-on.gif';		
				}
		if (whichFile == 'contact'){
				document.contact.src = 'images/mn/mn-nav-contact-on.gif';		
				}
		else{
			return false;
		}
	}
}

function mnrollOff(whichFile){
	var currentPage = parent.document.varForm.onImageName.value;
		if (currentPage != whichFile){
		
			if (whichFile == 'back'){
					document.back.src = 'images/mn/mn-nav-back.gif';
					}
			if (whichFile == 'about'){
					document.about.src = 'images/mn/mn-nav-about.gif';
					}
			if (whichFile == 'prop'){
					document.prop.src = 'images/mn/mn-nav-prop.gif';
					}
			if (whichFile == 'news'){
					document.news.src = 'images/mn/mn-nav-news.gif';		
					}
			if (whichFile == 'contact'){
					document.contact.src = 'images/mn/mn-nav-contact.gif';		
					}
			else{
				return;
			}
		}
}

function wirollOn(whichFile){
var currentPage = parent.document.varForm.onImageName.value;
	if (currentPage != whichFile){
		if (whichFile == 'back'){
				document.back.src = 'images/wi/wi-nav-back_on.gif';
				}
		if (whichFile == 'about'){
				document.about.src = 'images/wi/wi-nav-about-on.gif';
				}
		if (whichFile == 'prop'){
				document.prop.src = 'images/wi/wi-nav-prop-on.gif';
				}
		if (whichFile == 'news'){
				document.news.src = 'images/wi/wi-nav-news-on.gif';		
				}
		if (whichFile == 'contact'){
				document.contact.src = 'images/wi/wi-nav-contact-on.gif';		
				}
		else{
			return false;
		}
	}
}

function wirollOff(whichFile){
	var currentPage = parent.document.varForm.onImageName.value;
		if (currentPage != whichFile){
		
			if (whichFile == 'back'){
					document.back.src = 'images/wi/wi-nav-back.gif';
					}
			if (whichFile == 'about'){
					document.about.src = 'images/wi/wi-nav-about.gif';
					}
			if (whichFile == 'prop'){
					document.prop.src = 'images/wi/wi-nav-prop.gif';
					}
			if (whichFile == 'news'){
					document.news.src = 'images/wi/wi-nav-news.gif';		
					}
			if (whichFile == 'contact'){
					document.contact.src = 'images/wi/wi-nav-contact.gif';		
					}
			else{
				return;
			}
		}
}


function ilrollOn(whichFile){
var currentPage = parent.document.varForm.onImageName.value;
	if (currentPage != whichFile){
		if (whichFile == 'back'){
				document.back.src = 'images/il/il-nav-back_on.gif';
				}
		if (whichFile == 'about'){
				document.about.src = 'images/il/il-nav-about-on.gif';
				}
		if (whichFile == 'prop'){
				document.prop.src = 'images/il/il-nav-prop-on.gif';
				}
		if (whichFile == 'news'){
				document.news.src = 'images/il/il-nav-news-on.gif';		
				}
		if (whichFile == 'contact'){
				document.contact.src = 'images/il/il-nav-contact-on.gif';		
				}
		else{
			return false;
		}
	}
}

function ilrollOff(whichFile){
	var currentPage = parent.document.varForm.onImageName.value;
		if (currentPage != whichFile){
		
			if (whichFile == 'back'){
					document.back.src = 'images/il/il-nav-back.gif';
					}
			if (whichFile == 'about'){
					document.about.src = 'images/il/il-nav-about.gif';
					}
			if (whichFile == 'prop'){
					document.prop.src = 'images/il/il-nav-prop.gif';
					}
			if (whichFile == 'news'){
					document.news.src = 'images/il/il-nav-news.gif';		
					}
			if (whichFile == 'contact'){
					document.contact.src = 'images/il/il-nav-contact.gif';		
					}
			else{
				return;
			}
		}
}

	
/* ///FIX THIS\\\
function rollOn(whichFile){
	var toolBarOnURL = ('images/mn/mn-nav-'+whichFile+'-on.gif');
	var toolBarCurrentUrl = eval('document.'+whichFile+'.src');
	toolBarCurrentUrl = toolBarOnURL;
}
*/

	
	
function mntmpSwapmn(onOff){
	if (onOff == 'on'){
		document.triggermn.src = 'images/mn/mn-state-mn-on.gif';
		document.mnSlider.src = 'images/mn-slider.gif';
		}
		if (onOff == 'off'){
		document.triggermn.src='images/mn/mn-state-mn-on.gif'
		document.mnSlider.src = 'images/spacer.gif';
		}
	}

function mntmpSwapwi(onOff){
	if (onOff == 'on'){
		document.triggerwi.src = 'images/mn/mn-state-wi-over.gif';
		document.wiSlider.src = 'images/wi-slider.gif';
		}
		if (onOff == 'off'){
		document.triggerwi.src='images/mn/mn-state-wi.gif'
		document.wiSlider.src = 'images/spacer.gif';
		}
	}

function mntmpSwapil(onOff){
	if (onOff == 'on'){
		document.triggeril.src = 'images/mn/mn-state-il-over.gif';
		document.ilSlider.src = 'images/il-slider.gif';
		}
		if (onOff == 'off'){
		document.triggeril.src='images/mn/mn-state-il.gif'
		document.ilSlider.src = 'images/spacer.gif';
		}
	}


function witmpSwapmn(onOff){
	if (onOff == 'on'){
		document.triggermn.src = 'images/wi/wi-state-mn-over.gif';
		document.mnSlider.src = 'images/mn-slider.gif';
		}
		if (onOff == 'off'){
		document.triggermn.src='images/wi/wi-state-mn.gif'
		document.mnSlider.src = 'images/spacer.gif';
		}
	}

function witmpSwapwi(onOff){
	if (onOff == 'on'){
		document.triggerwi.src = 'images/wi/wi-state-wi-on.gif';
		document.wiSlider.src = 'images/wi-slider.gif';
		}
		if (onOff == 'off'){
		document.triggerwi.src='images/wi/wi-state-wi-on.gif'
		document.wiSlider.src = 'images/spacer.gif';
		}
	}

function witmpSwapil(onOff){
	if (onOff == 'on'){
		document.triggeril.src = 'images/wi/wi-state-il-over.gif';
		document.ilSlider.src = 'images/il-slider.gif';
		}
		if (onOff == 'off'){
		document.triggeril.src='images/wi/wi-state-il.gif'
		document.ilSlider.src = 'images/spacer.gif';
		}
	}



function iltmpSwapmn(onOff){
	if (onOff == 'on'){
		document.triggermn.src = 'images/il/il-state-mn-over.gif';
		document.mnSlider.src = 'images/mn-slider.gif';
		}
		if (onOff == 'off'){
		document.triggermn.src='images/il/il-state-mn.gif'
		document.mnSlider.src = 'images/spacer.gif';
		}
	}

function iltmpSwapwi(onOff){
	if (onOff == 'on'){
		document.triggerwi.src = 'images/il/il-state-wi-over.gif';
		document.wiSlider.src = 'images/wi-slider.gif';
		}
		if (onOff == 'off'){
		document.triggerwi.src='images/il/il-state-wi.gif'
		document.wiSlider.src = 'images/spacer.gif';
		}
	}

function iltmpSwapil(onOff){
	if (onOff == 'on'){
		document.triggeril.src = 'images/il/il-state-il-on.gif';
		document.ilSlider.src = 'images/il-slider.gif';
		}
		if (onOff == 'off'){
		document.triggeril.src='images/il/il-state-il-on.gif'
		document.ilSlider.src = 'images/spacer.gif';
		}
	}




