/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
//begin horizontal nav hightlight
function navHighlight (horiz_bkg){
	var id
	if (horiz_bkg == "ab"){id = "b_about_marketing"}
	else if (horiz_bkg == "sr"){id = "b_services_marketing"}
	else if (horiz_bkg == "ww"){id = "b_working_marketing"}
	else if (horiz_bkg == "gs"){id = "b_started_marketing"}
	else {return false;}
	document.getElementById(id).src = "images/build07/" + id + "_.jpg"
	document.getElementById(id).onmouseout = function(){
		document.getElementById(id).src = "images/build07/" + id + "_.jpg"
	}
}
//check if horiz_bkg exists and run the function if true
if(window.horiz_bkg && document.getElementById){navHighlight(horiz_bkg)}
// end horizontal nav hightlight




//make sure the top lines in the content area align on interior pages
if (document.getElementById("right_top_spacer") && document.getElementsByTagName("h2")[0] && document.getElementsByTagName("h2")[0].offsetHeight > 40) {
	document.getElementById("right_top_spacer").style.height = document.getElementsByTagName("h2")[0].offsetHeight - 14 + "px"
}

// set right vertical bar height
if (document.getElementById("body_content") && document.getElementById("body_content").offsetHeight < 358)
document.getElementById("body_content").style.height = "343px" // 15px less because of padding-bottom in style sheet

//safari scroll bar - html { min-height: 100%; margin-bottom: 1px; }



/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
// give alternating colors to tables with the regTbl class
if(document.getElementsByTagName){
	var el = document.getElementsByTagName("TR");
	for(var i=0; i < el.length; i++){
		if(el[i].parentNode.parentNode.className.indexOf("regTbl") != -1){
			if(i%2 == 1){el[i].className = "tblon";} 
			else {el[i].className = "tbloff";}
		}
	}
}




//begin image viewer
function imageViewer (image_path,top,left) {
	
	//var close_window = "<p style='margin-top: 10px; margin-bottom: 0px; text-align: center;'><a href='Close window' onclick='document.getElementById(\"image_viewer\").style.visibility = \"hidden\"; return false;'>Close window</a></p>"
	
	if((top == "") || (top == null))
	{ top = "50" }
	if((left == "") || (left == null))
	{ left = "250" }
	
	document.getElementById("image_viewer").innerHTML = "<p style='margin-top: 10px; margin-bottom: 0px; text-align: center;'><a href='Close window' onclick='hideLayer(\"image_viewer\"); return false;'><img src=" + image_path + " border=\"0\"><br />Close window</a></p>"
	document.getElementById("image_viewer").style.top = top + "px"
	document.getElementById("image_viewer").style.left = left + "px"
	//above code uses hide layer from top of document js file
	//document.getElementById("image_viewer").style.visibility = "visible"
	showLayerOp("image_viewer") //use fade-in from top of document js file

}

if(document.getElementById){
	document.write ("<div id='image_viewer' style='position: absolute; top: 50px; left: 250px; visibility: hidden; background: #ddd9d5; padding: 10px; border: 1px solid #999490'></div>")
}
//end image viewer

if(document.getElementById && !document.all){
	document.getElementById("grand").style.height = document.getElementById("grand").style.height + 1 + "px"
}

// check file name and highlight if it matches a link

var file_name = location.href
// get rid of query string
if (file_name.indexOf('?')!= -1){
		var query = true
		var ques_loc = file_name.indexOf('?')
		var query_string = file_name.substring(ques_loc, file_name.length)
		file_name=file_name.substring(0,ques_loc)
}

// get rid of bookmarks
if (file_name.indexOf('#')!= -1){
		var bm = true
		var bm_loc = file_name.indexOf('#')
		var bookmark = file_name.substring(bm_loc, file_name.length)
		file_name=file_name.substring(0,bm_loc)
}

// loop through all the links
for (check_links = 0; check_links < document.links.length; check_links++) {
	var link_name = document.links[check_links].href	
	// highlight link if it matches filename
	// exclude nn4 and others
		if(document.getElementById){
			if (link_name == file_name) {
				document.links[check_links].style.color='#236fdc';
			}
		}
}


//write out "rate this page" link and links for text sizer
//start of code for text sizer icons
if (document.getElementById("textSizer")) //check to make sure span tag is there before writting to it.
{
	document.getElementById("textSizer").innerHTML =	"Text Size:\
														<a href=\"sdf\" onclick=\"changeStyle(0); return false;\"><img src=\"/images/build07/text_size_sm.gif\" id=\"text_size_sm\" width=\"16\" height=\"15\" alt=\"\" onmouseover=\"hovChange(this.id);\" onmouseout=\"hovChange(this.id)\" /></a>\
														<a href=\"sdf\" onclick=\"changeStyle(1); return false;\"><img src=\"/images/build07/text_size_m.gif\" id=\"text_size_m\" width=\"16\" height=\"15\" alt=\"\" onmouseover=\"hovChange(this.id);\" onmouseout=\"hovChange(this.id)\" /></a>\
														<a href=\"sdf\" onclick=\"changeStyle(2); return false;\"><img src=\"/images/build07/text_size_lg.gif\" id=\"text_size_larg\" width=\"16\" height=\"15\" alt=\"\" onmouseover=\"hovChange(this.id);\" onmouseout=\"hovChange(this.id)\" /></a>"
}
//end of code for text sizer icons
//end section to write out "rate this page" and links for text sizer


//function to rotate images withMouseOvers
function hovChange(id){
	var filename = document.getElementById(id).src
	
	var appendPart
	if(filename.indexOf("?") > -1)
	{
		appendPart = filename.substring(filename.indexOf("?"),filename.length)
		filename = filename.substring(0,filename.indexOf("?"))
	}
	else
	{ appendPart = "" }
	  		
	if(filename.indexOf(".gif") > -1)
	{		
		if(filename.charAt(filename.length-5) == "_")
			{filename = filename.substring(0,filename.length-5) + ".gif" + appendPart}
		else
			{filename = filename.substring(0,filename.length-4) + "_.gif" + appendPart}
	}
	else if(filename.indexOf(".jpg") > -1)
	{
		if(filename.charAt(filename.length-5) == "_")
			{filename = filename.substring(0,filename.length-5) + ".jpg" + appendPart}
		else
			{filename = filename.substring(0,filename.length-4) + "_.jpg" + appendPart}
	}
	
	document.getElementById(id).src = filename
}
