/* === toggle WIDTH ======= */

function change_width(width, id)
{
	document.getElementById(id).style.width = width+"px";
}


function change_width_open(width, id, whole)
{
	document.getElementById(id).style.width = width+"px";
	
	var innerwidth = whole - 15;
	if (width<=275)
		document.getElementById('col2_text').style.width = width+"px";
	else
		document.getElementById('col2_text').style.display = "block";
}


function toggle(id, minwidth, maxwidth) 
{
	var speed = Math.round(110 / 100);
	var timer = 0;
	
	var whole = maxwidth+50;
	//minwidth = 21
	
	if (document.getElementById(id).offsetWidth > minwidth)
	{				
		//make small - toggle in: ------------- 
		
		document.getElementById('showhideimg').src = "images/show.gif";
		document.getElementById('col2_text').style.display = "none";
		
		for(i = whole; i >= minwidth; i--) 
		{
			setTimeout("change_width(" + i + ",'"+id+"')",(timer * speed));
			timer++;
		}
	}
	else
	{
		//toggle out: ---------------
		
		document.getElementById('showhideimg').src = "images/hide.gif";
						
		for(i = minwidth; i <= whole; i++) 
		{
			setTimeout("change_width_open(" + i + ",'"+id+"', "+maxwidth+")",(timer * speed));
			timer++;
		}
		
	}

}

/* === toggle HEIGHT ======= */

function change_height(height, id)
{
	document.getElementById(id).style.height = height+"px";
}


function toggle_height(id, which, action) 
{
	var speed = Math.round(110 / 100);
	var timer = 0;
	var i;
		
	var whole = document.getElementById(id).offsetHeight;
	
	if (action == 0)	//close
	{
		block_height[which] = whole;
		
		block_content[which] = document.getElementById('block_'+which).innerHTML;
		document.getElementById('block_'+which).innerHTML = "";
		
		for(i = whole; i >= 0; i--) 
		{
			setTimeout("change_height(" + i + ",'"+id+"')",(timer * speed));
			timer++;
		}
	}
	else
	{	
		if (document.getElementById(id).offsetHeight > 0)
		{				
			//make small - toggle in: ------------- 
			
			block_height[which] = whole;
			
			block_content[which] = document.getElementById('block_'+which).innerHTML;
			document.getElementById('block_'+which).innerHTML = "";
			
			for(i = whole; i >= 0; i--) 
			{
				setTimeout("change_height(" + i + ",'"+id+"')",(timer * speed));
				timer++;
			}
		}
		else
		{
			//toggle out: ---------------
			
			document.getElementById('block_'+which).innerHTML = block_content[which];
							
			for(i = 0; i <= block_height[which]; i++) 
			{
				setTimeout("change_height(" + i + ",'"+id+"')",(timer * speed));
				timer++;
			}
			
		}
	}

}


/* ==== */

function window_width() 
{
	  var myWidth = 0;
	  if( typeof( window.innerWidth ) == 'number' ) 
	  {
		//Non-IE
		myWidth = window.innerWidth;
	  } 
	  else if ( (document.documentElement) && (document.documentElement.clientWidth) ) 
	  {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	  } 
	  else if( (document.body) && (document.body.clientWidth) ) 
	  {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	  }	  	  

	  return(myWidth);
}

function window_height()
{
	 var myHeight = 0;
	  if( typeof( window.innerHeight ) == 'number' ) 
	  {
		//Non-IE
		myHeight = window.innerHeight;
	  } 
	  else if ( (document.documentElement) && (document.documentElement.clientHeight) ) 
	  {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	  } 
	  else if( document.body && (document.body.clientHeight) ) 
	  {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	  }
	  
	  return(myHeight);
}




function resize()
{
	var imgid = 'gallery_prev';
	
	var browserheight = window_height();
	var browserwidth = window_width();
	
	if (parseInt(navigator.appVersion)>3) 
	{
		if (navigator.appName.indexOf("Microsoft")!=-1) 
		{
			browserheight = browserheight+14;
		}
	}

	document.getElementById(imgid).style.height = browserheight+"px";
	document.getElementById(imgid).style.width = browserwidth+"px";

}
