// Email window popup with disclaimer static text.
// use: when user clicks and attorney email link
//
function emailWindow(email) {
	window.open("email-popup.php?email=" + email, "EmailNotice", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no,resizable=yes,width=500,height=220");
}

// Bookmark page link, IE only.
// all other browsers displays an alert box.  not sure how detailed we
// want to make this, eg NS, Firefox 'press ctrl+d' message, Mozilla ??
//
function addToFavorites() {
	var ua = navigator.userAgent.toLowerCase(); 
	
	// browser engine name
	this.isGecko   = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
	this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

	// browser name
	this.isKonqueror = (ua.indexOf('konqueror') != -1); 
	this.isSafari  = (ua.indexOf('safari') != - 1);
	this.isOmniweb   = (ua.indexOf('omniweb') != - 1);
	this.isOpera   = (ua.indexOf('opera') != -1); 
	this.isIcab    = (ua.indexOf('icab') != -1); 
	this.isAol   = (ua.indexOf('aol') != -1); 
	this.isIE    = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
	this.isMozilla   = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
	this.isFirebird  = (ua.indexOf('firebird/') != -1);
	this.isFirefox  = (ua.indexOf('firefox/') != -1);
	this.isNS    = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );

	this.versionMajor = parseInt(this.versionMinor);
	this.isMac  = (ua.indexOf('mac') != -1);

	this.isIE5x = (this.isIE && this.versionMajor == 5);
	
	if (window.external && !this.isMac) {
		var url=window.location.href;
		var title=document.title;
		window.external.AddFavorite(url,title)
	} else if (!this.isMac && (this.isNS || this.isFirefox || this.isMozilla)) {
		alert("Press Ctrl+D to bookmark this page."); 
	} else if (this.isMac && (this.isSafari || this.ie5x || this.isMozilla || this.isFirefox ))	{
		alert("Press Apple/Squiggle+D to bookmark this page."); 
	} else {
		alert("Sorry! Your browser doesn't support this function.\nUse your browser's bookmark feature to add a bookmark."); 
	}
}

// Place holder for the 'print this page' link
// s/b replaced when we do the html templates
//
function printPage() {
	window.print();  
}

// 
// NS only
//
function findOnThisPage() {
	window.find();  
}


// preload images
function preloadImages() {
	var imagesToLoad = new Array('images/navAbout_on.jpg', 'images/navContact_on.jpg', 'images/navBonds_on.jpg', 'images/navInsurance.jpg');

	// Don't bother if there's no document.images
	if (document.images) {
		if (typeof(document.WM) == 'undefined') {
			document.WM = new Object();
		}

		document.WM.loadedImages = new Array();

		// Loop through all the arguments.
		var argLength = imagesToLoad.length;

		for(arg=0;arg<argLength;arg++) {
			// For each arg, create a new image.
			document.WM.loadedImages[arg] = new Image();
			// Then set the source of that image to the current argument.
			document.WM.loadedImages[arg].src = imagesToLoad[arg];
		}
	}
}

// goto page
// skip if default value
// see featured.phpl 
function gotoPage(url) {
	if (url != '**')
		window.location = url;
}

function showQuote( quoteNum ) {
	if( quoteNum != 0 )
		hideQuote( 0 );
	
	if( quoteBox = document.getElementById("quoteBox_"+quoteNum) )
		quoteBox.style.display='block';
}

function hideQuote( quoteNum ) {
	if( quoteBox = document.getElementById("quoteBox_"+quoteNum) )
		quoteBox.style.display='none';
		
	if( quoteNum != 0 )
		showQuote( 0 );
}

function setOptionsText(newText) {
	if( arguments.length < 1 )
		newText='Options';

	document.getElementById('optionsText').innerHTML = newText+':';
}

function showMap2() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(40.443699, -80.00480), 13);
		
		function createMarker(latlng, number) {
			var marker = new GMarker(latlng);
			marker.value = number;
			GEvent.addListener(marker,"click",function(){
				var myHTML = "<div class='addy' style='width:215px'><strong>E. R. Munro and Company</strong><br />One Gateway Center, Suite 400<br>420 Fort Duquesne Boulevard<br>Pittsburgh, PA 15222<br /><br /><form method='GET' action='http://maps.google.com/maps' target='_blank'><span style='font-size: 10pt; color: #888'>Get directions to here from:<br /></span><input type='text'  name='saddr' size='25' class=dirbox><input type='hidden' name='daddr' value='420 Fort Duquesne Boulevard,Pittsburgh, PA 15222'> <input type='submit' value='Go'><input type='hidden' name='hl' value='en'></form></span></div>";
				map.openInfoWindowHtml(latlng, myHTML);
				});
			return marker;
		}
				
		var latlng = new GLatLng(40.443699, -80.00480);
		map.addOverlay(createMarker(latlng, 1));
	}
}

function MM_jumpMenu(targ,selObj,restore) { //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_jumpWindow(selObj,restore){ //v3.0
	var url = selObj.options[selObj.selectedIndex].value;
	if (url && url != "#") window.open(url);
	if (restore) selObj.selectedIndex=0;
} 