function getXMLCode (url, textOnly) {
  try {    
  	// Firefox, Opera 8.0+, Safari    
	xmlHttp=new XMLHttpRequest(); 
  } catch (e) {    
	  	// Internet Explorer
		try {      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");     
		} catch (e) {      
		  	try	{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {       
			 return false;        
			}      
		}   
	}  
	xmlHttp.onreadystatechange=function() {
   		if(xmlHttp.readyState==4)
       	{
			if (!textOnly) {
				xmlCode = xmlHttp.responseXML.documentElement;
			}
       		xmlText = xmlHttp.responseText;
			return false;
	   	}
	}
   	xmlHttp.open("GET", url, true);
   	xmlHttp.send(null); 
}

function loadNewLink(link) {
	window.open(link); 
	return false;
}

function loadImages(){
   var img
   if (document.images){
      if (!loadedImages) loadedImages = new Array()
      for (var i=0; i < arguments.length; i++){
         img = new Image()
         img.src = arguments[i]
         loadedImages[loadedImages.length] = img
      }
   }
}

function flip(imgName, imgSrc){
   if (document.images){
   	  var theImg = document.getElementById(imgName);
      theImg.src = imgSrc;
   }
}

//Fix Netscape resize bug for mouseDown and mouseUp events.
function forceReload() {
      location.reload()
}
function fixNetscape4(){
   NS4 = document.layers
   NSVer = parseFloat(navigator.appVersion)
   if (NSVer >= 5.0 || NSVer < 4.1) NS4 = false

   if (NS4) onresize = forceReload
}
function loadMap(address) {
  	if (GBrowserIsCompatible()) {
	    map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		geocoder = new GClientGeocoder();
		centerMap (address);
	}
}
function centerMap(address) {
   if (geocoder) {
   	geocoder.getLatLng (address,
   	function(point) {
    	if (!point) {
    		alert(address + " not found");
   			} else {
    			map.setCenter(point, 15);
//				map.setMapType(G_HYBRID_MAP); 
   				var marker = new GMarker(point);
   				map.addOverlay(marker);
   			}
   		}
   	);
   }
}
function generateHoursPopup(link) {
	var newWindow = window.open (link, "hoursWindow", "width=520,height=220,resizable=yes");
	return false;
}
function showHoursPopup() {
	document.getElementById("hours-div").style.display = "block";
	document.getElementById("smartcoverage-logo").style.overflow = "visible";
	return false;
}
function hideHoursPopup() {
	document.getElementById("hours-div").style.display = "none";
	document.getElementById("smartcoverage-logo").style.overflow = "hidden";
	document.getElementById("smartcoverage-logo").style.width = "197px";
	document.getElementById("smartcoverage-logo").style.height = "148px";
	return false;
}
function generateIndustryLeaderPopup(link) {
	var newWindow = window.open (link, "industryLeaderWindow", "width=520,height=260,resizable=yes");
	return false;
}
function generateGMACPopup(link) {
	var newWindow = window.open (link, "industryLeaderWindow", "width=520,height=300,resizable=yes");
	return false;
}
function activateLink(linkPath) {
	var location = window.location.href;
	location = location.replace ("-accepted", "");
	var splitter = location.indexOf("-not-");
	if (splitter > -1) {
		location = location.substring (0, splitter);
	}
	location = location.replace ("-to-cell-phone", "-online");
	location = location.replace ("-pafco", "");
	location = location.replace ("_stndby", "");
	var splitter = location.lastIndexOf("/");
	location = location.substring (splitter + 1);
	splitter = location.indexOf(".");
	if (splitter > -1) {
		location = location.substring (0, splitter);
	}
	var overImage = linkPath + location + "-over.jpg";
	if (location != "marketability-form" && location !="smart-quote-online") {
		document.getElementById(location).src = overImage;
		var overLink = location + "-link";
		overLink = document.getElementById(overLink);
		overLink.onmouseover = null;
		overLink.onmouseout = null;
		overLink.onfocus = null;
		overLink.onblur = null;
	}
}
var loadedImages = null;
var map = null;
var geocoder = null;
var xmlHttp, xmlCode, xmlText, url, readyFlag;
