Event.observe(window, 'load', function() {
	prototypeRemoveBlur('#top');
	prototypeRemoveBlur('#iemploymenu');
	prototypeRemoveBlur('#col-left-buttons'); // buttons in services section
});






function prototypeRemoveBlur(path) {
	if (document.getElementById && document.createTextNode)	{
		var els = $('body').getElementsBySelector(path);
		for (var j = 0; j < els.length; j++) {
			var a = els[j].getElementsByTagName('a');
			for (var i = 0; i < a.length; i++) {
				a[i].onfocus = function() {
					this.blur();
					return false;
				}
			}
		}
	}
}

EmployeMenu = {
	currentID:null, // active button (used to highlight current active button)

	click: function(buttonID) {
		if (this.currentID) {
			$(this.currentID).removeClassName('act');
		}
		this.currentID = buttonID;
		$(this.currentID).addClassName('act');
	},
	showDescr: function() {
		$('demploydescr-container').setStyle({display:'block'});
		fixPNGBg('demploydescr-container');
	}
}

Services = {
	show: function(item) {
		switch (item) {
			case 1:
				$('try-hire').setStyle({display:'none'});
				$('temporary-jobs').setStyle({display:'block'});
				break;
			case 2:
				$('temporary-jobs').setStyle({display:'none'});
				$('try-hire').setStyle({display:'block'});
				sIFR_services();
				break;
		}
	}
}



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='scale');\"></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 h1',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #88181C; }',
	],
	filters: { DropShadow: {knockout:false, distance:2, color:'#333333', strength:0.3} }
});
sIFR.replace(palatino, {
	selector: '.c-firm .frame1-red .content',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #ffffff; font-size: 15px; leading: -3; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-firm .frame3 h2, .c-firm .frame3 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-contact h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #88181C; font-size: 14px; leading: -3 }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-services .content-top h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #88181C; }',
	]
});
function sIFR_services() {
	sIFR.replace(palatino, {
		selector: '.c-services .content-bottom h2',
		wmode: 'transparent',
		css: [
			'.sIFR-root { font-weight: bold; color: #000000; }',
		],
		filters: { DropShadow: {knockout:false, distance:3, color:'#333333', strength:0.3} }
	});
	sIFR.replace(palatino, {
		selector: '.c-services .content-bottom .frame-container h3',
		wmode: 'transparent',
		css: [
			'.sIFR-root { font-weight: bold; color: #88181C; font-size: 15px; leading: -1; }',
		],
		filters: { DropShadow: {knockout:false, distance:3, color:'#333333', strength:0.3} }
	});
}
sIFR_services();

sIFR.replace(palatino, {
	selector: '.c-coop .frame1 h1',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; text-align: right; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-coop .frame1 h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; text-align: right; font-size: 18px; leading: -3; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-coop .frame1 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; font-size: 15px; leading: -3; }',
	]
});
sIFR.replace(palatino, {
	selector: '.c-coop .frame2 h4',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #88181C; font-size: 14px; }',
	],
	filters: { DropShadow: {knockout:false, distance:3, color:'#333333', strength:0.3} }
});

sIFR.replace(palatino, {
	selector: '.c-offers .text p.bodytext',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; font-size: 15px; leading: -3; }'
	]
});

sIFR.replace(palatino, {
	selector: '.c-employ .frame1 h3',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; font-size: 15px; leading: -3; }'
	]
});
sIFR.replace(palatino, {
	selector: '.c-employ .frame2 h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #88181C; text-align: center; font-size: 18px; leading: -3; }',
	]
});

sIFR.replace(palatino, {
	selector: '.c-reg h2',
	wmode: 'transparent',
	css: [
		'.sIFR-root { font-weight: bold; color: #FFE6D4; font-size: 17px; }',
	]
});






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);
		}
