// JavaScript Document

window.addEvent('domready', function() {
									 
	if(!window.ie6) {
		page = window.location.href;
		if (page.indexOf('home.htm') > 0) {
			if (Cookie.get('visited') == false) {
			Cookie.set('visited', 'true');
		
			splash1 = new Element('img', { 
				'src': '/images/yellow_flower_foundation_logo.gif', 
				'id': 'splash1', 
				'height': '115', 
				'width': '170'
				});
			
			splash1.injectInside($E('body'));
			splash2 = new Element('div', { 'id': 'splash2' });
			splash2.injectInside($E('body'));
			
			if(window.ie) {
				window.setTimeout(playSplash, 1500);
				}
			else {
				window.addEvent('load', playSplash);
				}
			}
		}
	}
									 
	var navs = $$('#nav a');
	i = 0;
	navs.each(function(item, index) {
		navs[index].addEvent('mouseover', function(){
			navs[index].setStyle('background','url(images/small_yellow_flower.gif) left center no-repeat');
			});
		navs[index].addEvent('mouseout', function(){
			navs[index].setStyle('background','url(images/transparent.gif) left center no-repeat');
			});
		navs[index].setStyle('marginLeft', i*10+5-i*(i-3));
		i = i+1;
		});
	
	if (window.location.href.indexOf('contact.htm') > 0) {
		Cookie.remove('visited');
	}
	
	var imgs = $$('img.left','img.right');
	imgs.each(function(item, index) {
//		alert(imgs[index].getParent().getProperty('href') + ', ' + imgs[index].getParent().getProperty('title'));
		imgs[index].getParent().setProperty('rel', 'lightbox');
//		imgs[index].getParent().setProperty('href', 'Lightbox.show(\'/' + imgs[index].getParent().getProperty('href') + '\', \'' + imgs[index].getParent().getProperty('title')' + '\')');
//		imgs[index].getParent().addEvent('click', function(){
//			alert(imgs[index].getParent().getProperty('href') + ', ' + imgs[index].getParent().getProperty('title'));
//			Lightbox.show('/' + imgs[index].getParent().getProperty('href'), imgs[index].getParent().getProperty('title'));
//			});
//		imgs[index].getParent().setProperty('href', '#');
	});

	
});

window.addEvent('load', function() {
								 
//	var imgs = $$('img.left','img.right');
//	imgs.each(function(item, index) {
//		alert(imgs[index].getParent().getProperty('href') + ', ' + imgs[index].getParent().getProperty('title'));
//		imgs[index].getParent().setProperty('rel', 'lightbox');
//		imgs[index].getParent().addEvent('click', function(){
//			alert(imgs[index].getParent().getProperty('href') + ', ' + imgs[index].getParent().getProperty('title'));
//			Lightbox.show('/' + imgs[index].getParent().getProperty('href'), imgs[index].getParent().getProperty('title'));
//			});
//		imgs[index].getParent().setProperty('href', '#');
//	});

});

function playSplash() {
	window.setTimeout(function() {
	$('splash1').effect('opacity', {duration: 500, transition:Fx.Transitions.linear}).start(0).chain(function() {;
		$('splash2').effect('opacity', {duration: 500, transition:Fx.Transitions.linear}).start(0); });
	}, 1000);
}

