var sLabel  = "";
var sGo		= "";
var sEXRLang= "English";
var sSearch = "";
var sActionPage = "http://search.iadb.org/search.asp?querymode=basic";
//var sActionPage = "http://www.iadb.org/aboutus/searchDis.cfm";

if (typeof sLinkClass == 'undefined')
	var sLinkClass = "";
else
	if (sLinkClass.length > 0)
		sLinkClass = "Class = \"" + sLinkClass + "\"";

if (typeof sSearchScope == 'undefined')
	var sSearchScope = "ALL";

if (typeof sLanguage == 'undefined')
	var sLanguage = "EN";

if (typeof sTextStyle == 'undefined')
	var sTextStyle = "";
else
	if (sTextStyle.length > 0)
		sTextStyle = "Style = \"" + sTextStyle + "\"";

if (typeof sTextClass != 'undefined')
	if (sTextClass.length > 0)
		sTextStyle = "class = \"" + sTextClass + "\"";
	
if (typeof sBoxStyle == 'undefined')
	var sBoxStyle = "";
else
	if (sBoxStyle.length > 0)
		sBoxStyle = "Style = \"" + sBoxStyle + "\"";

if (typeof sBoxClass != 'undefined')
	if (sBoxClass.length > 0)
		sBoxStyle = "class = \"" + sBoxClass + "\"";

if (typeof iBoxSize == 'undefined')
	var iBoxSize = "";
else
	if (iBoxSize.length > 0)
		iBoxSize = "size = \"" + iBoxSize + "\"";

if (typeof sLabelText == 'undefined')
	var sLabelText = "";

if (typeof sGoText == 'undefined')
	var sGoText = "";

if (typeof iSearch == 'undefined')
	var iSearch = 1;
else
	iSearch = iSearch + 1;

if (typeof bLabel == 'undefined')
	var bLabel = true;

switch (sLanguage) 
{ 
   case "SP" : 
      if (sLabelText.length <= 0)
		sLabelText = "Buscar";
      if (sGoText.length <= 0)
		sGoText = "Ir";
	  sEXRLang = "Spanish";
      break; 
      
   case "FR" : 
      if (sLabelText.length <= 0)
		sLabelText = "Recherche";
      if (sGoText.length <= 0)
		sGoText = "OK";
	  sEXRLang = "French";
      break; 
      
   case "PO" : 
      if (sLabelText.length <= 0)
		sLabelText = "Busca";
      if (sGoText.length <= 0)
		sGoText = "OK";
	  sEXRLang = "Portuguese";
      break; 
      
   default : 
	  if (sLabelText.length <= 0)
		sLabelText = "Search";
      if (sGoText.length <= 0)
		sGoText = "Go";
}

if (typeof sGoImg != 'undefined')
	if (sGoImg.length > 0)
		sGo = "<img src=" + sGoImg + " border=0>";

if (sGo.length <= 0)
	sGo = sGoText;

if (typeof sLabelimg != 'undefined')
	if (sLabelimg.length > 0)
		sLabel = "<img src=" + sLabelimg + " border=0>";

if (sLabel.length <= 0)
	sLabel = sLabelText;
	
		
if (sSearchScope != "ALL")
{
	sSearch = "<table border=0 cellpadding=0 cellspacing=0 " + sTextStyle + ">" +
		"<form name=fSearch" + iSearch + " action="+sActionPage+" method=get>" +
		"	<tr valign=middle> ";
		
	if (bLabel)
		sSearch = sSearch + "<td nowrap> " + sLabel + " &nbsp;</td>";
		
	sSearch = sSearch + "<td nowrap><INPUT " + sBoxStyle + " name=Querytext ID=QueryTextSmall " + iBoxSize + "></td>" +
		"<td nowrap><a "+sLinkClass+" href=# onClick=document.fSearch" + iSearch + ".submit();>" + sGo + "</a></td>" +
		"<INPUT type=hidden value=Primary name=ServerKey ID=Hidden1> " +
		"<INPUT type=hidden value=newcoll name=collection ID=Hidden2>" +
		"<input type=hidden name=language value=" + sEXRLang + " ID=Hidden3/> " +
		"<INPUT type=hidden value=default.hts name=ResultTemplate ID=Hidden4> " +
		"<INPUT type=hidden value=normal name=ResultStyle ID=Hidden5> " +
		"<INPUT type=hidden value=docview.hts name=ViewTemplate ID=Hidden6> " +
		"<input type=hidden name=Scope  value=/" + sSearchScope + "/ ID=Hidden7>" +
		"</form></tr></table>";
	document.write(sSearch);
}
else
{
	sSearch = "<table border=0 cellpadding=0 cellspacing=0 " + sTextStyle + ">" +
		"<form name=fSearch" + iSearch + " action="+sActionPage+" method=get>" +
		"	<tr valign=middle> ";
		
	if (bLabel)
		sSearch = sSearch + "<td nowrap> " + sLabel + " &nbsp;</td>";
	
	sSearch = sSearch + "<td nowrap><INPUT " + sBoxStyle + " name=Querytext ID=QueryTextSmall " + iBoxSize + "></td>" +
		"<td nowrap><a "+sLinkClass+" href=# onClick=document.fSearch" + iSearch + ".submit();>	" + sGo + "</a></td>" + 
		"<INPUT type=hidden value=Primary name=ServerKey ID=Hidden1> " +
		"<INPUT type=hidden value=newcoll name=collection ID=Hidden2>" +
		"<input type=hidden name=language value= " + sEXRLang + " ID=Hidden3/> " +
		"<INPUT type=hidden value=default.hts name=ResultTemplate ID=Hidden4> " +
		"<INPUT type=hidden value=normal name=ResultStyle ID=Hidden5> " +
		"</form></tr></table>";
	document.write(sSearch);
}

sSearchScope = "";
sLanguage = "";
sTextClass = "";
sTextStyle = "";
sBoxClass = "";
sBoxStyle = "";
iBoxSize = "";
sLabelText = "";
sGoText = "";
sGoImg = "";
bLabel = true;
