

window.addEvent('domready', function() {
	$$('div.innermenu-current').each(function(el) {
		el.getElements('div.innermenu-sub').setStyle('display', 'block');


		if(el.hasClass('innermenu-2')) {
			el.getParent('div.innermenu-1').getElements('div.innermenu-sub').setStyle('display', 'block');
		}
	});



});


/********** tell a friend *************/
window.form_friend_options = {
	duration:		700,
	transition:		Fx.Transitions.Cubic.easeOut,
	transition_types:	['morph', 'fade'], // morph, fade
	overlay:		{ color: '#000000', opacity: 0.5, close_on_click: false }
};


/********** optin *************/
window.form_subscribe_options = {
	duration:		700,
	transition:		Fx.Transitions.Cubic.easeOut,
	transition_types:	['morph', 'fade'], // morph, fade
	overlay:		{ color: '#000000', opacity: 0.5, close_on_click: true }
};

/******** gallery **********/
window.gallery_options = {
	overlay: 	{ color: '#000', opacity: 0.6, close_on_click: false },
	background: 	'#fff',
	fontcolor:	'#444',
	border:		'solid gray 1px',
	padding:	'10px',
	image_dir:	'gallery-light',
	fade_duration:	500,
	morph_duration:	400,
	enable_slideshow: true,
	slideshow_delay: 7000
};



//window.addEvent('domready', function() {
//	// handle navlinkhover boxes
//	$$('div.navlinkbox').each(function(el) {
//		el.addEvent('mouseover', function() {
//			this.addClass('navlinkboxhover');
//		});
//		el.addEvent('mouseout', function() {
//			this.removeClass('navlinkboxhover');
//		});
//	});
//});


// handle rollover images
window.addEvent('load', function() {
//	$$('img[rollover=true],input[rollover=true]').each(function(el) {
//		var pimg = new Element('img');
//		pimg.addEvent('load', function() {
//			this.addEvent('mouseover', function() {
//				imageRollover(this);
//			});
//			this.addEvent('mouseout', function() {
//				imageRollout(this);
//			});
//		}.bind(el));
//		pimg.src = el.src.replace(/\.([^\.]+)$/, '-over.$1');
//	});
	$$('img,input').each(function(el) {
		if(!el.getAttribute('rollover')) return;

		var pimg = new Element('img');
		pimg.addEvent('load', function() {
			this.addEvent('mouseover', function() {
				imageRollover(this, (this.getAttribute('rollover') == 'true') ? '' : this.getAttribute('rollover'));
			});
			this.addEvent('mouseout', function() {
				imageRollout(this);
			});
		}.bind(el));
		pimg.src = (el.getAttribute('rollover') == 'true') ? el.src.replace(/\.([^\.]+)$/, '-over.$1') : el.getAttribute('rollover');
	});
});

function imageRollover(that, href) {
	that = $(that);
	if(!that) return;

	that.store('rollback', that.src);

	if(!href) href = that.src.replace(/\.([^\.]+)$/, '-over.$1');
	var tmp = new Element('img');
	tmp.addEvent('load', function() {
		this.src = href;
	}.bind(that));
	tmp.src = href;
}

function imageRollout(that) {
	that = $(that);
	if(!that) return;

	//that.src = that.src.replace(/-over\.([^\.]+)$/, '.$1');
	that.src = that.retrieve('rollback');
}





function t(v) {
	try {
		console.log(v);
	} catch(e) {};
}






