jQ(document).ready(function() {
	
	jQ('#contentContainer').prepend('<div id="preloader1"><div id="spinner1"></div>');
	jQ("#spinner1").spinner({height: 48, width: 48, speed: 50});

	/*
	* BACKSLIDE MAIN FUNCTION
	* MAIN HOVER FOR BACKSLIDE ANIMATION
	*/
	backSlideHoverSidebar	= "0";
	backSlideHoverContent	= "0";
	backSlideHoverBoth		= "0";
	backSlideSpeed			= "9000";
	theBackground			= 0;
	precount_BlogPosts		= 0;
	NavTriggerOpen			= 0;
	
	theTitle				= jQ('meta[@name=backslide]').attr("content");
	if (theTitle !== undefined){
		theTitle			= theTitle.split('#');
	} else { theTitle = 0;}
	
	checkTheSidebarTitle	= jQ(".theSidebarTitle").html();
	if(checkTheSidebarTitle == false) { jQ("h1.theSidebarTitle").remove(); jQ("#sidebar").css({paddingTop:"0"});}
	
	
	
	PayLoomProducts			= jQ('meta[@name=payloom]').attr("content");
	CollageFrames			= jQ('meta[@name=collage2]').attr("content");
	TestNP					= jQ('meta[@name=page]').attr("content");

	if (jQ('meta[@name=bliptv]').length) {
		MyBlibTV			= jQ('meta[@name=bliptv]').attr("content");
	} else { MyBlibTV = 0;}
	
	
	theUrl					= document.URL;
	splitUrl				= theUrl.split('/');
	urlFilename				= splitUrl[splitUrl.length-1];
	urlDocument				= urlFilename.split('.');
	urlPfad					= theUrl.replace(urlFilename, '');
	urlPfadLast				= splitUrl[splitUrl.length-2];
	DeaktPhotoAlbum			= 0;
	relPfad					= 0;
	BlogNoCatList			= 0;
	NavTriggerOpen			= 0;
	COMPBlogRapid			= 0;
	PhotoAlbumDimmer		= -1;
	PhotoAlbumAniSlide		= -1;
	PhotoAlbumAniFade		= -1;
	PhotoAlbumDescription	= "yes";
	PhotoPhotoDescription	= "yes";
	
	jQ('link[@rel=stylesheet]').each(function() 
	{
		var href					= jQ(this).attr('href');
		var searchSidebar			= href.search(/Backslide_Dimmer_Sidebar.+/);
		var searchContent			= href.search(/Backslide_Dimmer_Content.+/);
		var searchSpeed5			= href.search(/Backslide_05.+/);
		var searchSpeed15			= href.search(/Backslide_15.+/);
		var searchSpeed20			= href.search(/Backslide_20.+/);
		var TempDeaktPhotoAlbum		= href.search(/PhotoAlbumNull.+/);
		var TempPhotoAlbumDimmer	= href.search(/rw_PhotoAlbum_dimmer.+/);
		var TempPhotoAlbumAniSlide	= href.search(/rw_PhotoAlbum_slide.+/);
		var TempPhotoAlbumAniFade	= href.search(/rw_PhotoAlbum_fade.+/);
		var TempNavTriggerOpen		= href.search(/NavTriggerOn.+/);
		var TempCOMPBlogRapid		= href.search(/rw_blopage_Compatibility.+/);
		var TempRoundCorner			= href.search(/roundCorner.+/);
		
		var TempPhotoAlbumDescription	= href.search(/rw_PhotoAlbum_off-album-description.+/);
		var TempPhotoPhotoDescription	= href.search(/rw_PhotoAlbum_off-photo-description.+/);
		
		var TempBlogNoCatList		= href.search(/rw_blopage_hidecatList.+/);
		
		if (TempRoundCorner != -1) { 
			jQ('#backslide').livequery( function(){
				jQ(this).css('-moz-border-radius', '20px');
				jQ(this).css('-webkit-border-radius', '20px');
				jQ(this).css('overflow', 'hidden');
			});
			jQ('#backslide ul img').livequery( function(){
				jQ(this).css({display: "none"});
			});

			jQ('#backslide ul li:first').livequery( function(){
				jQ(this).addClass("active");
			});

			jQ('#backslide ul li.active img').livequery( function(){
				var backSlideBack = jQ(this).attr('src');
				jQ("#backslide").css({background: 'url('+ backSlideBack +') no-repeat'});
			});
		}

		if (TempNavTriggerOpen != -1) { NavTriggerOpen = 1; }
		if (TempDeaktPhotoAlbum != -1) { DeaktPhotoAlbum = 1;}
		if (TempBlogNoCatList != -1) { BlogNoCatList = 1; } 
		if (TempCOMPBlogRapid != -1) { COMPBlogRapid = 1; } 
		
		
		if (searchSidebar != -1) { backSlideHoverSidebar = 1;}			
		if (searchContent != -1) { backSlideHoverContent = 1;}		
		if (searchSpeed5 != -1) { backSlideSpeed = 5000;}
		if (searchSpeed15 != -1) { backSlideSpeed = 15000;}
		if (searchSpeed20 != -1) { backSlideSpeed = 20000;}
		
		if (TempPhotoAlbumDimmer != -1) { PhotoAlbumDimmer = 1; }
		if (TempPhotoAlbumAniSlide != -1) { PhotoAlbumAniSlide = 1; } 
		if (TempPhotoAlbumAniFade != -1) { PhotoAlbumAniFade = 1; }
		
		if (TempPhotoAlbumDescription != -1) { PhotoAlbumDescription = 1; } 
		if (TempPhotoPhotoDescription != -1) { PhotoPhotoDescription = 1; }
		
		

	});
	
	backSlideHoverBoth		= backSlideHoverSidebar+backSlideHoverContent;
	
	if (backSlideHoverBoth == 2) {
			jQ("#contentContainer").hover( function () {
				jQ("#backslide").fadeTo("normal", 0.3);}, function () {
				jQ("#backslide").fadeTo("normal", 1);
				});
		} else if (backSlideHoverSidebar != 0) {
			jQ("#sidebarContainer").hover( function () {
				jQ("#backslide").fadeTo("normal", 0.3);}, function () {
				jQ("#backslide").fadeTo("normal", 1);
				});
		} else if (backSlideHoverContent != 0) {
			jQ("#content").hover( function () {
				jQ("#backslide").fadeTo("normal", 0.3);}, function () {
				jQ("#backslide").fadeTo("normal", 1);
				});
		}
	
	
	/*
	* FLASH-SLIDESHOW (RAPIDWEAVER)
	* RESIZE FOR THE FLASH CONTENT
	*/
	jQ("#flashcontent").livequery( function() {
		var FlashHeight = jQ("#flashcontent").width();
		if (FlashHeight > 800) {		
			jQ("#contentContainer #content").css({
				width: "970px",
				height: "540px",
				float: "none",
				padding: "5px"
			});
		}
	});
	/*
	* CREATE THE MENUE
	* MAKE ALL WHAT IS NEEDED
	*/	
	widthNav = jQ("#navcontainer").width()+20;
	jQ("#contentMover").hide().css({opacity: 0.9});
	jQ("#contentContainer").prepend('<div id="navcontainerTrigger" class="turnon"></div>');
	jQ("#navcontainerTrigger").css({cursor: "pointer"});
	setInterval( "BumbNav()", 1000);

	
	/*MENUE IN*/
	if(NavTriggerOpen == 1) {
		jQ("#navcontainerTrigger.turnon").mouseover( function(){ 
			jQ(".movie-frame").hide("fast");
			jQ("#navcontainerTrigger").removeClass("turnon");
			jQ("#navcontainerTrigger").addClass("turnoff");
			jQ("#contentMover").fadeIn();
			jQ("#closeTrigger").fadeTo("slow", 0.33);
		});	
	
	} else {
		jQ("#navcontainerTrigger.turnon").click( function(){ 
			jQ(".movie-frame").hide("fast");
			jQ("#navcontainerTrigger").removeClass("turnon");
			jQ("#navcontainerTrigger").addClass("turnoff");
			jQ("#contentMover").fadeIn();
			jQ("#closeTrigger").fadeTo("slow", 0.33);
		});	
	}
	
	/*MENU OFF*/	
	jQ("#navcontainerTrigger.turnoff").livequery('click', function(){ 
		widthNav = jQ("#navcontainer").width()+20;
		jQ("#navcontainerTrigger").removeClass("turnoff");
		jQ("#navcontainerTrigger").addClass("turnon");
		jQ("#contentMover").fadeOut("normal");
		jQ("#closeTrigger").fadeTo("slow", 1);
		if (jQ.browser.msie) { jQ("embed, object").fadeIn("slow"); }
		jQ(".movie-frame").show("fast");		
	});
	
	/*Animate*/
	jQ("#navcontainer ul li").addClass('level1');
	jQ("#navcontainer ul li li").removeClass('level1');
	jQ("#navcontainer ul li.level1").append('<br class="clearer"/>');
	countNav = 0;
	jQ("#navcontainer ul li.level1").each( function(){countNav = countNav+1;});	
	jQ("#navcontainer ul ul").each( function(){countNav = countNav+1;});	
	
	countAktNav	= 0;
	countAllNav = 0;
	NavPage		= 0;
	jQ("#navcontainer ul li.level1").each( function(){
		if(countAktNav == 14 || countAktNav > 14 || countNav == countAllNav) { 
			jQ("#navcontainer").append('<div rel="navpagesplit"><ul id="NavBlock'+NavPage+'"></ul></div>');
			jQ("#navcontainer ul li.page"+NavPage).appendTo('ul#NavBlock'+NavPage);
			countAktNav = 0;
			NavPage = NavPage+1;
		}
		countAktNav = countAktNav+1;
		countAllNav	= countAllNav+1;
		jQ("ul", this).each( function(){
			countAktNav = countAktNav+1;
			countAllNav	= countAllNav+1;
		});
		jQ(this).addClass("page"+NavPage);
		
		if(countNav == countAllNav) { 
			jQ("#navcontainer").append('<div rel="navpagesplit"><ul id="NavBlock'+NavPage+'"></ul></div>');
			jQ("#navcontainer ul li.page"+NavPage).appendTo('ul#NavBlock'+NavPage);
			countAktNav = 0;
		}

	});
	
	/*
	* LINKS FOR FACEBOX
	* FOTO ALBUM
	*/
	jQ('a[@rel=foto]').each(function() {
		var BackHref	= jQ(this).attr('href');
		var BackSplit	= BackHref.split('/');
		var BackFile	= BackSplit[BackSplit.length-1];
		var BackHref	= BackHref.replace(BackFile, '');
		var BackFile	= BackFile.split('.');
		var BackFile	= BackFile[0]+'.jpg';
		var theBackg	= BackHref+BackFile;
		jQ(this).attr('href', theBackg);
	});
	jQ('a[@rel=photo]').each(function() {
		var BackHref	= jQ(this).attr('href');
		var BackSplit	= BackHref.split('/');
		var BackFile	= BackSplit[BackSplit.length-1];
		var BackHref	= BackHref.replace(BackFile, '');
		var BackFile	= BackFile.split('.');
		var BackFile	= BackFile[0]+'.jpg';
		var theBackg	= BackHref+BackFile;
		jQ(this).attr('href', theBackg);
	});	

	/*
	* LINKS FOR FACEBOX
	* YOUTUBE
	*/
	jQ('a[@rel=youtube]').each(function() {
		var YoutubeLink = jQ(this).attr('href');
		jQ(this).removeAttr('href');
		jQ(this).css({cursor: "pointer"});
		jQ(this).click(function(){
			jQ.facebox('<div id="youtubeVideo" style="width:425px; height:350px"></div>');
			var so = new SWFObject(YoutubeLink, "youtube", "425", "350", "7");
			so.write("youtubeVideo");
		});
	});
	
	jQ('a[@rel=bliptv]').each(function() {
		var blibtv			= jQ(this).attr('href');
		var blibtv			= blibtv.split('[s]');
		var blibtvVidLink	= blibtv[0];
		var blibtvLink		= blibtv[1].split('x'); 
		//jQ(this).removeAttr('href');
		jQ(this).attr('href', "#");
		jQ(this).css({cursor: "pointer"});
		jQ(this).click(function(){
			jQ.facebox('<div id="blibTVvideo" style="width:'+blibtvLink[0]+'px; height:'+blibtvLink[1]+'px"></div>');
			var so = new SWFObject(blibtvVidLink, "blibtv", blibtvLink[0], blibtvLink[1], "7");
			so.write("blibTVvideo");
		});
	});

	jQ('a[@rel=bliptvOverlay]').each(function() {
		var blibtv			= jQ(this).attr('href');
		var blibtv			= blibtv.split('[s]');
		var blibtvVidLink	= blibtv[0];
		var blibtvLink		= blibtv[1].split('x'); 
		//jQ(this).removeAttr('href');
		jQ(this).attr('href', "#");
		jQ(this).css({cursor: "pointer"});
		jQ(this).click(function(){
			jQ("#contentContainer").prepend('<div id="movieHolder"><div id="flvVideoPlayer" style="width:980px; height:550px;"></div></div>');
			var so = new SWFObject(blibtvVidLink, "blibtv", "980", "550", "7");
			so.write("flvVideoPlayer");
			jQ("#navcontainerTrigger").css("display","none");
			jQ("#movieHolder").prepend('<div id="closeMovieOverlay" class="left"></div>');
		});
	});	
	
	jQ('a[@rel=flv]').each(function() {
		var FLVLink		= jQ(this).attr('href');
		var FLVLink		= FLVLink.split('[s]');
		var FLVVidLink	= FLVLink[0];
		var FLVLink		= FLVLink[1].split('x');  
		var SetFlvL		= (370-(FLVLink[1]*1))/2;
		var SetFlvT		= (780-(FLVLink[0]*1))/2;

		//jQ(this).removeAttr('href');
		jQ(this).attr('href', "#");
		jQ(this).css({cursor: "pointer"});
		jQ(this).click(function(){
			if(splitUrl[0] != 'private:' ) {
			jQ.facebox('<div id="flvBoxVideoPlayer" style="width:780px; height:370px"></div>');
			var so = new SWFObject(videoPlayerS, "flvplayer", "780", "370", "7");
			so.addVariable("video", FLVVidLink);
			so.addVariable("var1", FLVLink[0]);
			so.addVariable("var2", FLVLink[1]);
			so.addVariable("var3", SetFlvT);
			so.addVariable("var4", SetFlvL);
			so.write("flvBoxVideoPlayer");
			} else { jQ.facebox('<div style="width:400px; background: black"><h1>The preview will not work in Rapidweaver</h1></div>'); }
		});
	});		
	
	jQ('a[@rel=flvOverlay]').each(function() {
		var FLVLink		= jQ(this).attr('href');
		var FLVLink		= FLVLink.split('[s]');
		var FLVVidLink	= FLVLink[0];
		var FLVLink		= FLVLink[1].split('x');  
		var SetFlvL		= (550-(FLVLink[1]*1))/2;
		var SetFlvT		= (980-(FLVLink[0]*1))/2;

		//jQ(this).removeAttr('href');
		jQ(this).attr('href', "#");
		jQ(this).css({cursor: "pointer"});
		jQ(this).click(function(){
		if(splitUrl[0] != 'file:' ) {
			jQ("#contentContainer").prepend('<div id="movieHolder"><div id="flvVideoPlayer" style="top:20px;width:980px; height:530px;"></div></div>');
			var so = new SWFObject(videoPlayerF+'?video=FLVVidLink', "flvplayer", "980", "530", "7");
			so.addVariable("video", FLVVidLink);
			so.addVariable("var1", FLVLink[0]);
			so.addVariable("var2", FLVLink[1]);
			so.addVariable("var3", SetFlvT);
			so.addVariable("var4", SetFlvL);
			so.write("flvVideoPlayer");	
			jQ("#navcontainerTrigger").css("display","none");
			jQ("#movieHolder").prepend('<div id="closeMovieOverlay"></div>');
			} else { jQ.facebox('<div style="width:400px; background: black"><h1>The preview will not work in Rapidweaver</h1></div>'); }
		});		
	});
	
	jQ('a[@rel=overlay]').each(function() {
		var BackHref	= jQ(this).attr('href');
		var BackSplit	= BackHref.split('/');
		var BackFile	= BackSplit[BackSplit.length-1];
		var BackHref	= BackHref.replace(BackFile, '');
		var BackFile	= BackFile.split('.');
		var BackFile	= BackFile[0]+'.jpg';
		var theBackg	= BackHref+BackFile;
		
		jQ(this).attr('href', "#");
		//jQ(this).removeAttr('href');
		jQ(this).css({cursor: "pointer"});		
		jQ(this).click(function(){
			jQ("#contentContainer").prepend('<div id="movieHolder"><div id="flvVideoPlayer" style="top:0px;width:980px; height:550px;"><img src="'+theBackg+'"/></div></div>');
			jQ("#navcontainerTrigger").css("display","none");
			jQ("#movieHolder").prepend('<div id="closeMovieOverlay"></div>');
		});		
	});	
	
	jQ("#closeMovieOverlay").livequery( function(){ 
		jQ(this).click(function(){
			jQ("#movieHolder").remove();
			jQ("#navcontainerTrigger").css("display","block");
		});
	});
				
/* ************************************************
* 
*	END DOCUMENT READY
*
************************************************ */	
});



