function set_current_hash(form){
	form.current_hash.value = document.location.hash;
	form.submit();
}

$(document).ready(function(){
	//  Initialize Backgound Stretcher
	$('BODY').bgStretcher({
		images: ['./bilder/hemsidav3_bg_ws_small.jpg'], imageWidth: 1024, imageHeight: 607
	});
});

$(document).ready(function(){
	$("#meny li.p1").hoverIntent(makeTall,makeShort);
	$("#meny_img li.img1").hoverIntent(makeTall_p1,makeShort_p1);
						
	$("#meny li.p2").hoverIntent(makeTall,makeShort);
	$("#meny_img li.img2").hoverIntent(makeTall_p2,makeShort_p2);
						
}); 

function makeTall_p1(){ 
	$("#meny li.p1").animate({"height":130},200);
}
function makeShort_p1(){ 

}

function makeTall_p2(){ 
	$("#meny li.p2").animate({"height":130},200);
}
function makeShort_p2(){ 

}

function makeTall(){  
	$(this).animate({"height":130},200);
}
function makeShort(){ 
	$(this).animate({"height":22},200);
}

$(document).ready(function(){
    	setInterval("checkAnchor()", 300);
 		clearInterval(); 
});

function startGallery() {
	var myGallery = new gallery(Moo.$('myGallery'), {
		timed: true,
		showArrows: false,
		showInfopane: false,
		showCarousel: false,
		embedLinks: true,
		delay: 6000
	});
}
window.onDomReady(
	function(){
		startGallery();
	}
);
		
hs.graphicsDir = './highslide/graphics/';
hs.align = 'center';
hs.showCredits = false;
hs.transitions = ['expand', 'crossfade'];
hs.wrapperClassName = 'dark';
hs.fadeInOut = true;
hs.dimmingOpacity = .75;

hs.numberPosition = 'caption';
hs.lang.number = 'Bild %1 av %2.';
hs.useBox = true;
hs.width = 800;
hs.height = 800;



hs.addSlideshow({
	interval: 3000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: .6,
		position: 'bottom center',
		hideOnMouseOut: true
	},

	thumbstrip: {
		position: 'above',
		mode: 'horizontal',
		relativeTo: 'expander'
	}

})		
		
var currentAnchor = null;  
//Function which chek if there are anchor changes, if there are, sends the ajax petition  
function checkAnchor(){  
 //Check if it has changes  
 if(currentAnchor != document.location.hash){  
     currentAnchor = document.location.hash;  
     //if there is not anchor, the loads the default section  
     if(!currentAnchor || currentAnchor == '#')  
         query = "ext_load=1&page=info";  
     else  
     {  
         //Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2  
         var splits = currentAnchor.substring(1).split('&');  
         //Get the section  
         var section = splits[0];  
         delete splits[0];  
         //Create the params string  
         var params = splits.join('&');  
         var query = "ext_load=1&page=" + section + params;  
         
         document.cookie='anchor='+section+params;
         
     }  
     //Send the petition 

	 $("#main_content").html('<br><br><span class="white_text">Laddar sidan...</span>');
	 $.get("get_content_from_db.php", query, function(data)
	 {
	   $("#main_content").html(data);
	 });
    
     
 }  
}	
