$(document).ready(function(){
	var tms = gup("tms");
	var philoID = gup("philo_ID");
	
	var openFlag = 0;
	$("#tabButton").click(function (){
		if (openFlag){
			$("#imageOverlay").animate({left: '+=772'},1000,function() {
				openFlag = 0;
				$("#tabButton").removeClass("close");		
			}
			);		
		}
		else {
			$("#imageOverlay").animate({left: '-=772'},1000,function() {
				openFlag = 1;
				$("#tabButton").addClass("close");	
			}
			);
		}
		});	
		
	var xmlhttp;
	var responseText;
	
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
 		 xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}

	var ajax_load = "<img src='loading.gif' alt='loading...' style='margin-top:170px;margin-left:280px;' />";	
	$('#dataSet').html(ajax_load).load("build_thumbnails.php", "philoID=" + philoID,function(){	
		//nothing to do on first load
		
		}
		);
	
	
	jumpIt = function(philoID)
	{
		$("#imageOverlay").animate({left: '+=772'},1000,function() {
				//load new page in window
				window.location = "index.php?philo_ID=" + philoID;	
			}
			);		
	}
	
	thumbIt = function(tms)
	{

		var ajax_load = "<img src='loading.gif' alt='loading...' style='margin-top:170px;margin-left:280px;'/>";	
		$('#dataSet').html(ajax_load).load("build_thumbnails.php", "tms=" + tms + "&philoID=" + philoID,function(){	
		//nothing to do on first load
		
		}
		);

	}
	
	
	toggleIt = function(daObject, show)
	{
		if (show) {
	
			$(daObject).children('div.thumbCellDesc').find('div.thumbCellDescText').css('display','block');
			$(daObject).children('div.thumbCellDesc').animate({height:'100px',top:'50px'},{queue:false,duration:300}, function(){
				
			}
			);
			
		}
		else {
			//$(daObject).children('div.thumbCellDesc').css("display:none");
			$(daObject).children('div.thumbCellDesc').find('div.thumbCellDescText').css('display','none');
			$(daObject).children('div.thumbCellDesc').animate({height:'0px',top:'150px'},{queue:false,duration:300}, function(){
				//$(daObject).children('div.thumbCellDesc').find('div.thumbCellDescText').css('display','none');
			}
			);
		}
	}
  	
});
function gup( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    
	return 0;
  else
    return parseInt(results[1]);
}
