/*
	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-surf/surfscape1_s.jpg", "largeImg" : "foto-surf/surfscape1.jpg" },   
{ "id" : "img2" , "img" : "foto-surf/surfscape5_s.jpg", "largeImg" : "foto-surf/surfscape5.jpg" },
{ "id" : "img3" , "img" : "foto-surf/surfscape6_s.jpg", "largeImg" : "foto-surf/surfscape6.jpg" },
{ "id" : "img4" , "img" : "foto-surf/surfscape7_s.jpg", "largeImg" : "foto-surf/surfscape7.jpg" },
{ "id" : "img5" , "img" : "foto-surf/surfscape8_s.jpg", "largeImg" : "foto-surf/surfscape8.jpg" },
{ "id" : "img6" , "img" : "foto-surf/surfscape11_s.jpg", "largeImg" : "foto-surf/surfscape11.jpg" },
{ "id" : "img7" , "img" : "foto-surf/surfscape10_s.jpg", "largeImg" : "foto-surf/surfscape10.jpg" },
{ "id" : "img8" , "img" : "foto-surf/surfscape3_s.jpg", "largeImg" : "foto-surf/surfscape3.jpg" },
{ "id" : "img9" , "img" : "foto-surf/surfscape2_s.jpg", "largeImg" : "foto-surf/surfscape2.jpg" },
{ "id" : "img10" , "img" : "foto-surf/surfscape9_s.jpg", "largeImg" : "foto-surf/surfscape9.jpg" },
{ "id" : "img11" , "img" : "foto-surf/surfscape4_a_s.jpg", "largeImg" : "foto-surf/surfscape4_a.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"));
				}
			});
	}
}

