//=======================================================================================================
//-------------------------------------------------------------------------------------------------------
//	Custom Javascript functions
//-------------------------------------------------------------------------------------------------------
//=======================================================================================================
function toggle(item_on,item_off)
{
	document.getElementById(item_on).style.display = 'block';
	document.getElementById(item_off).style.display	= 'none';
}

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];
  }
}

var clipTop   	= 0;
var clipWidth 	= 425;
var clipBottom	= 235;
var topper    	= 284;
var lyrheight 	= 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('content');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}

function setlayerpos(layername,ypos)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;

	amount = ypos - clipTop;

	realscroll(true);
	return;
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll( justonce )
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}

	if (!justonce )
	{
		time = setTimeout('realscroll()',theTime);
	}
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function makeHeaderFlash(url)
{
	width = 220;
	height = 200;
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="headerflash" align="middle">' + "\n");
	document.write('<param name="allowScriptAccess" value="sameDomain" />' + "\n");
	document.write('<param name="allowFullScreen" value="false" />' + "\n");
	document.write('<param name="movie" value="/images/header.swf?imageurl=' + url + '" />' + "\n");
	document.write('<param name="quality" value="high" />' + "\n");
	document.write('<param name="wmode" value="transparent" />' + "\n");
	document.write('<embed src="/images/header.swf?imageurl=' + url + '" wmode="transparent" quality="high"  width="' + width + '" height="' + height + '" name="portfolioflash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' + "\n");
	document.write('</object>' + "\n");
	
}