// JavaScript Document
gfxsource = 'source';
facebookfunwall = 'facebookfunwall';
facebookadvwall = 'facebookadvwall';
facebooksuperwall = 'facebooksuperwall';
function showmove ( d, s )
{
	f = document.getElementById ( "instructions" );
	f.style.top = s.parentNode.parentNode.parentNode.offsetTop + s.parentNode.parentNode.offsetTop + "px";
	show ( d );
}
function show ( d )
{
	d = document.getElementById ( d );
	d.style.display = "block";
}
function hide ( d )
{
	d = document.getElementById ( d );
	d.style.display = "none";
}
function setDivHtml ( d, s )
{
	d = document.getElementById ( d );
	d.innerHTML = s + "<div style=\"float:right;\"><img src=\"" + s + "\"/ alt=\"\"></div>";
}
function getSource ( s )
{
	value = s.src;
	hideAllgfxsource();
	var ct = Number( getCodeType() );
	switch ( ct )
	{
		case 0:
			// facebook fun wall
			setDivHtml ( facebookfunwall + "url", value );
			showmove ( facebookfunwall, s );
			break;
		case 1:
			// facebook adv wall
			setDivHtml ( facebookadvwall + "url", value );
			showmove ( facebookadvwall, s );
			break;
		case 2:
			// facebook super wall
			setDivHtml ( facebooksuperwall + "url", value );
			showmove ( facebooksuperwall, s );
			break;
		default:
			// default, just url.
			setDivHtml ( gfxsource + "url", value );
			showmove ( gfxsource, s );
			break;
	}
}
function getCodeType()
{
	stype = document.forms["giveme"].codetype;
	if( !stype )
	{
		return -1;
	}
	var len = stype.length;
	if ( len == null )
	{
		if ( stype.checked )
		{
			return stype.value;
		}
		else
		{
			return -1;
		}
	}
	for ( var i = 0; i < len; i++)
	{
		if ( stype[i].checked )
		{
			return stype[i].value;
		}
	}
	return -1;
}
function hideAllgfxsource ( )
{
	hide ( gfxsource );
	hide ( facebookfunwall );
	hide ( facebookadvwall );
	hide ( facebooksuperwall );
}

