
// CSS init (c) Agents.se - v3.3
/*
CSS Browser Selector v0.3.5 (Feb 05, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

// No spam e-mail address v2
function noSpam(a,b,c,d) {
	if (d==null) {
		d = c+'@'+b+'.'+a;
	}
	document.write('<a href="mai'+'lto:'+c+'@'+b+'.'+a+'" class="sticky">'+d+'</a>');
}

// Go to url
function go(a) {
	document.location.href = a;
}
function formgo() {
	document.forms[0].submit();
	return false;
}
function isformgo(e) {
	var keyCode = (window.event) ? e.which : e.keyCode;
	if (e.keyCode == 13) { // Don't run on tab key
		formgo();
	}
}

// Validate form v1
var regEml = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
var regPst1 = /^\d{3}\ \d{2}$/;
var regPst2 = /^\d{5}$/;
var bgok = '#d4ec9f';
var bgerror = '#f5aaaa';

function validate (a,b,c,e) {
	if (e.keyCode != 9 || e.keyCode == null) { // Don't run on tab key
		if (b == "txt") {
			if (a.value.length >= c) a.style.background = bgok;
			else a.style.background = bgerror;
		} else if (b == "eml") {
			if (a.value.match(regEml)) a.style.background = bgok;
			else a.style.background = bgerror;
		} else if (b == "pst") {
			if (a.value.match(regPst1) || a.value.match(regPst2)) a.style.background = bgok;
			else a.style.background = bgerror;
		} else if (b == "drp") {
			if(a.value.length > 0) a.style.background = bgok;
			else a.style.background = bgerror;
		}
		return true;
	}
}

// Jquery easeing
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
	def: 'easeInOutExpo',
	swing: function (x, t, b, c, d) {
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	}
});

// jQuery setup on page load
$(document).ready(function() {
	initslide();
	initobjects();
	autoblur();
});
function autoblur() {
	$(".fwrap input, .fwrap2 input, .fwrap3 input, .fwrap4 input").click(function() {
		this.blur();
	});
	$("select").change(function() {
		$(this).blur();
	});
}

// Toggle div
function toggle(a) {
	if ($("#"+a).is(":hidden")) {
		$("#"+a).slideDown(1000);
	} else {
		$("#"+a).slideUp(700);
	}
	return false;
}

// Slideshow
var slideID = null;
var sliding = false;
function slideshow(a) {
	if (a<9)
	stopslide();
	if (!sliding && !$("#slideshow div").eq(a-1).hasClass("current")) {
		sliding = true;
		var current = $("#slideshow div.current");
		var snavcur = $("#snav a.current");
		// use this to pull the divs in the order they appear in the markup
		if (a==9) {
			next = current.next().length ? current.next() : $("#slideshow div:first");
			snxt = snavcur.next().length ? snavcur.next() : $("#snav a:first");
		} else {
			next = $("#slideshow div").eq(a-1);
			snxt = $("#snav a").eq(a-1);
		}
		current.addClass("prev-current");
		snxt.addClass("current");
		snavcur.removeClass("current");
		next.css({opacity: 0.0}).addClass("current").animate({opacity: 1.0}, 1000, "jswing", function() {
			current.removeClass("current prev-current");
			sliding = false;
		});
	}
	return false;
}
function initslide() {
	if ($("#slideshow").length) {
		slidelength = $("#slideshow div").length;
		if (slidelength>1) {
			a = ' class="current"';
			b = "";
			for (i=1;i<=slidelength;i++) {
				b += '<a href=""'+a+' onclick="return slideshow('+i+');"></a>'
				a = "";
			}
			$("#snav div").html(b);
			slideID = setInterval("slideshow(9)", 7000);
		}
		if ($("#slideshow").attr("class")=="full") {
			$("#header .bg").animate({left:"-225"},{queue:false, duration:1500});
			$("#header ul").animate({left:"-225"},{queue:false, duration:1500});
			$("#snav").css({left: 240}).animate({left:"15"},{queue:false, duration:1500});
		}
	}
}
function stopslide() {
	clearInterval(slideID);
	return false;
}
function initobjects() {
	if ($("#objects").length) {
		$("#objects div a").mouseenter(function() {
			a = $(this).attr("rel");
			if (!document.all) // Mouseout fix for non IE browsers
			$("#"+a).css({opacity: 1.0});
			$("#"+a).slideDown(400, "jswing");
			$("#s"+a).css({opacity: 0.0}).show().animate({opacity: 0.5}, 400, "jswing");
	  }).mouseleave(function(){
			if (!document.all)
			$("#"+a).css({opacity: 0.0});
			$("#"+a).hide();
			$("#s"+a).hide();
	  }).click(function(){
			$("#"+a).hide();
			$("#s"+a).hide();
	  });
	}
}

