/*
	Example demonstrating usage of the Ajax-ready Sliding Gallery
	Licenses:
	(c) Creative Commons 2006
	http://creativecommons.org/licenses/by-sa/2.5/		
	
	Free to use with my prior permission
	Author: Kevin Hoang Le | http://pragmaticobjects.org
	Date: 2006-06-30
*/

var mainPage = Class.create();
mainPage.prototype = {
	gallery : 0,
	BOX_WIDTH : 840,
	SCROLL_AMOUNT : 150,  //image width
	//SCROLL_AMOUNT : 0, //use individual width
	DISPLAY_IMAGES : 5,
	BACK_IMG : "pics/ico_ff_passiv_li.gif",
	BACK_HOVER_IMG : "pics/ico_ff_aktiv_li.gif",
	BACK_DISABLED_IMG : "pics/ico_ff_nicht.gif",
	FORWARD_IMG : "pics/ico_ff_passiv_re.gif",
	FORWARD_HOVER_IMG : "pics/ico_ff_aktiv_re.gif",
	FORWARD_DISABLED_IMG : "pics/ico_ff_nicht.gif",
	category : 0,
	initialize : function() {
			this.gallery = new gallerySlide(this.BOX_WIDTH, this.SCROLL_AMOUNT, this.DISPLAY_IMAGES, this.BACK_IMG,
			this.BACK_HOVER_IMG, this.BACK_DISABLED_IMG, this.FORWARD_IMG, this.FORWARD_HOVER_IMG,
			this.FORWARD_DISABLED_IMG, "#737373", "#e2001a", this.imageClickEvt);
			
      this.category = {
            "item" :  [

{ "id" : "img1" , "img" : "foto_s/a_galoresophie1_s.jpg", "largeImg" : "foto/a_galoresophie1_l.jpg" },
{ "id" : "img2" , "img" : "foto_s/a_galoresophie2_s.jpg", "largeImg" : "foto/a_galoresophie2_l.jpg" },
{ "id" : "img3" , "img" : "foto_s/a_knauflayout2_s.jpg", "largeImg" : "foto/a_knauflayout2_l.jpg" },
{ "id" : "img4" , "img" : "foto_s/a_knauflayout1_s.jpg", "largeImg" : "foto/a_knauflayout1_l.jpg" },
{ "id" : "img5" , "img" : "foto_s/a_peta_s.jpg", "largeImg" : "foto/a_peta_l.jpg" },
{ "id" : "img6" , "img" : "foto_s/a_yogaloft_s.jpg", "largeImg" : "foto/a_yogaloft_l.jpg" },
{ "id" : "img7" , "img" : "foto_s/a_yogatitel_s.jpg", "largeImg" : "foto/a_yogatitel_l.jpg" },
{ "id" : "img8" , "img" : "foto_s/a_awo1_s.jpg", "largeImg" : "foto/a_awo1_l.jpg" },
{ "id" : "img9" , "img" : "foto_s/a_awo2_s.jpg", "largeImg" : "foto/a_awo2_l.jpg" },
{ "id" : "img10" , "img" : "foto_s/a_awo3_s.jpg", "largeImg" : "foto/a_awo3_l.jpg" },
{ "id" : "img11" , "img" : "foto_s/a_knaufdiamant_s.jpg", "largeImg" : "foto/a_knaufdiamant_l.jpg" },
{ "id" : "img12" , "img" : "foto_s/a_carpediem_s.jpg", "largeImg" : "foto/a_carpediem_l.jpg" },
{ "id" : "img13" , "img" : "foto_s/a_scwerbeagentur_s.jpg", "largeImg" : "foto/a_scwerbeagentur_l.jpg" }

            ]
        };
        this.gallery.render(this.category);
		new Effect.Appear($("largeImage"));
		//preload images with CSS
		this.category.item.each(function(item, i) {
			var image = document.createElement("img");
			image.src = item.largeImg;
			image.style.display = 'none';
			$("preload").appendChild(image);
		});
	},	
	imageClickEvt : function(item, i, obj) {		
		new Effect.Opacity($("aa"),
			{
				duration: 0.5, 
				transition:Effect.Transitions.linear,
				from: 0.5,
				to: 0.0,
				afterFinish:function(effect) {					
					$("aa").src = item.largeImg;
					new Effect.Appear($("aa"));
				}
			});
	}
}
