//Get window height
function GetWinHeight(){
 //Check for useable version
 if (parseInt(navigator.appVersion) <= 3)return 400;
 
 //Check for IE
 if(navigator.appName.indexOf("Microsoft") != -1){
  if(document.documentElement.clientHeight == 0){
   return document.body.clientHeight;
  } else{
   return document.documentElement.clientHeight;
  }
 }
 
 //Default to "normal compliance" one
 return window.innerHeight;
}

//Get window width
function GetWinWidth(){
 //Check for useable version
 if (parseInt(navigator.appVersion) <= 3)return 600;
 
 //Check for IE
 if(navigator.appName.indexOf("Microsoft") != -1){
  if(document.documentElement.clientWidth == 0){
   return document.body.clientWidth;
  } else{
   return document.documentElement.clientWidth;
  }
 }
 
 //Default to "normal compliance" one
 return window.innerWidth;
}

//Zoom image in the media gallery
function GS_Zoom(file){
 var img = document.getElementById("_Media");
 var cont = document.getElementById("_Container");
 
 //Calculate width we can use for image, round to 50 to save space
 var width = Math.floor(GetWinWidth() - 30*4 - 175);
 width = Math.floor(width/100)*100;
 
 //If we already have that width, just redirect to full copy
 //if(width == parseInt(img.style.width)){
  document.location = "http://d5robotics.org/Content/Full/"+file;
  return;
 //}
 
 //Calculate height to use for image
 var height = Math.floor(width / 1.3333);
 
 //Change the image to a higher-quality version and scale
 img.style.width = (width+"px");
 img.src = "http://d5robotics.org/Content/Thumbnail.php?file="+file+"&width="+width+"&height="+height+"&mode=width";
}

//Resize body viewport incase it's too small in IE (rough hack!)
function IE_Viewport(){
 if(GetWinWidth() < 830){
  document.body.style.width = "850px";
 } else{
  document.body.style.width = "auto";
 }
 
 setTimeout("IE_Viewport()", 500);
}

if(navigator.appName.indexOf("Microsoft") != -1){
 setTimeout("IE_Viewport()", 500);
}
