var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
var ISOLDIE = (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7);

/**
 * usage: <img src="image.png" onload="fixPNG(this)" />
 */
function fixPNG(elementID) {
	if (!ISOLDIE) return;

	var myImage = document.getElementById(elementID);
	var imgID = elementID;

	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
	var imgTitle = (myImage.title) ?
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
	var imgStyle = "display:inline-block;" + myImage.style.cssText;
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + myImage.width
        + "px; height:" + myImage.height
        + "px;" + imgStyle + ";"
        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
        + "(src=\'" + myImage.src + "\', sizingMethod='crop');\"></span>";
	myImage.outerHTML = strNewHTML
}

/**
 * usage:
 * <div id="my-div-with-png">....</div>
 * <script type="text/javascript">
 *   fixPNGDiv('my-div-with-png');
 * </script>
 */
function fixPNGBg(elementID) {
	if (!ISOLDIE) return;

	var sizingMethod = arguments[1] == 'scale' ? 'scale' : 'crop';

	var obj = document.getElementById(elementID);
	if (!obj) {
		alert('FIXPNG: Cant find element #'+elementID+'!');
		return;
	}

	if (obj.currentStyle.width.match(/px/) == null) {
		alert('FIXPNG: You must set WIDTH style property for element #'+elementID+'!');
		return;
	}

	if (obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
		fnFixPng(obj, sizingMethod);
		obj.attachEvent("onpropertychange", fnPropertyChanged);
	}
}

function fnPropertyChanged() {
	if (window.event.propertyName == "style.backgroundImage") {
			var el = window.event.srcElement;
			if (!el.currentStyle.backgroundImage.match(/clear\.gif/i)) {
				var bg	= el.currentStyle.backgroundImage;
				var src = bg.substring(5,bg.length-2);
				el.filters.item(0).src = src;
				el.style.backgroundImage = "url('/clear.gif')";
			}
	}
}

function fnFixPng(obj, sizingMethod) {
	var bg	= obj.currentStyle.backgroundImage;
	var src = bg.substring(5,bg.length-2);
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='"+sizingMethod+"')";
	obj.style.backgroundImage = "url('/clear.gif')";
}




var palatino = {
	src: '/flash/palatino_sifr3.swf',
	ratios: []
};

sIFR.delayCSS  = true;
sIFR.activate(palatino);

sIFR.replace(palatino, {
	selector: '.c-firm .frame1 h1, .c-firm .frame1 h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-firm .frame1 .indent',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; leading: -3; font-size: 18px; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-firm .frame2 h2, .c-firm .frame2 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-experts .frame1 h1, .c-experts .frame1 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-account .frame1 h2, .c-account .frame1 h3, .c-account .frame3 h4',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; leading: -3; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-staff .frame1 h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; leading: -2; text-align: right; font-size: 16px; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-staff .frame1 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #99252F; leading: -3; text-align: right; font-size: 14px; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-links h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #871F28; text-align: center; font-size: 14px; }',
	]
});




var browserName = navigator.appName;
		var browserVer = parseInt(navigator.appVersion);
		var version = "";
		var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
		if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}
			// Blurring links:
		function blurLink(theObject)	{	//
			if (msie4)	{theObject.blur();}
		}

			// decrypt helper function
		function decryptCharcode(n,start,end,offset)	{
			n = n + offset;
			if (offset > 0 && n > end)	{
				n = start + (n - end - 1);
			} else if (offset < 0 && n < start)	{
				n = end - (start - n - 1);
			}
			return String.fromCharCode(n);
		}
			// decrypt string
		function decryptString(enc,offset)	{
			var dec = "";
			var len = enc.length;
			for(var i=0; i < len; i++)	{
				var n = enc.charCodeAt(i);
				if (n >= 0x2B && n <= 0x3A)	{
					dec += decryptCharcode(n,0x2B,0x3A,offset);	// 0-9 . , - + / :
				} else if (n >= 0x40 && n <= 0x5A)	{
					dec += decryptCharcode(n,0x40,0x5A,offset);	// A-Z @
				} else if (n >= 0x61 && n <= 0x7A)	{
					dec += decryptCharcode(n,0x61,0x7A,offset);	// a-z
				} else {
					dec += enc.charAt(i);
				}
			}
			return dec;
		}
			// decrypt spam-protected emails
		function linkTo_UnCryptMailto(s)	{
			location.href = decryptString(s,-1);
		}
