    $.fn.wait = function(time, type) {
        time = time || 1000;
        type = type || "fx";
        return this.queue(type, function() {
            var self = this;
            setTimeout(function() {
                $(self).dequeue();
            }, time);
        });
    };
			function init(){
			
						setTimeout(function(){
							$("#loader").fadeIn(1000,function(){
								$("#loader #progress").fadeIn(500).animate(
									{width:200,marginLeft:0},
									1000,
									function(){
										$("#loader").fadeOut(500,
											function(){
												//determine the content and handball..
												if(window.location.hash!=null && window.location.hash!="null" && window.location.hash!=undefined && window.location.hash!="undefined" && window.location.hash!=""){
													//this is so we can handle http://envisage.i3network.net/#module/action loads..
														//remove special stuff.

														tsplit=window.location.hash.replace(/[^a-zA-Z ; ~ : 0-9._//]+/g,'');
														//kaboom?
/* 														split=tsplit.split("/"); */
/*
														//now we load the content from the server...
														$.post('ajax/test.html', function(data) {
															$('.text_content').html(data);
															});
														mod(split[0],split[1],split[2]);
*/
/* 													loadcontent(tsplit); */
												}else{
											//		mod('go','home');
/* 													loadcontent('home'); */
												}
												// Load the classic theme
												Galleria.loadTheme('inc/galleria.classic.php');
											    // Initialize Galleria
/* 												loadGalleria(); */
													loadcontent('home');
											$("#loader_blanket").fadeOut();
												$("#container").fadeIn(500,function(){
													$("#nav").stop().animate({'opacity':0.30},1000);
												}).animate({marginTop:0},1000);
												}
											);
										}
									)}
								);
								}
							,500);
			$("#nav").hover(
				function(){
					$(this).stop().animate({'opacity':0.80});
				},
				function(){
					$(this).stop().animate({'opacity':0.50});
				}
			);
				}
			
			function loadcontent(pageid){
				if(content[pageid]!==undefined && content[pageid]!==null){
					//we have content
					console.log("Loading content: "+pageid);
					//hide everything! THE COPS!
						killGalleria();
						$("#text_content").stop().fadeOut(400,function(){
							if(content[pageid]['type']=="text"){
								$("#text_content").html(content[pageid]['content']).fadeIn(400);
							}else if(content[pageid]['type']=="gallery"){
								loadGalleria();
							}else if(content[pageid]['type']=="gallerylist"){
								$("#text_content").html(content[pageid]['content']).fadeIn(400,function(){
									$(".gallery_list_item").hover(
										function(){
											$('.gallery_selection_thumb',this).stop().animate({'opacity':1.0});
										},
										function(){
											$('.gallery_selection_thumb',this).stop().animate({'opacity':0.60});
										}
									);
								});
							}else{
								alert('invalid page type in content: '+content[pageid]['type']);
							}
						});
				}else{
					loadcontent('404');
				}
			}
			function loadgallery(galleryname){
				if(galleries[galleryname]!==undefined && galleries[galleryname]!==null){
					//we have content
					
					//hide everything! THE COPS!
						killGalleria();
						$("#text_content").stop().fadeOut(400,function(){
							loadGalleria(galleryname);
						});
				}else{
					loadcontent('404');
				}
			}
			function loadGalleria(gallery_name){
			    $('#galleria').fadeIn(300).galleria({
			    	height: '600px',
			    	data_source: galleries[gallery_name]['content'],
					extend: function() {
				        var gallery = this;
				        this.$('stage').hover(function() {
				            gallery.pause();
				        }, function() {
				            gallery.play();
				        });
				    }
			    });
			}
			function killGalleria(){
				$('#galleria').fadeOut(300,function(){$(this).html("")});
			}
			function pricing_toggler(caller,target){
				if(document.getElementById(target).style.display!="block"){
					var needsscroll=true;
					}else{
					var needsscroll=false;
					}
					if($('#'+caller+' span').html()=="click to hide"){
						var this_html="click to view more";
					}else{
						var this_html="click to hide";
					}
					$('#'+caller+' span').fadeOut('fast',function(){$(this).html(this_html).fadeIn()});
					$('.section_indent').each(function(){
						if($(this)[0]['id']==target){
							//nothing...
						}else{
							$(this).css({display:'none'});
						}
						});
					$('#'+target).slideToggle();
					//do we need to scroll to the div?
						if(needsscroll){
							//it's NOW visible... scroll to it
/*
							$('#text_content').animate({
						        scrollTop: $("#"+caller).position().top},
						        'slow');
*/
						}else{
							//it's already visible..
							return false;
						}
			}

			window.onload=init;
