$(function(){
	//Examples of how to assign the ColorBox event to elements
	$(".video").colorbox({iframe:true, innerWidth:640, innerHeight:390});
	
	//Example of preserving a JavaScript event for inline calls.
	$("#click").click(function(){ 
		$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
		return false;
	});
	
	preload_images('/images/nav-hover.png');
});

Shadowbox.init();

ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

/* Preload Images */
function preload_images() {
	for (var i = 0; i < arguments.length; i++){
		$('<img/>')[0].src = arguments[i];
	};
};


function decode(e,p){return e.replace(/[a-zA-Z]/g,function(c){var a=c.charCodeAt(0)-p;return String.fromCharCode((a<65?a+58:a))}).replace('###','@').replace(/\?/g,'.').replace('%%%',':').split('').reverse().join('')}




$(function(){
	
	$('a[href^=\'e:\']').each(function(){
		var d = decode($(this).attr('href').substr(2),15);
		$(this).attr('href','mailto:'+d);
		if($(this).text() == '') {
			$(this).text(d);
		}
	})

})