/*
* BACKSLIDE IMAGES (RAPIDWEAVER FLASH PHOTOALBUM)
* LOAD MAX 5 IMAGES
*/
jQ(function () {
	if (theTitle !== undefined){
	relPfad = jQ('meta[@name=homepage]').attr("content");
	/*ONLY TO HAVE A PREVIEW IN RAPIDWEAVER*/
	if(splitUrl[0] == 'file:' ) {
		base_url = '';
		if(theTitle[2] == "root"){ debug('Backslide','is filed in root - <em>'+theTitle[1]+'</em>');}
	}
	
	if(theTitle[2] != "root"){
		if(relPfad =='index'){ relPfad = theTitle[1]+'/files/'; } else { relPfad = theTitle[1]+'/files/'; }
	} else { relPfad = base_url+theTitle[1]+'_files/';  }
	}
	
	if(jQ('a[@background]').length) {
		var images		= new Array();
		var ImgCount	= 0;
		jQ('a[@background]').each( function(){
			
			var BackHref	= jQ(this).attr('href');
			var BackSplit	= BackHref.split('/');
			var BackFile	= BackSplit[BackSplit.length-1];
			var BackHref	= BackHref.replace(BackFile, '');
			var BackFile	= BackFile.split('.');
			var BackFile	= BackFile[0]+'.jpg';
			var theBackg	= BackHref+BackFile;
			images[ImgCount]	= theBackg;

			ImgCount		= ImgCount+1;
		});

		jQ('a[@background]').remove();
		
		
	} else { theBackground = 1;}
	
	if (theBackground == 1) {
	/*	Images to load								*/
	/*---------------------------------------------	*/
	var images = new Array();
		images[0] = relPfad+theTitle[1]+'-1000-full.jpg';
		images[1] = relPfad+theTitle[1]+'-1001-full.jpg';
		images[2] = relPfad+theTitle[1]+'-1002-full.jpg';
		images[3] = relPfad+theTitle[1]+'-1003-full.jpg';
		images[4] = relPfad+theTitle[1]+'-1004-full.jpg';
	/*	Check Images if exist 						*/
	/*---------------------------------------------	*/
	}

	var max = jQ(images).length;

	var errorCount = 0;
			// at least 1 image exist
			if(max>0 && theTitle[0] !== undefined || max>0 && theBackground === 0 )
			{
				var ul = jQ('<ul id="portfolio"></ul>');
				jQ(ul).appendTo(jQ('#backslide'));
				LoadImage(0,max);
			}
			
	/*	Function of loading image					*/
	/*	params: (int) index of image in array,		*/
	/*	(int) length of images array				*/
	/*---------------------------------------------	*/
	function LoadImage(index,max)
		{	
			// if current index is lower then max element (max-1)
			if(index<max)
				{
					// create the LI, add loading class
					var list = jQ('<li id="portfolio_'+index+'"></li>').attr('class','loading');
					// append to UL
					jQ('ul#portfolio').append(list);
					// current LI
					var curr = jQ("ul#portfolio li#portfolio_"+index);
					// new image object
					var img = new Image();
					// image onload
					jQ(img).load(function () {
						jQ(this).css('display','none'); // since .hide() failed in safari
						jQ(curr).removeClass('loading').append(this);
						jQ(this).fadeIn('slow',function(){
								// once the current loaded, trigger the next image
								LoadImage(index+1,max);
							});
					}).error(function () {
						// on error remove current
						jQ(curr).remove();					
						LoadImage(index+1,max);
					}).attr('src', images[index]);
				} else {
					var lastLiID	= jQ("ul#portfolio li:last").attr("id");
					var NoSlide		= "portfolio_0";
					
					if (lastLiID == "portfolio_0") {
						} else { setInterval( "slideSwitch()", backSlideSpeed ); }
				} 
		}
	
});

