/* MAIN NAV ROLLOVERS */

about_on = new Image();      
about_on.src = "http://www.thefocalpoint.com/images/nav/about_on.gif";   

about_off = new Image();      
about_off.src = "http://www.thefocalpoint.com/images/nav/about_off.gif"; 

process_on = new Image();      
process_on.src = "http://www.thefocalpoint.com/images/nav/process_on.gif"; 

process_off = new Image();      
process_off.src = "http://www.thefocalpoint.com/images/nav/process_off.gif"; 

services_on = new Image();      
services_on.src = "http://www.thefocalpoint.com/images/nav/services_on.gif"; 

services_off = new Image();      
services_off.src = "http://www.thefocalpoint.com/images/nav/services_off.gif"; 

clients_on = new Image();      
clients_on.src = "http://www.thefocalpoint.com/images/nav/clients_on.gif"; 

clients_off = new Image();      
clients_off.src = "http://www.thefocalpoint.com/images/nav/clients_off.gif"; 

portfolio_on = new Image();      
portfolio_on.src = "http://www.thefocalpoint.com/images/nav/portfolio_on.gif"; 

portfolio_off = new Image();      
portfolio_off.src = "http://www.thefocalpoint.com/images/nav/portfolio_off.gif"; 

insights_on = new Image();      
insights_on.src = "http://www.thefocalpoint.com/images/nav/insights_on.gif"; 

insights_off = new Image();      
insights_off.src = "http://www.thefocalpoint.com/images/nav/insights_off.gif"; 

contact_on = new Image();      
contact_on.src = "http://www.thefocalpoint.com/images/nav/contact_on.gif"; 

contact_off = new Image();      
contact_off.src = "http://www.thefocalpoint.com/images/nav/contact_off.gif"; 


/* MODAL POPUP NAV */
navback_on = new Image();      
navback_on.src = "http://www.thefocalpoint.com/lib_POP/images/navback_on.gif"; 

navback_off = new Image();      
navback_off.src = "http://www.thefocalpoint.com/lib_POP/images/navback_off.gif"; 

navclose_on = new Image();      
navclose_on.src = "http://www.thefocalpoint.com/lib_POP/images/navclose_on.gif"; 

navclose_off = new Image();      
navclose_off.src = "http://www.thefocalpoint.com/lib_POP/images/navclose_off.gif"; 

navnext_on = new Image();      
navnext_on.src = "http://www.thefocalpoint.com/lib_POP/images/navnext_on.gif"; 

navnext_off = new Image();      
navnext_off.src = "http://www.thefocalpoint.com/lib_POP/images/navnext_off.gif"; 


/* Wall Street Journal Winning Workplace Button */
wwp_on = new Image();      
wwp_on.src = "http://www.thefocalpoint.com/images/buttons/btn_wwp_on.jpg"; 

wwp_off = new Image();      
wwp_off.src = "http://www.thefocalpoint.com/images/buttons/btn_wwp_off.jpg"; 


/* Preload home page quicklink images */
if (document.images)
{
	pic1= new Image(244,149); 
	pic1.src="http://www.thefocalpoint.com/images/pages/829.jpg"; 
	
	pic2= new Image(244,149); 
	pic2.src="http://www.thefocalpoint.com/images/pages/830.jpg"; 
	
	pic3= new Image(244,149); 
	pic3.src="http://www.thefocalpoint.com/images/pages/831.jpg"; 
	
	pic4= new Image(244,149); 
	pic4.src="http://www.thefocalpoint.com/images/pages/832.jpg"; 
	
	pic5= new Image(244,149); 
	pic5.src="http://www.thefocalpoint.com/images/pages/833.jpg"; 
	
	pic6= new Image(244,149); 
	pic6.src="http://www.thefocalpoint.com/images/pages/834.jpg"; 
}

function rollover(id) 
{
	var image = document.getElementById(id);
	image.src = eval(id + '_on.src');
}

function rolloff(id) 
{
	var image = document.getElementById(id);
	
	if (id != parent)
	{
		image.src = eval(id + '_off.src');
	}
}

function imgRollover(id, imgSrc) 
{
	var image = document.getElementById(id);
	image.src = imgSrc;
}

function openURL(url) 
{
	opener.document.location = url;
	self.close();
} 

function opengallerypopup(gallery_id, pages_id, item_id) 
{
	window.open('http://www.thefocalpoint.com/lib_POP/gallerypop.php?gallery_id='+gallery_id+'&pages_id='+pages_id+'&item_id='+item_id+'&print='+1,'_blank', 'menubar=no,scrollbars=no,resizable=no,status=no,width=870,height=520,top=0,left=0');
}

function openteampopup(team_id) 
{
	window.open('http://www.thefocalpoint.com/lib_POP/teampop.php?team_id='+team_id,'_blank', 'menubar=no,scrollbars=yes,resizable=no,status=no,width=600,height=612,top=0,left=0');
}

function openanimationpopup(animations_id) 
{
	window.open('http://www.thefocalpoint.com/lib_POP/animationpop.php?animations_id='+animations_id+'&print='+1,'_blank', 'menubar=no,scrollbars=yes,resizable=no,status=no,width=940,height=570,top=0,left=0');
}

function showContent() 
{
	document.getElementById('contenthide').style.display = 'block';
	document.getElementById('contentloading').style.display = 'none';
}

