function playslideshow(time){
	setTimeout(function(){				
		jQuery.ajax({
			type: "POST",
			url: "scripts/slideshow.php",
			data: "showed=showd",
			success: function (data) {
				var pictures = data.split("|");
				var picture_1 = pictures[0];
				var picture_2 = pictures[1];
				var picture1 = picture_1.split("**********");
				var picture2 = picture_2.split("**********");
				
				var picture1_id = picture1[0];
				var picture1_album = picture1[1];
				var picture1_name = picture1[2];
				
				var picture2_id = picture2[0];
				var picture2_album = picture2[1];
				var picture2_name = picture2[2];
				
				var firstimage = jQuery("div#photoframe div img:eq(0)").attr('src');
				var secondimage = jQuery("div#photoframe div img:eq(1)").attr('src');
				
				if (secondimage != "") {	
					jQuery("div#photoframe div img:eq(1)").animate({'opacity': '0'},2500);			
					setTimeout(function(){
						jQuery("div#photoframe div img:eq(0)").animate({'opacity': '1', 'left': '-40px'},4000);
					},1000);
				} else {
					jQuery("div#photoframe div img:eq(1)").attr({'src': 'album/'+picture2_album+'/'+picture2_name}).css({'display': 'block'});	
					jQuery("div#photoframe div img:eq(1)").animate({'opacity': '1', 'left': '-40px'},4000);	
				}

				setTimeout(function(){
					if (firstimage != "") {	
						jQuery("div#photoframe div img:eq(1)").remove();
						jQuery("div#photoframe div img:eq(0)").before('<img src="" alt="" />');
					}
					jQuery("div#photoframe div img:eq(0)").attr({'src': 'album/'+picture1_album+'/'+picture1_name}).css({'display': 'block'});								
				},1000);
			}
		});
		playslideshow(4000);
	},time);
}

jQuery.noConflict();

jQuery(function(){
	if (jQuery("div#photoframe").length > 0) {
		jQuery("div#photoframe h2").before('<img src="" alt="" /><img src="" alt="" />');
		jQuery("div#photoframe h2").before('<div style="z-index: 0"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="1" height="1"><PARAM NAME=movie VALUE="scripts/audioplay/audioplay.swf?file=http://www.carelschutte.nl/scripts/audioplay/backgroundmusic.mp3&auto=yes&sendstop=yes&repeat=0&buttondir=scripts/audioplay/buttons/classic_small&bgcolor=0x333333&mode=playstop"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#000000><param name="wmode" value="transparent"><embed src="scripts/audioplay/audioplay.swf?file=http://www.carelschutte.nl/scripts/audioplay/backgroundmusic.mp3&auto=yes&sendstop=yes&repeat=0&buttondir=scripts/audioplay//buttons/classic_small&bgcolor=0x000000&mode=playstop" quality=high bgcolor=#000000 width="1" height="1" align="" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></div>');
		playslideshow(0); 
	}
	if (jQuery("div#page-wrap").length > 0) {
		jQuery("div#page-wrap div#maincontent").after('<div id="photobox"></div>');
		jQuery("div#page-wrap ul#categories li a").hover(function(){
			var albumpicture = jQuery(this).attr("class");
			jQuery("div#photobox").html('<img src="'+albumpicture+'" alt="" />').fadeIn(2000);
			jQuery("div#photobox img").fadeIn(800);
		});
		if (jQuery("div.picture").length > 0) {
			jQuery("div.picture:eq(0)").ready(function(){
				var albumpicture = jQuery(this).find("img").attr("src"); 
				jQuery("div#photobox").html('<img src="'+albumpicture+'" alt="" />').fadeIn(0);
				jQuery("div#photobox img").fadeIn(0);		
			});
			/*
			jQuery("div.picture").hover(function(){
				var albumpicture = jQuery(this).find("img").attr("src"); 
				jQuery("div#photobox").html('<img src="'+albumpicture+'" alt="" />').fadeIn(1000);
				jQuery("div#photobox img").fadeIn(400);
			}); 
			*/
		}
	}
});