/*
* Some nice stuff
* blockquotes usw.
*/

jQ(document).ready(function() {

	blockquoteSign = jQ('meta[@name=blockquote]').attr("content");

	if(blockquoteSign !== undefined) {
		blockquoteSign = blockquoteSign.split('/');
		if(blockquoteSign[0] !== undefined) { } else { blockquoteSign = '&ldquo;';}
		if(blockquoteSign[1] !== undefined) { blockquoteSize = blockquoteSign[1];} else { blockquoteSize = '5';}
	} else { var blockquoteSize = '5'; var blockquoteSign = '&ldquo;'; }
	
	jQ("blockquote").prepend('<div class="blockSign">'+blockquoteSign+'</div>');
	jQ(".blockSign").css({ fontSize: blockquoteSize+"em", position: "absolute", left:"-55px", top: "25px"});
});

/*
* BACKSLIDER (ANIMATION)
* THIS MAKE A SMOOTH ANIMATION FOR THE BACKGROUND-PICTURE
*/
jQ(document).ready(function() {
	jQ('#portfolio li').livequery( function() {jQ(this).css({display: "none"}); });
	jQ('#portfolio li:first').livequery( function() {jQ(this).css({display: "block"}); });
	jQ('#portfolio li.active').livequery( function() {jQ(this).css({display: "block"}); });
	jQ('#portfolio li:first').livequery( function() {jQ(this).addClass("lastimageSlide");});
});	
function slideSwitch() {
    var jQactive = jQ('#portfolio li.active');
	if ( jQactive.length === 0 ) jQactive = jQ('#portfolio li:first');
	var jQnext =  jQactive.next().length ? jQactive.next():jQ('#portfolio li:first');
    
		if (jQnext.is(".lastimageSlide")){ 
			jQnext.css({display:"block"});
			jQactive.fadeOut(3000);
            jQactive.removeClass('active last-active');				
		} else {
		jQnext.addClass('active').fadeIn(3000,function() {
			jQactive.addClass('last-active').hide();
            jQactive.removeClass('active last-active');			
        });
		}
};
/*
* MENU TRIGGER (ANIMATION)
* THIS IS A ANIMATION WIDTH CLASSES
*/
function BumbNav() {
	if(jQ("#navcontainerTrigger.navBlink1").length) { 
		jQ("#navcontainerTrigger").removeClass("navBlink1");
		jQ("#navcontainerTrigger").addClass("navBlink2"); 
	} else {
		jQ("#navcontainerTrigger").removeClass("navBlink2");
		jQ("#navcontainerTrigger").addClass("navBlink1");
	}
};
/*
* MY DEBUG FOR JAVA (RAPIDWEAVER)
* THIS IS A DEBUG CONTROLLER
* EXAMPLE 	debug(theUrl);
*/
function debug(topix,msg) { 
	if(splitUrl[0] == 'file:' ) {
	if (
		jQ('.debug').length === 0) jQ('body').prepend('<div class="debug"></div>'); 
		jQ('.debug').append("<h4>"+topix+"</h4><small>" + msg); 
		jQ('.debug').css({position: "absolute",top:"0", background:"#222", color: "#fff", textAlign: "left", opacity: 0.1, padding:"10px"});
		jQ('.debug').css({borderRight: "1px solid #ccc", borderBottom: "1px solid #ccc"});
		jQ('.debug h4').css({ marginBottom: "0", marginTop:"3px", textShadow: "0px 0px 5px #999"  })
		jQ('.debug small').css({ textShadow: "0px 0px 6px #fff"  })
		
		jQ(".debug").hover( function () {
			jQ(this).css("opacity", 1);}, function () {
			jQ(this).css("opacity", 0.1);
		});
	}};
	

/*
* SPINNER FOR PRELOADER
* 
*/
jQ.fn.spinner = function(config) {
	var frame  = 1;
	var target = jQ(this);
	var frames = 12;
	
	// Set the height
	if(config.height) {
		target.height(config.height);
	}
	
	// Set the width	
	if(config.width) {
		target.width(config.width);
	}
	
	// Set or get the spinner image
	config.image = target.css("background-image");

	
	// Determine how many frames exist
	img = new Image();
	img.src = config.image;
	img.onload = function() {
		frames = img.width/config.width;
	};
	
	// Set the frame speed
	if(!config.speed) {
		config.speed = 25;
	}
	
	// Update the drawing area by adjusting the background-image
	function spinnerRedraw() {
		// If we've reached the last frame, loop back around
		if(frame >= frames) {
			frame = 1;
		}
		
		// Set the background-position for this frame
		pos = "-"+(frame*config.width)+"px 0px";
		target.css("background-position",pos);
		
		// Increment the frame count
		frame++;
	}
	
	// Kick off the animation
	var animation = setInterval(spinnerRedraw,config.speed);
	
	// Call jQ.spinnerStop to halt the spinner
	jQ.spinnerStop = function() {
	    clearInterval(animation);
	};
}


