



/********** 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: '#000000', opacity: 0.5, close_on_click: false },
	background: 	'#2F2F2F',
	fontcolor:	'#ffffff',
	border:		'solid gray 1px',
	padding:	'10px',
	image_dir:	'gallery-dark',
	fade_duration:	500,
	morph_duration:	400,
	enable_slideshow: true,
	slideshow_delay: 7000
};



window.addEvent('domready', function() {
	// handle buttons
	new Asset.css('assets/css/buttons.css', { });
	$$('button').each(function(el) {
		if(el.hasClass('plain') || el.hasClass('button')) return;

		var guts = el.innerHTML;
		el.empty();

		new Element('span').addClass('left').inject(el);
		var mid = new Element('span').addClass('mid').inject(el);
		new Element('span').addClass('right').inject(el);

		mid.innerHTML = guts;
		el.addClass('default');

		var icon = el.getAttribute('icon');
		if(icon) {
			new Element('img', {
				'src': 'assets/images/icons/'+icon+'.png'
			}).inject(mid, 'top');
		}

		el.addEvent('mousedown', function() {
			if(Browser.Engine.gecko) this.addClass('pressed');
		});

		el.addEvent('mouseup', function() {
			this.removeClass('pressed');
		});

		el.addEvent('mouseout', function() {
			this.removeClass('pressed');
		});
	});

	// 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() {
	var imgLst = document.getElementsByTagName('img');
	for(var i=0; i<imgLst.length; ++i) {
		if(imgLst[i].getAttribute('hover') == 'true') {
			var pimg = new Image(); pimg.src = imgLst[i].src.replace(/\.png/, '-over.png'); // preload hover image

			$(imgLst[i]).addEvent('mouseover', function() {
				this.src = this.src.replace(/\.png/, '-over.png');
			});
			$(imgLst[i]).addEvent('mouseout', function() {
				this.src = this.src.replace(/-over\.png/, '.png');
			});
		}
	}
});

// handle pngs with the alphapng="true" attribute
window.addEvent('domready', function() {
	if(document.all) {
		var lst = document.getElementsByTagName('img');
		for(var i=0; i<lst.length; ++i) {
			if(lst[i].getAttribute('alphapng')=='true') {
				lst[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='" + lst[i].src + "')";
				lst[i].src = "assets/images/xparent.png";
			}
		}
	}
});





function validate_contact(f) {
	var e = new Errors();
	if(!f.firstname.value) e.add("Please enter your first name.");
	if(!f.lastname.value) e.add("Please enter your last name.");
	if(!validate_email(f.email.value)) e.add("Sorry, Invalid Email Address!");
	//if(!f.address.value) e.add("Please enter your address.");
	//if(!f.city.value) e.add("Please enter your city.");
	//if(f.state.selectedIndex <= 0) e.add("Please select your state.");
	//if(!f.zip.value) e.add("Please enter your zip.");
	//if(f.country.selectedIndex <= 0) e.add("Please select your country.");
	//if(!f.comments.value) e.add("Please enter your comments.");

	return e.alert() ? false : true;
}













function test(v) {
	try {
		console.log(v);
	} catch(e) {};
}




