	function applyeffect(){
		
	}

	function showText()
	{
		// kollar om diven finns annars skiter den i det här för det blir felvarning annars.
		if(document.getElementById("counter") != undefined){
			document.getElementById("counter").innerHTML = (which+1) + " / " + photos.length;
		}
	}

	function playeffect(){
		
	}
	
	
	function browserSize() {

    if (typeof (window.innerWidth) == 'number') {
      
        winW = window.innerWidth;
        winH = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
     
        winW = document.documentElement.clientWidth;
        winH = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        
        winW = document.body.clientWidth;
        winH = document.body.clientHeight;
    }

   
    return { w: winW, h: winH };

}
	
	function closeD()
	{
		
		ni = document.body;
		ni.removeChild(document.getElementById('bs'))
	}
	
	
function killtoolbox(){
	ni = document.body;
		ni.removeChild(document.getElementById('toolbox'))
}

function toolBoxInfo(e) {
    ni = document.body;
	
	
	if (document.getElementById('toolbox') == undefined) {
		// toolbox diven 
		bss = document.createElement('div');
		bss.setAttribute('id','toolbox');
		// toolbox diven 
		ni.appendChild(bss);
	}
	
	  var txt = "Click to enlarge";
	  var posx = 0;
	  var posy = 0;
	  if (!e) var e = window.event;
	  
	  if (e.pageX || e.pageY) {
		  posx = e.pageX;
		  posy = e.pageY;
	  } else if (e.clientX || e.clientY) {
		  posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		  posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	  }

	  if (document.getElementById('toolbox') != undefined) {
		  var div = document.getElementById('toolbox');
		  div.innerHTML = "<span class='toolBox-info-text' style='color:white;'>" + txt + "</span>";
		  div.style.display = "block"
		  div.style.position = "absolute";

		  div.style.top = posy + 27 + "px";
		  div.style.left = (posx + 20) + "px";

	  }
	 


            
}
	
	
function popshowImage()
{
	ni = document.body;
	bs = document.createElement('div');
	
	bs.setAttribute('class','trans');
	bs.setAttribute('onclick','closeD()');
	bs.setAttribute('id','bs');
	bs.style.zIndex = 9999;
	bs.style.position = "absolute";
	bs.style.top = "0px";
	bs.style.left = "0px";
	bs.style.backgroundImage = "url('pop.png')";
	ws = browserSize();
	bs.style.width = ws.w+"px";
	bs.style.height = ws.h+"px";
	
	var img= new Image();
	img.src = photos[which];
		
	cH = (ws.h-img.height)/2;
	cW = (ws.w-img.width)/2;
	
	var ph = photos[which].split("/");
	pht = "1000/"+ph[1];
	
	bs.innerHTML = "<div id='center' style='position:absolute;top:"+ cH + ";left:"+ cW + ";'><img src='"+pht+"'><br><br><div style='width:"+img.width+"px;text-align:right;cursor:pointer;' onclick='closeD()'>Click to close</div></div>";
	ni.appendChild(bs);
	
	
}


	function showPhoto(b){
		var bild = new Image();
		bild.src = photos[b];
		
		
		var dinR = document.getElementById("right");
		dinR.innerHTML = "<div id='bild' style='cursor:pointer;' onmousemove='toolBoxInfo(event)' onmouseout='killtoolbox()' onclick='popshowImage()'></div><div id='navHolder' style='width:300px;position:absolute;bottom:0px;'><div id='arrowLeft' style='float:left;'>pilvänster</div><div id='imgtitle' style='float:left;'></div><div id='arrowRight' style='float:left;'>pilhöger</div></div>"
		
		var div = document.getElementById("bild");
		div.innerHTML = "";
		
		var arrowLeft = document.getElementById("arrowLeft");
		var arrowRight = document.getElementById("arrowRight");
		var uHight = (bild.height/2)-15;
		arrowLeft.innerHTML = "<img src='backwards.jpg' id='prvArrow' >";
		arrowRight.innerHTML = "<img src='forward.jpg' id='nexArrow'>";
		//arrowLeft.style.height = bild.height;
		//arrowRight.style.height = bild.height;
	
		
		
		
		div.style.position = "absolute"
		div.style.width = bild.width;
		div.style.height = bild.height;
		div.style.backgroundImage = "url('"+photos[b]+"')";
		
		
		
		
		arrowLeft.onclick = function(){
			backward();
		}
		
		arrowLeft.onmouseover = function(){
			document.getElementById("prvArrow").style.display = "block"
		}
		
		arrowRight.onmouseover = function(){
			
			document.getElementById("nexArrow").style.display = "block"
		}
		
		arrowLeft.onmouseout = function(){
			document.getElementById("prvArrow").style.display = "block"
		}
		
		arrowRight.onmouseout = function(){
			
			document.getElementById("nexArrow").style.display = "block"
		}
		
		
		arrowRight.onclick = function(){
			forward();
		}
		
		
		if(title != undefined){
			
			if(title[b] != undefined){
				document.getElementById("imgtitle").innerHTML = title[b];
			}
		}
	}

	function backward(){
		if (which>0){
			which--;
			
			showPhoto(which);
			
			showText();
		}
	}

	function forward(){
		if (which<photos.length-1){
			which++;
			
			showPhoto(which);
			
			
			showText();
		}
	}

	function transport(){
		window.location=photoslink[which]
	}
	
	function showImage(){
		document.write('<img src="'+images[whichImage]+'">');
	}
	
	
	function editMenu()
	{
		var divs = document.getElementById("menuHolder").getElementsByTagName("div");
		divs[0].onclick = function(){
			if(document.getElementById("worksDiv").style.display == "none"){
				document.getElementById("worksDiv").style.display = "block";
				
				document.getElementById("booksDiv").style.display = "none";
			}else{
				document.getElementById("worksDiv").style.display = "none";
			}
		}
		divs[2].onclick = function(){
			if(document.getElementById("booksDiv").style.display == "none"){
				document.getElementById("booksDiv").style.display = "block";
				document.getElementById("worksDiv").style.display = "none";
			}else{
				document.getElementById("booksDiv").style.display = "none";
			}
		}
	}
	
	function loadPhoto(){
		editMenu();
		showPhoto(0);		
		showText();	
		
							
	}
	
	