function load(id, latitude, longitude) 
{
	//<![CDATA[
		
	//the original code had a GMapSidebar to pick the markers from, I eliminated the GMapSidebar,
	//but deleting the code that referenced the bar corrupted the rest of the code
	//so just ignore references to GMapSidebar, unless you're really with JavaScript
	if (GBrowserIsCompatible()) 
	{
		// this variable will collect the html which will eventually be placed in the GMapSidebar
		var GMapSidebar_html = "";
		
		// arrays to hold copies of the markers and html used by the GMapSidebar
		// because the function closure trick doesnt work there
		var gmarkers = [];
		var htmls = [];
		var i = 0;
		// arrays to hold variants of the info window html with get direction forms open
		var to_htmls = [];
		var from_htmls = [];
		
		// A function to create the marker and set up the event window
		function createMarker(point,name,html) {
		var marker = new GMarker(point);
		
		// The info window version with the "to here" form open (The Directions Form part.)
		to_htmls[i] = html + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
		   '<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
		   '<input type="text" size=40 maxlength=40 name="saddr" id="saddr" value="" /><br>' +
		   '<input value="Get Directions" TYPE="submit">' +
		   '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() +
				  // "(" + name + ")" +
		   '"/>';
		// The info window version with the "to here" form open
		from_htmls[i] = html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
		   '<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
		   '<input type="text" size=40 maxlength=40 name="daddr" id="daddr" value="" /><br>' +
		   '<input value="Get Directions" type="SUBMIT">' +
		   '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
				  // "(" + name + ")" +
		   '"/>';
		// The inactive version of the direction info
		html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';
		
		GEvent.addListener(marker, "click", function() {
		  marker.openInfoWindowHtml(html);
		});
		// save the info we need to use later for the GMapSidebar
		gmarkers[i] = marker;
		htmls[i] = html;
		// add a line to the GMapSidebar html
		GMapSidebar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
		i++;
		return marker;
		}
		
		// This function picks up the click and opens the corresponding info window
		function myclick(i) {
		gmarkers[i].openInfoWindowHtml(htmls[i]);
		}
		
		// functions that open the directions forms
		function tohere(i) {
		gmarkers[i].openInfoWindowHtml(to_htmls[i]);
		}
		function fromhere(i) {
		gmarkers[i].openInfoWindowHtml(from_htmls[i]);
		}
		
		//*******************************************************************
		//Edit these options to CONFIGURE THE MAP
		  // create the map
		  var map = new GMap2(document.getElementById("map"));
		  //GLargeMapControl adds large zoom and pan controls on the left,
		  //you can change it by picking from two of the options described below
		  //there is a GSmallMapControl for a smaller pan/zoom control
		  //also there is GSmallZoomControl - a small zoom control (no panning controls)
		  map.addControl(new GLargeMapControl());
		
		  //this adds the Map, Satellite, and Hybrid buttons, delete line if you don't want it
		  map.addControl(new GMapTypeControl());
		
		  //this adds a scale to the bottom left of the map, delete line if you don't want it
		  map.addControl(new GScaleControl());
		
		  //type in the Geo Coordinates and default zoom level below. (Latitude, Longitude), Zoom level);
		  //these Coordinates set the center of the map, they do not place the marker.
		  //that is done in the map.xml file. If you want a marker to be centered, type
		  //the same coordinates here that are used for that marker in the map.xml file
		  //0 is zoomed all the way out.
		   map.setCenter(new GLatLng(latitude, longitude), 15);  
		//*******************************************************************
		
		// Read the data from map.xml
		var request = GXmlHttp.create();
		request.open("GET", "http://www.thefocalpoint.com/includes/map.xml", true);
		request.onreadystatechange = function() 
		{
			if (request.readyState == 4)
			{
				var xmlDoc = request.responseXML;
				// obtain the array of markers and loop through it
				var markers = xmlDoc.documentElement.getElementsByTagName("marker"+id);
				
				for (var i = 0; i < markers.length; i++) 
				{
					// obtain the attribues of each marker
					var lat = parseFloat(markers[i].getAttribute("lat"));
					var lng = parseFloat(markers[i].getAttribute("lng"));
					var point = new GLatLng(lat,lng);
					var html = markers[i].getAttribute("html");
					var label = markers[i].getAttribute("label");
					// create the marker
					var marker = createMarker(point,label,html);
					map.addOverlay(marker);
				}
				// put the assembled GMapSidebar_html contents into the GMapSidebar div
				document.getElementById("GMapSidebar").innerHTML = GMapSidebar_html;
			}
		}
		request.send(null);
	}
	else 
	{
		alert("Sorry, the Google Maps API is not compatible with this browser");
	}
}

function loadAllSWFs()
{
	// Home Main
	var flashvars = false;
	var params = { 
		wmode:"window", 
		quality:"high" 
	};
	var attributes = {	
		id:"home_splash",
		name:"home_splash"
	};

	swfobject.embedSWF("flash/home_splash.swf", "home_splash", "752", "145", "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);
	swfobject.createCSS("#home_splash","outline:none");
	
	// Home Button A
	var flashvars = false;
	var params = { 
		wmode:"window", 
		quality:"high" 
	};
	var attributes = {	
		id:"home_buttonA",
		name:"home_buttonA"
	};

	swfobject.embedSWF("flash/home_buttonA.swf", "home_buttonA", "244", "90", "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);
	swfobject.createCSS("#home_buttonA","outline:none");
	
	// Home Button B
	var flashvars = false;
	var params = { 
		wmode:"window", 
		quality:"high" 
	};
	var attributes = {	
		id:"home_buttonB",
		name:"home_buttonB"
	};

	swfobject.embedSWF("flash/home_buttonB.swf", "home_buttonB", "244", "90", "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);
	swfobject.createCSS("#home_buttonB","outline:none");
	
	// Home Button C
	var flashvars = false;
	var params = { 
		wmode:"window", 
		quality:"high" 
	};
	var attributes = {	
		id:"home_buttonC",
		name:"home_buttonC"
	};

	swfobject.embedSWF("flash/home_buttonC.swf", "home_buttonC", "244", "90", "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);
	swfobject.createCSS("#home_buttonC","outline:none");
}



