// site specific functions

createMailto = function(pers, domain, customText) {
	var email = pers + '@' + domain;
	(customText == null) ? lnk = email : lnk = customText;
	document.write('<a href="mailto:'+email+'">'+lnk+'</a>');
}

createFlashMovie = function(id, src, width, height, isSolid) {
	var str = '';
	str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+id+'">';
	str += '<param name="allowScriptAccess" value="sameDomain" />\n';
	str += '<param name="movie" value="'+src+'" />\n';
	str += '<param name="quality" value="high" />\n';
	str += '<param name="menu" value="false" />\n';
	if (!isSolid) str += '<param name="wmode" value="transparent" />\n';
	str += '<embed src="'+src+'" quality="high" ';
	if (!isSolid) str += 'wmode="transparent" ';
	str += 'width="'+width+'" height="'+height+'" name="'+id+'" menu="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	str += '</object>\n';
	document.write(str);
}

initNav = function() {
	$('li.nav1').bind("mouseenter", function(e) {
		$(this).addClass('hover');
	}).bind("mouseleave", function(e) {
		$(this).removeClass('hover');
	});
	
	$('li.nav1sub').bind("mouseenter", function(e) {
		$(this).addClass('subhover');
	}).bind("mouseleave", function(e) {
		$(this).removeClass('subhover');
	});
}

initPhotoOverlays = function() {
	var cnt = 1;
	$('.photos').each(function(e) {
		title = '';
		$(this).find('h3:first').each(function(e) { title = $(this).html(); });
		
		$(this).find('img').each(function(e) {
			src = $(this).attr('src'); // alt = $(this).attr('alt');
			$(this).wrap('<a href="'+src+'" rel="sect'+cnt+'" title="'+title+'"></a>')									  
		});
		
		$(this).find('a').each(function(e) {	
			 $(this).colorbox({transition:"elastic", current: "foto {current} / {total}"});	
		});
		cnt++;
	});
}

$(document).ready(function() {
	initNav();
	initPhotoOverlays();
});