window.onload = function() {
	var divs = "<div class='dropdown' style='visibility:hidden' id='dropdown'>&nbsp;</div><div class='shadow' style='visibility:hidden' id='shadow'>&nbsp;</div>";

	document.getElementById("searchbar").innerHTML += divs;
	document.getElementById("dropdown").style.visibility = "hidden";
	document.getElementById("shadow").style.visibility = "hidden";
};

var selected = "";
var html = new Array();
	html['search']  = '	<form name="frmSPS5Search" action="/smartsite.html?id=2012" method="post">';
	html['search'] += '		<input type="hidden" name="action" value="[item]=2012" />';
	html['search'] += '		<input type="text" class="text_search" name="fldTerms" value="search for" onfocus="this.value=\'\';" />';
  html['search'] += '		<input type="hidden" name="fldSortOrder" value="1" />';
  html['search'] += '		<input type="hidden" name="fldMethod" value="AND" />';
  html['search'] += '		<input type="hidden" name="fldSourceTypes" value="" />';
  html['search'] += '		<input type="hidden" name="fldAction" value="1" />';
	html['search'] += '		<input type="submit" class="button" name="btnSearch" value="Search &raquo;" />';
	html['search'] += '		<input type="button" class="button" value="Cancel" onclick="show();" />';
	html['search'] += '	</form>';

	html['login']  = '	<form name="login">';
	html['login'] += '		<input type="hidden" name="action" value="login" />';
	html['login'] += '		<input type="text" class="text_login" name="username" value="username" />';
	html['login'] += '		<input type="text" class="text_login" name="password" value="password" />';
	html['login'] += '		<input type="submit" class="button" value="Login &raquo;" />';
	html['login'] += '		<input type="button" class="button" value="Cancel" onclick="show();" />';
	html['login'] += '	</form>';



function show(obj) {
	var contentDiv = document.getElementById('dropdown');
	var shadowDiv  = document.getElementById('shadow');

	contentDiv.style.visibility = (selected==obj || arguments.length==0) ? "hidden" : "visible";
	shadowDiv.style.visibility  = (selected==obj || arguments.length==0) ? "hidden" : "visible";

	contentDiv.innerHTML = (selected==obj || arguments.length==0) ? "" : html[obj];
	selected			 = (selected==obj || arguments.length==0) ? "" : obj;
};



// ------------------------------------------------------
// Show and Hide (word oa gebruikt in FAQ)
// ------------------------------------------------------
	// DS: Usage: ShowHide(item1, true, item2, item3, etc)
	// item1 will be show, rest will be hidden
	// second param is true when you want to change the button
	// state also. Buttons have to benamed the same as the
	// layers they are used for + "btn". The class "open"
	// will be added to the button when a layer is made visible
	function ShowHide(elm, changeButton) {
		// open layer you want to open
		styleElm = document.getElementById(elm).style;
		styleElmBtn = document.getElementById([elm + "btn"]);
		if (styleElm.display == 'none') {
			styleElm.display='block';
			if (changeButton) {
				// add "open" class to button
				styleElmBtn.className = ( styleElmBtn.className + " open" );
			}
		}	else {
			styleElm.display='none';
			if (changeButton) {
				// remove "open" class from button
				styleElmBtn.className = styleElmBtn.className.replace( "open", "" );
			}
		}
		// close all others
		var argLength = ShowHide.arguments.length;
  		for(arg=2; arg<argLength; arg++) {
			if (ShowHide.arguments[arg]!='') {
				styleElm = document.getElementById(ShowHide.arguments[arg]).style;
				styleElmBtn = document.getElementById([ShowHide.arguments[arg] + "btn"]);
				styleElm.display='none';
				if (changeButton) {
					// remove "open" class from button
					styleElmBtn.className = styleElmBtn.className.replace( "open", "" );
				}
			}
	  	}		
	}
// ------------------------------------------------------

