try{

function addSpecClass(exp,nClass){
	function is(t){
		return (navigator.userAgent.toLowerCase().indexOf(t)!=-1)
	}
	var htmltag = document.getElementsByTagName('HTML')[0];
	if (is(exp)) htmltag.className += ' ' + nClass;
}

addSpecClass('mac','mac');
addSpecClass('win','win');
addSpecClass('firefox/3','ff3');

}catch(e){}


/*  adding span elements to main navigation for safe using SIFr  */
function menuFix(){
	var el;
	if(document.getElementById("nav-top") != null){
	for(var i = 0; i < document.getElementById("nav-top").getElementsByTagName("li").length; i++){
		el = document.getElementById("nav-top").getElementsByTagName("li")[i];
		if(el.parentNode.className == "top-nav"){
			var oldLink = el.getElementsByTagName("a")[0];
			var span = document.createElement("span");
			var link = document.createElement("a");
		
			link.href = oldLink.href;
			link.innerHTML = oldLink.innerHTML;
		
			span.appendChild(link);
			el.replaceChild(span, oldLink);
		}
	}
	}
}



$(document).ready(function(){
	// hack for flash for all browsers
	function resizeHomeFlash(){
		if ($.browser.version != '6.0')
			if (document.body.offsetWidth < 971)
				{ $('#top-bar').css({width: 976}) }
			else
				{ $('#top-bar').css({width: '100%'}) }
		if ($.browser.msie && $.browser.version == '6.0') { $('#top-bar').css({width: $('#container').width()});}
	}
	resizeHomeFlash();
	$(window).resize(function(){
		resizeHomeFlash();
	});

	$('.secondary-nav li ul').parent().addClass('container-nav-item');

	// mouse hover for inputs (buttons)
	$('input[type=submit]').each(function(){
		if ($(this)[0].className.search('btn') != -1)
		$(this).hover(function() {
			   $(this).addClass('btn-hover')
			   },function(){
			   $(this).removeClass("btn-hover")
		 });
	});

	// tooltip for images
	$('a.tooltip-link').tooltip({
		track: true,
		showURL: false,
		top:-20,
		left: -30,
		id: 'gallery-tooltip'
	});

	// correct height of blocks (snippet-362)
	var nCurrent = 0;
	var nList = $('.snippet362-inner');
	for (var i=0; i < nList.length; i++){
		if (i%2 > 0)
		{
			if (nCurrent < $(nList[i]).height()) nCurrent = $(nList[i]).height();
			$(nList[i]).css({'height':nCurrent});
			$(nList[i-1]).css({'height':nCurrent})
		}else{
			nCurrent = $(nList[i]).height()
		}
	}

	// Accordion-box
	$('.accordion-box').Accordion({ 
		autoheight: false,
		event: 'click',
		header: 'h3',
    	animated: 'slide',
		selectedClass: 'selected',
		active: false,
		alwaysOpen: false
	});
	$('.accordion-box ul li:last').addClass('last');

});
