/* Author: Andreas Walter */
/* Company: Euroweb Internet GmbH */
/* Copyright: 2010 - Andreas Walter & Euroweb Internet GmbH */

/* ///////////////////////////////////////////////////////////
	=> mailmask 
/////////////////////////////////////////////////////////// */

function noSpam() {
	if (document.getElementById) {
		var at = "@";
		var links = document.getElementsByTagName('a');
		for (var i = 0; i < links.length; i++) {
			var linkElem = links[i];
			if (linkElem.className == 'escape') {
				var mail = linkElem.firstChild; var domain = linkElem.lastChild;
				mail.nextSibling.firstChild.innerHTML = at;
				linkElem.href = "mailto:" + mail.data + at + domain.data;
			}
		}
	}
}

/* ///////////////////////////////////////////////////////////
	=> smoothScroll 
/////////////////////////////////////////////////////////// */

function smoothScroll() {
	$('a[href*=#header]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				 var targetOffset = $target.offset().top;
				 $('html,body').animate({scrollTop: targetOffset}, 500);
				 return false;
			}
		}
	});
}

/* ///////////////////////////////////////////////////////////
	=> on load 
/////////////////////////////////////////////////////////// */

Cufon.replace(['#content-main h2','#content-main h3','#content-main h4','#content-sidebar h2','#content-sidebar h3','dl.portfolio .head']);
Cufon.replace('#navi li a',{hover: true});
Cufon.replace('#navi-add a',{hover: true});
$(function(){	   
	$("body").addClass("hasJS");
	noSpam();
	smoothScroll();
	$("a[rel='colorbox']").colorbox();
	$("a[rel='lightbox']").colorbox();
});
