var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
listMenu.animations[listMenu.animations.length] = FSMenu.animSwipeDown;

function villadoroInit() {
	listMenu.activateMenu('mainmenu');
	
	// Flash text replacement
	if(typeof sIFR == 'function') {
		sIFR.replaceElement(
			named({
				sSelector: '.homepagecopy h2',
				sFlashSrc: siteAssetRoot + 'swf/text.swf',
				sColor: '#0e2b62',
				sLinkColor: '#0e2b62',
				sBgColor: '#fae4ba',
				sWmode: 'transparent',
				sFlashVars: 'offsetTop=6'
			})
		);
	};

	if(SWFObject && document.getElementById('homepageimage')) {
		var so = new SWFObject(siteAssetRoot + 'swf/hero-home.swf', 'flashLogo', '500', '417', '6');
		so.write('homepageimage');
	}
}

function PopupGallery(el) {
	var dimensions = [640, 623];

	var position = [
		((screen.availWidth || screen.width || window.screen.availWidth || window.screen.width) - dimensions[0]) / 2,
		((screen.availHeight || screen.height || window.screen.availHeight || window.screen.height) - dimensions[1]) / 2
	]
	
	window.open(el.href, 'VillaDoroGalleryPopup', 'width=' + dimensions[0] + ',height=' + dimensions[1] + ',left=' + position[0] + ',top=' + position[1] + ',menubar=0,location=0,resizable=1,status=1,toolbar=0');
	
	return false;
}

function launchFLV(el) {
	var dimensions = [635, 560];

	var position = [
		((screen.availWidth || screen.width || window.screen.availWidth || window.screen.width) - dimensions[0]) / 2,
		((screen.availHeight || screen.height || window.screen.availHeight || window.screen.height) - dimensions[1]) / 2
	]
	
	window.open(el.href, 'VillaDoroFLVPlayer', 'width=' + dimensions[0] + ',height=' + dimensions[1] + ',left=' + position[0] + ',top=' + position[1] + ',menubar=0,location=0,resizable=1,status=1,toolbar=0');
	
	return false;
}

addEvent(window, 'load', villadoroInit);