var xmlhttp;

function init(){
   if(window.location.hash){
	    //alert(window.location.hash);
	    loadProject(window.location.hash.substr(1));
   }
}
function loadProject(which,offset){

   if (typeof offset == "undefined") {
    offset = 0;
  }

   window.location.hash=which;
   loadContent("project.php?id="+which+"&offset="+offset);
}

var http = false;

if (window.XMLHttpRequest){
      http=new XMLHttpRequest();
} else if (window.ActiveXObject){
      http=new ActiveXObject("Microsoft.XMLHTTP");
} else {
      var msg='Unfortunately this website uses technology that your browser does not support. Our apologies.';
      document.getElementById('content').innerHTML=msg;
}

function loadContent(url) {

  document.getElementById('content').innerHTML = '';
  document.getElementById('loading').style.display='inline';

  http.open("GET", url, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('content').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

/* Function to adjust the size of the #content div*/
function adjustSize(){
   var winW=-1 , winH=-1;

   if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
        winW = window.innerWidth;
        winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
        winW = document.body.offsetWidth;
        winH = document.body.offsetHeight;
     }
   }
   try{
      if(winW >0 && winH >0){
	       var leftbarwidth=157;
         var topbarheight=50;
        
         var leftbarpadding=18;
         var contentwidth=winW-leftbarwidth;
         var contentheight=winH-topbarheight;
         var leftbarheight=winH-leftbarpadding;
         document.getElementById('content').style.width=contentwidth+'px';
         document.getElementById('content').style.height=contentheight+'px';
         document.getElementById('leftbar').style.height=leftbarheight+'px';    
      }else{

      }	
   } catch(err){
    
   }
}
function loadedLastPic(){
   document.getElementById('loading').style.display='none';
}
function getName(str){
   var idx=str.indexOf('=');
	 var name=str.substr(idx+1);
	 //alert(name);
	 return name;
}
function highlight(id){
   //item.childNodes[2].className='thumblabel_highlight'; 
   document.getElementById(id).className='thumblabel_highlight'; 
}
function unhighlight(id){
   //item.childNodes[2].className='thumblabel';
   document.getElementById(id).className='thumblabel'; 
}

window.onresize = function (evt) {
   adjustSize();
};



