var in_ie_hell = false;
var in_ie6_hell = false;
var cur_page_size;
var EL_text_field, EL_home_logo, EL_krans;

window.addEvent('domready', function() {
	if(Browser.Engine.trident==true) { 
		in_ie_hell=true; 
		if(Browser.version.toInt()<7) {
			in_ie6_hell = true;
		}
	}
	EL_text_field = $('text_content');
	EL_home_logo = $('site_logo');
	EL_krans = $('kerst_krans');
	make_img_galleries();
});

/* IMG GALLERY */
var page_galleries = new Array();
function create_page_gallery(gallery_id) {
	this.gallery_id = gallery_id;
	this.thumbnails = [];
	this.large_images = [];
	this.captions = [];
}
var NEW_gallery = new create_page_gallery(1);
NEW_gallery.large_images = ['_img/NG-01.jpg', '_img/NG-02.jpg', '_img/NG-03.jpg', '_img/NG-04.jpg', '_img/NG-05.jpg', '_img/NG-06.jpg', '_img/NG-07.jpg', '_img/NG-08.jpg', '_img/NG-09.jpg', '_img/NG-10.jpg', '_img/NG-11.jpg', '_img/NG-12.jpg', '_img/NG-13.jpg', '_img/NG-14.jpg', '_img/NG-15.jpg', '_img/NG-16.jpg', '_img/NG-17.jpg', '_img/NG-18.jpg', '_img/NG-19.jpg', '_img/NG-20.jpg'];
// CAPTIONS
var gal_captions = new Array();
gal_captions[0] = 'Endemol hoofdentree, kerstboom 5 meter hoog, uitvoering basis zilver en wit tinten';
gal_captions[1] = 'Centric Gouda, kerstboom 3 meter hoog, uitvoering basis zilver, wit en rood tinten.';
gal_captions[2] = 'FrieslandCampina bedrijfsrestaurant, muurkerstboom 120 cm, trend tinten.';
gal_captions[3] = 'Ziekenhuis Rijnstate Arnhem, kerstboom 10 meter hoog, trend tinten.';
gal_captions[4] = 'Ziekenhuis AMC Amsterdam, kerstboom 7 meter, goud en oranje tinten.';
gal_captions[5] = 'Ernst &amp; Young Amsterdam, exclusieve decoratie aan bestaande lichtbogen in het restaurant.';
gal_captions[6] = 'Endemol bedrijfsrestaurant, kerstboom 3 meter hoog, uitvoering basis wit en zilver.';
gal_captions[7] = 'Ziekenhuis Slingeland, guirlande uitvoering kinderdecoratie.';
gal_captions[8] = 'Uitvoering kinderdecoratie.';
gal_captions[9] = 'Traditionele kerstkrans met lichtjes, zilveren bokaal met decoratie goud en zilver ca. 60 cm. hoog.';
gal_captions[10] = 'Hof van Twente, kerstboom 5 meter en guirlandes, uitvoering trend goud, rood en oranje.';
gal_captions[11] = 'Voorbeelden kerstpecials.';
gal_captions[12] = 'Endemol restaurant, exclusieve winterprachtdecoratie.';
gal_captions[13] = 'Barlounge, exclusieve decoratie op console.';
gal_captions[14] = 'KPMG, unieke stylistische kerstdecoraties en guirlande exclusief met vilt en druivenranken.';
gal_captions[15] = 'Bedrijfsrestaurant, uitvoering kerstboom exclusief zilver en winterwit.';
gal_captions[16] = 'Voorbeelden uitvoering exclusief collectie.';
gal_captions[17] = 'FrieslandCampina bedrijfsrestaurant, kerstboom 3 meter en muurkerstboom, uitvoering trend tinten.';
gal_captions[18] = 'Ziekenhuis AMC Amsterdam, kerstboom 7 meter, kransen en guirlandes, goud en oranje tinten.';
gal_captions[19] = 'Voorbeelden kerstarrangementen.';

NEW_gallery.captions = gal_captions;
page_galleries[1] = NEW_gallery;

var gal_check_back = true;

function make_img_galleries() {
	if($$('.pic_gallery').length>0) {
		var pic_galleries = $$('.pic_gallery');
		pic_galleries.each(function(pic_gallery) {
			var gal_data = pic_gallery.id.split('-');
			var gal_type = gal_data[0];
			var gal_id = gal_data[1];
			var this_set_image_dimensions = false;

			gal_images = page_galleries[gal_id].large_images;
			gal_captions = page_galleries[gal_id].captions;
			var this_show_captions = true;

			var another_image_gallery = new img_gallery({
				gallery_holder: pic_gallery,
				gallery_images: gal_images,
				gallery_captions: gal_captions,
				show_captions: this_show_captions,
				set_image_dimensions: this_set_image_dimensions,
				update_counter: true,
				counter_el: pic_gallery.getChildren('span.gal_counter')[0],
				auto_play: true,
				caption_el: pic_gallery.getChildren('span.gal_caption')[0]
			});
		});
	}
}
var text_field_state = 'shown';
var fade_text;
function text_field_hider() {
	var gal_controls = $$('a.img_gallery_control');
	gal_controls.addEvent('click', function() {
		if(text_field_state=='shown') {
			fade_text = new Fx.Tween(EL_text_field, {property: 'opacity', duration: 200}).start(1,0).chain(
				function() {
					text_field_state = 'hidden';
					EL_krans.setStyles({
						width: '230px',
						height: '230px',
						top: '470px',
						left: '-40px'
					});
				}
			);
		}
	});
	var home_logo_link = EL_home_logo.getChildren('a')[0];
	home_logo_link.addEvent('click', function() {
		if(text_field_state=='hidden') {
			EL_text_field.fade(0, 1);
			text_field_state = 'shown';
			EL_krans.setStyles({
				width: '185px',
				height: '185px',
				top: '95px',
				left: '710px'
			});
		}
		return false;
	});
}
