function BrowserInfo() {
	var agent = window.navigator.userAgent;
	if (agent.indexOf("MSIE") != -1) {
			var start = agent.indexOf("MSIE");
			this.name = "MSIE";
			this.version = parseFloat(agent.substring(start + 5, agent.indexOf(";", start)));
	} else if (agent.indexOf("Firefox") != -1) {
			var start = agent.indexOf("Firefox");
			this.name = "Firefox";
			this.version = agent.substring(start + 8, agent.length);
			var firstDec = this.version.indexOf(".") + 1;
			while (this.version.indexOf(".", firstDec) != -1)
				this.version = this.version.substring(0, firstDec) + this.version.substring(firstDec).replace(".", "");
			this.version = parseFloat(this.version);
	} else {
			this.name = "Unknown";
			this.version = 0;
	}
}

var info = new BrowserInfo();
var userAgent = window.navigator.userAgent
var isIE = (window.navigator.userAgent.indexOf("MSIE") != -1);
var isIE6 = (info.name == "MSIE" && info.version < 7);
/*var isSafari = (window.navigator.userAgent.indexOf("Safari") != -1);
var isMac = navigator.appVersion.indexOf("Mac")!=-1;*/
var isFireFox = (window.navigator.userAgent.indexOf("Firefox") != -1);
/*var isMacFireFox = isMac && isFireFox;
var is_iPod = navigator.appVersion.indexOf("iPod")!=-1;
var is_iPhone = navigator.appVersion.indexOf("iPhone")!=-1;*/

/*
if (info.name == "MSIE" && info.version < 7)
	document.writeln('<link href="http://theblanchlawfirm.com/index.php/../styles/stylesIE6.css" rel="stylesheet" type="text/css" />');
else
	document.writeln('<link href="http://theblanchlawfirm.com/index.php/../styles/stylesDynamic.css" rel="stylesheet" type="text/css" />');
if (isMac || isSafari)
	document.writeln('<link href="stylesMac.css" rel="stylesheet" type="text/css" />');

if (isMacFireFox)
	document.writeln('<link href="stylesMacFireFox.css" rel="stylesheet" type="text/css" />');

if (is_iPod || is_iPhone)
	document.writeln('<link href="styles_iPod.css" rel="stylesheet" type="text/css" />');*/


function writePngImage(url, width, height, alt) {
	if (!isIE6)
		document.write("<img alt=\"" + alt + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
	else
		document.write("<img src=\"http://theblanchlawfirm.com/index.php/../spacer.png\" style=\"width: " + width + "px; height: " + height + 
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}

function writePngClass(url, width, height, alt, className) {
	if (!isIE6)
		document.write("<img alt=\"" + alt + "\" class=\"" + className + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
	else
		document.write("<img alt=\"" + alt + "\" class=\"" + className + "\"  src=\"http://theblanchlawfirm.com/index.php/../spacer.png\" style=\"width: " + width + "px; height: " + height + 
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}

function writePngImageMap(url, width, height, alt, map) {
	if (!isIE6)
		document.write("<img usemap=\"" + map + "\" alt=\"" + alt + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
	else
		document.write("<img usemap=\"" + map + "\" src=\"http://theblanchlawfirm.com/index.php/../spacer.png\" style=\"width: " + width + "px; height: " + height + 
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}

function renderFlash(src, width, height, features) {
	document.writeln('<embed src="' + src + '" quality="high" bgcolor="#ffffff" width="' + width + 
					 '" height="' + height + '" align="middle" allowscriptaccess="sameDomain" ' +
					 'type="application/x-shockwave-flash" ' + features + 
					 'pluginspage="http://www.macromedia.com/go/getflashplayer" />');
}

function submitForm(id) 
{
	document.getElementById(id).submit();
	return false;
}

String.prototype.trim = function () {
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

reset_form_value = function(str1, str2, val) {
	if(str1 == val.value.trim())
		val.value = str2;
}

	function expandFeaturedMenu(id, open_top, closed_top) {
		if (eval('window.timer_' + id) != undefined) {
			clearTimeout(eval('window.timer_' + id));
			eval("window.timer_" + id + "=undefined");
		}
		
		var obj = document.getElementById(id);
		if (obj.className == "menu_closed") {
			obj.className = "menu_opened";
		
			var anim = CSNGAnim.create({
				objectId: id,
				property: "top",
				speed: 10,
				steps: 25,
				start: closed_top,
				stop: open_top
			});
			anim.start();
		}
	}

	function hideFeaturedMenu(id, open_top, closed_top) {
		if (eval('window.timer_' + id) == undefined) {
			eval('window.timer_' + id + '=' + setTimeout("hideFeaturedMenuEx('" + id + "'," + open_top + "," + closed_top + ")", 500));
		}
	}

	function hideFeaturedMenuEx(id, open_top, closed_top) {
		eval("window.timer_" + id + "=undefined");
		var obj = document.getElementById(id);
		
		var anim = CSNGAnim.create({
			objectId: id,
			property: "top",
			speed: 10,
			steps: 20,
			start: open_top,
			stop: closed_top,
			onComplete: function() { obj.className = "menu_closed"; }
		});
		anim.start();
	}

function hideFeaturedMenu_Form(id, open_top,closed_top) {
      if (document.getElementById("txtThmbName").value != "" || document.getElementById("txtThmbEmail").value != "" ||
	 document.getElementById("txtThmbPhone").value != "" || document.getElementById("txtThmbRegarding").value != "") {return;}
      hideFeaturedMenu(id, open_top, closed_top);
}
