	var aChiabata = new Array("off","off","off","off","off","off","off","off","off") ;

// JavaScript Document

	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("nav");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
	window.onload=startList ;

	function showLoginFocus(){
		document.loginBig.userid.focus();
	}
	
	function showLogin(){
		Effect.toggle('loginBox', 'appear',{duration: 0.4, afterFinish: showLoginFocus});
	}

	function confirmDelete(){
		if(confirm("Du mŒste bekrŠfta att du vill radera bilden.")){
			location.href=sUrl
		}
	}



// MOBILMINGEL


	/*
	
		LoginFocusStuff
	
	*/
	
	function showLoginFocus(){		document.loginBig.userid.focus();	}		function showLogin(){				Effect.toggle(
			'loginBox',
			'appear',
			{
					duration: 0.4,
					afterFinish: showLoginFocus
			}
		);	}		/*
	
		CommentStuff
	
	*/
		function hideComment(galleryImageId){
		new Ajax.Updater(
			'comments',
			'/index.php?service=gallery&action=showImageComment&galleryImageId='+galleryImageId +'',
			{
					asynchronous:true, 
					evalScripts:true
					
			}
		);
				new Effect.Opacity('commentDiv',	   		{
	   				delay: 1,
	   				duration: 1.0, 					transition: Effect.Transitions.linear, 	     	 		from: 1.0,
	     	 		to: 0
	     	}
     	 );
	}
	
	function showCommentFocus(){		document.writeImageComment.galleryComment.focus();	}		function showComment(galleryImageId){
				new Ajax.Updater(
			'commentDiv',
			'/index.php?service=gallery&action=writeComment&galleryImageId='+galleryImageId +'',
			{
					asynchronous:true, 
					evalScripts:true
			}
		);		
		Effect.toggle(
			'commentDiv',
			'appear',
			{
				duration: 0.4,
				afterFinish: showCommentFocus
			}
		);			}
	
	function commentImage(){
		new Ajax.Updater(
			'commentDiv',
			'/index.php?service=gallery&action=writeComment',
			{
					asynchronous:true, 
					evalScripts:true,
					parameters:Form.serialize('writeImageComment'),
					encoding: 'UTF-8'
			}
		);
	}
	
	/*
	
		Tip Friend - Send image
	
	*/
	
	function showTip(galleryImageId){
				new Ajax.Updater(
			'commentDiv',
			'/index.php?service=gallery&action=tipFriend&galleryImageId='+galleryImageId+'',
			{
					asynchronous:true, 
					evalScripts:true
			}
		);		
		Effect.toggle(
			'commentDiv',
			'appear',
			{
				duration: 0.4,
				afterFinish: showTipFocus
				
			}
		);			}
	
	
	function closeTipFriend(){
	
		new Effect.Opacity('commentDiv',	   		{
	   				delay: 1,
	   				duration: 1.0, 					transition: Effect.Transitions.linear, 	     	 		from: 1.0,
	     	 		to: 0
	     	}
     	 );
			
	}

	function closeCommentImage(){
	
		new Effect.Opacity('commentDiv',	   		{
	   				delay: 1,
	   				duration: 1.0, 					transition: Effect.Transitions.linear, 	     	 		from: 1.0,
	     	 		to: 0
	     	}
     	 );
			
	}
	
	function postTipFriend(){

		new Ajax.Updater(
			'commentDiv',
			'/index.php?service=gallery&action=tipFriend',
			{
					asynchronous:true, 
					evalScripts:true,
					parameters:Form.serialize('tipFriend')
			}
		);
	}
	
	
	
	function showTipFocus(){		document.tipFriend.tipFriendMail.focus();	}	/*
	
		Register
	
	*/	function checkMobile(){			if(Element.hasClassName('mobileStatus', 'responseOk')){			Element.removeClassName('mobileStatus', 'responseOk');		}		if(Element.hasClassName('mobileStatus', 'responseNotOk')){			Element.removeClassName('mobileStatus', 'responseNotOk');		}		if(document.registerUser.mobile.value != ""){			var sMobile = document.registerUser.mobile.value;			Element.show('mobileStatus');			if(Element.hasClassName('mobileStatus', 'responseOk')){				Element.removeClassName('mobileStatus', 'responseOk');			}			if(Element.hasClassName('mobileStatus', 'responseNotOk')){				Element.removeClassName('mobileStatus', 'responseNotOk');			}			new Ajax.Updater('mobileStatus', '/index.php?service=register&action=checkMobile&mobile='+sMobile+'', {asynchronous:true, evalScripts:true});		}else{			Element.addClassName('mobileStatus', 'responseNotOk');			Element.update('mobileStatus', 'Du m&aring;ste ange ett mobilnummer');		}	}	function checkEmail(){			if(Element.hasClassName('emailStatus', 'responseOk')){			Element.removeClassName('emailStatus', 'responseOk');		}		if(Element.hasClassName('emailStatus', 'responseNotOk')){			Element.removeClassName('emailStatus', 'responseNotOk');		}		if(document.registerUser.email.value != ""){			var sEmail = document.registerUser.email.value;			Element.show('emailStatus');			if(Element.hasClassName('emailStatus', 'responseOk')){				Element.removeClassName('emailStatus', 'responseOk');			}			if(Element.hasClassName('emailStatus', 'responseNotOk')){				Element.removeClassName('emailStatus', 'responseNotOk');			}			new Ajax.Updater('emailStatus', '/index.php?service=register&action=checkEmail&email='+sEmail+'', {asynchronous:true, evalScripts:true});		}else{			Element.addClassName('emailStatus', 'responseNotOk');			Element.update('emailStatus', 'Du m&aring;ste ange en mailadress');		}	}	function selectImage(iVar,sFormName){		//alert(aChiabata[0]);		// alert(document[sFormName].chiabata.value) ;		if(aChiabata[iVar] == "on") {			aChiabata[iVar] = 'off' ;			sVarToFix = document[sFormName].chiabata.value; 			document[sFormName].chiabata.value = sVarToFix.replace(iVar,"");			Element.setStyle('chiabataImage'+iVar, {border:'2px solid white'});		}else{			aChiabata[iVar] = 'on' ;			document[sFormName].chiabata.value = document[sFormName].chiabata.value + iVar;			Element.setStyle('chiabataImage'+iVar, {border:'2px solid #97df0d'});		}	}		function checkUserId(){		if(Element.hasClassName('useridStatus', 'responseOk')){			Element.removeClassName('useridStatus', 'responseOk');		}		if(Element.hasClassName('useridStatus', 'responseNotOk')){			Element.removeClassName('useridStatus', 'responseNotOk');		}		if(document.registerUser.userid.value != ""){			var sUserId = document.registerUser.userid.value;			Element.show('useridStatus');			new Ajax.Updater('useridStatus', '/index.php?service=register&action=checkUserId&userId='+sUserId+'', {asynchronous:true, evalScripts:true});		}else{			Element.addClassName('useridStatus', 'responseNotOk');			Element.update('useridStatus', 'Du m&aring;ste ange ett anv&auml;ndarnamn');		}	}				function imageBrowser(imageId){		mywindow = window.open ("/index.php?id_site=3&service=gallery&action=showImage&galleryImageId="+imageId+"","mywindow","location=0,status=0,scrollbars=1, width=700,height=701");		mywindow.moveTo(20,20);	}		function myGallery(userId){		mywindow = window.open ("/index.php?id_site=3&service=gallery&action=myGallery&userId="+userId+"","mywindow","location=0,status=0,scrollbars=1, width=700,height=701");		mywindow.moveTo(20,20);	}		function getImages(){		new Ajax.Updater("senaste", "/index.php?id_site=2&service=gallery");	}
		function getCalendar(sYear,sMonth){		new Ajax.Updater("calendarBox", "/index.php?service=gallery&action=showCalendar&sYear="+sYear+"&sMonth="+sMonth+"",{evalScripts:true});	}
		function getDate(sYear,sMonth,sDay){
		new Ajax.Updater("senaste", "/index.php?service=gallery&action=showDate&sYear="+sYear+"&sMonth="+sMonth+"&sDay="+sDay+"",{evalScripts:true});	}		function confirmDelete(sUrl){		if(confirm("Oooops! Du måste bekräfta att du vill radera bilden.")){			location.href=sUrl		}	}		function confirmDeleteGallery(sUrl){		if(confirm("Ooops!\n\nVill du verkligen radera den här kategorin? \n\nOBS! Även alla bilder i denna kategori kommer att raderas.")){			location.href=sUrl		}	}
