// Portfolio Javascript

// Stores the previously selected thumbnail.
var prevThumb = 'thumb01';

// Gallery.

function LoadGallery(pictureName, imageFile, titleCaption, captionText, imgDest, imgTitle, thumbNumber, imgDest2, imgTitle2, imgDest3, imgTitle3)
{
 
  document.getElementById(pictureName).src = imageFile +'.png';
  document.getElementById('Gallery_alt1').src = imageFile + 'b' +'.png';
  document.getElementById('Gallery_alt2').src = imageFile + 'c' +'.png';
  document.getElementById('Gallery_alt3').src = imageFile + 'd' +'.png';
  document.getElementById(titleCaption).innerHTML=captionText;
  document.getElementById(imgDest).innerHTML=imgTitle;
  document.getElementById(imgDest2).innerHTML=imgTitle2;
  document.getElementById(imgDest3).innerHTML=imgTitle3;


  // Makes the current thumbnail highlighted in white.
  document.getElementById(thumbNumber).innerHTML='<img src="images/gallery/'+thumbNumber+'.png" alt ="Gallery thumbnail 01" class="gallery_thumb" style="border: 1px #e1d8c9 solid;" id="'+thumbNumber+'"  />';

  // Checks if the previously selected thumbnail is the same thumbnail as the current.
  if (prevThumb != thumbNumber)
  {
  		
		// If it's a new thumbnail it will go back to being unselected.
		document.getElementById(prevThumb).innerHTML='<img src="images/gallery/'+prevThumb+'.png" alt ="Gallery thumbnail 01" class="gallery_thumb"  style="border: 1px #161515 solid;"  id="'+prevThumb+'" />';
  }
  
  // Stores the currently selected thumbnail.
  prevThumb = thumbNumber;  
}

// Hide and reveal the CLICK HERE TO ENLARGE container.
function Enlarge(visibility)
{	
	
	if(visibility == 'synlig')
	{
		document.getElementById('enlarge').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
		document.getElementById('enlarge1').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
		document.getElementById('enlarge2').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	else
	{
		document.getElementById('enlarge').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
		document.getElementById('enlarge1').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
		document.getElementById('enlarge2').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	
	if(visibility == 'synlig1')
	{
		document.getElementById('enlarge1').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	else
	{
		document.getElementById('enlarge1').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
	}
	
	if(visibility == 'synlig2')
	{
		document.getElementById('enlarge2').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	else
	{
		document.getElementById('enlarge2').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	if(visibility == 'synlig3')
	{
		document.getElementById('enlarge3').innerHTML='<div class="enlarge" id="enlarge" style="visibility: visible;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	else
	{
		document.getElementById('enlarge3').innerHTML='<div class="enlarge" id="enlarge" style="visibility: hidden;">CLICK IMAGE TO ENLARGE</div>';
	
	}
	
	
}

/* Opens a fullsize version of clicked image */
function OpenLarge(abc)
{
	var bokstav = abc;
	
	if (prevThumb == 'thumb01')
	{
		window.open('images/gallery/gallery_img_01'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb02')
	{
		window.open('images/gallery/gallery_img_02'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb03')
	{
		window.open('images/gallery/gallery_img_03'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb04')
	{
		window.open('images/gallery/gallery_img_04'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb05')
	{
		window.open('images/gallery/gallery_img_05'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb06')
	{
		window.open('images/gallery/gallery_img_06'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb06')
	{
		window.open('images/gallery/gallery_img_06'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb07')
	{
		window.open('images/gallery/gallery_img_07'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb08')
	{
		window.open('images/gallery/gallery_img_08'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb09')
	{
		window.open('images/gallery/gallery_img_09'+bokstav+'_large.png');	
	}
	if (prevThumb == 'thumb10')
	{
		window.open('images/gallery/gallery_img_10'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb11')
	{
		window.open('images/gallery/gallery_img_11'+bokstav+'_large.png');	
	}
	
	if (prevThumb == 'thumb12')
	{
		window.open('images/gallery/gallery_img_12'+bokstav+'_large.png');	
	}
}

/* Opens up a link in a new window since target is not allowed in XHTML 1.1 */
function ExtLink()
{
		window.open('http://www.linkedin.com/pub/robin-lundin/42/233/a1');	
	
}


