function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
function highlightimg(imgid)
{

    var img00			=	document.getElementById("img00");  // index
    var img01			=	document.getElementById("img01");  // 01_about me
    var img02			=	document.getElementById("img02");  // 02_port.html
    var img03			=	document.getElementById("img03");  // 03_cv.html
    var img04			=	document.getElementById("img04");  // 04_games.html
    var img05			=	document.getElementById("img05");  // 05_links.html
    var img06			=	document.getElementById("img06");  // 06_cont.html
	img00.src = "images/circ_00.gif";
	img01.src = "images/circ_00.gif";
	img02.src = "images/circ_00.gif";
	img03.src = "images/circ_00.gif";
	img04.src = "images/circ_00.gif";
	img05.src = "images/circ_00.gif";
	img06.src = "images/circ_00.gif";

   	if (!(imgid == 'ingen'))
   	{
 		var img2highlight	=	document.getElementById(imgid);
 		img2highlight.src = "images/circ_01.gif";
	}
}

function expand(areaid,imageid,fixedheight)
{
 	var expandimage =	document.getElementById(imageid);
 	var area		=   document.getElementById(areaid);
 	areaheight		=   area.style.height;
 	if (areaheight == "auto")
 	{
 		expandimage.src = "images/expand_01.gif";
 		area.style.height	=	fixedheight + "px";
 	}
	else
 	{
 		expandimage.src = "images/expand_00.gif";
 		area.style.height	=	"auto";
 	}

}
function musicwindow(filetype)
{
	var filename = "09_sound.html";
	var textvar = typeof document.backgroundmusicwindow;
	
	if (filetype == 'wav')
	{
		// filename = "files/back2low.wav";
		filename = "09_light.html";

	}
	else
	{
//	 	filename = "files/backcool.mp3";
	 	filename = "09_heavy.html";
	}

	var backgroundmusicwindow = window.open(filename,"background","width=250px,height=50px,location=no,menubar=no,status=no,scrollbars=no,resizable=no,toolbar=no");
}

function openpicture(picturename)
{
	picturewindow = window.open("pic.php?picturevar="+picturename,"picturew","width=640px,height=497px,location=no,menubar=no,status=no,scrollbars=no,resizable=yes,toolbar=no");
    picturewindow.focus();
//	var replacablepicture = picturewindow.document.getElementById("replacableimageid");
//	picturewindow.document.replacablepicture.src = picturename;
//	picturewindow.document.replacablepicture.src = 'images/autobot/autobot_1.jpg';
//    picturewindow.document.replacablewindowname.src = picturename;
}

function music(power,imagefileidpassed,soundfileidpassed){
	soundimage 	= document.getElementById(imagefileidpassed);
	soundfile = document.getElementById(soundfileidpassed);
	if (power == "01")
		{
	    soundimage.src= 'images/sound_01.gif';
//   	    document.soundfile.play();
//   	     document.soundfile.volume = 100;
		}
	if (power == "00")
		{
        soundimage.src= 'images/sound_00.gif';
//	    document.soundfile.pause();
//	    document.soundfile.volume = 100;
		}
}

function scrollfunc(id,direction,containerid){
 	var speed			= 30;
	var	scrollbox 		= document.getElementById(id);
	var container		= document.getElementById(containerid);
	var containerheight = parseInt(container.style.height);
	var contentheight	= scrollbox.offsetHeight;
	var scrollamount	=	0;
	var currentheight	=  parseInt(scrollbox.style.top);
// alert (containerheight);


	if (direction == "down" && currentheight >= (contentheight*(-1) + containerheight ))
	{
	scrollbox.style.top = currentheight-speed+"px";
//	alert("Scrolling up \ncontent_height = " + contentheight + "\n current height = " + scrollbox.style.top );
	}
//	if (direction == "down" && scrollbox.style.top  >=(contentheight*(-1)+100))
	if (direction == "up" && currentheight <= 0 - speed)
	{
//	scrollbox.style.top = 250+"px";
	scrollbox.style.top = currentheight+speed+"px";
//	alert("Scrolling Down \ncontent_height = " + contentheight + "\n current height = " + scrollbox.style.top );
	}

}
