/////////////////////////////////////////////////////////////////////////////
// Function : isTrue
// Comments :
/////////////////////////////////////////////////////////////////////////////
function ISSITE_SearchBoxPlainGoogle_isTrue( boolStr )
{
	if( boolStr.length > 0 )
	{
		var boolChar = boolStr.substring(0,1).toUpperCase();
		if( ( boolChar == '1' ) || ( boolChar == 'T' ) )
		{
			return true;
		}
	}

	return false;
}/////////////////////////////////////////////////////////////////////////////
// Function : ISSITE_SearchBoxPlainGoogle
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function ISSITE_SearchBoxPlainGoogle(strServer, strCgiUrl, strSiteId, strResultsPage, strButtonText, strClassName, strTextColor, strUserText, strSearchNodeID, strSearchType,strUrlPrefix,strSearchRelativeUrl, intIsMSIE, strImage)
{
	this.m_strServer = "http://www.utmb.edu";
	this.m_CgiUrl = "";
	this.m_SiteId = "ISSITE";
	this.m_ResultsPage = "";
	this.m_ButtonText="Search";
	this.m_ClassName  = 'ISSITE_SearchBoxPlainGoogle';
	this.m_TextColor  = '';
	this.m_UserText = '';
	this.m_SearchNodeID = '';
	this.m_SearchType = '';
	this.m_UrlPrefix = '/ISSITE/';
	this.m_SearchRelativeUrl = '';	
	this.m_IsMSIE = 0;
	this.m_FormName = "ISSITE_SearchBoxPlainGoogle";
	this.m_Image = '';
	
	if (strServer != '')
		this.m_Server = strServer;

	if (strCgiUrl != '')
		this.m_CgiUrl = strCgiUrl;

	if (strSiteId != null)
		this.m_SiteId = strSiteId;

	if (strResultsPage != '')
		this.m_ResultsPage = strResultsPage;

	if (strButtonText != '')
		this.m_ButtonText = strButtonText;

	if (strClassName != '')
		this.m_ClassName = strClassName;

	if (strTextColor != '')
		this.m_TextColor = strTextColor;
		
	if (strUserText != '')
		this.m_UserText = strUserText;
	
	if (strSearchNodeID != '')
		this.m_SearchNodeID = strSearchNodeID;

	if (intIsMSIE != '')
		this.m_IsMSIE = intIsMSIE;

	if (strSearchType != '')
	{
		this.m_SearchType = strSearchType;
	}
	else
	{
	if (this.m_IsMSIE == -1)
	{
	this.m_SearchType = "FullText";	
	}
	else 
	{	
	this.m_SearchType = "Google";
	}
	}
	if (strUrlPrefix != '')
		this.m_UrlPrefix = strUrlPrefix;
	if (strSearchRelativeUrl != '')
		this.m_SearchRelativeUrl = strSearchRelativeUrl;
	

	if (strImage != '')
		this.m_Image = strImage;

	ISSITE_SearchBoxPlainGoogle_Display()
}

function ISSITE_SearchBoxPlainGoogle_Display()	
{
	var ds = new Array();
	var di = 0;
	if (this.m_IsMSIE == -1) 
	{
	ds[di++] = '&nbsp;<BR><BR>';
	}
//	ds[di++] = '<script>document.form1.action="'+ this.m_strServer + this.m_UrlPrefix + 'GoogleResults/' + this.m_ResultsPage +'";</script>'
//	ds[di++] = '<form action="' + this.m_strServer + this.m_UrlPrefix + 'GoogleResults/' + this.m_ResultsPage;
//	ds[di++] = '" + method="get"  name="' + this.m_FormName + '"';
//	ds[di++] = 'style="normal" >';

	ds[di++] = '<input type=hidden name="SearchRelativeUrl" value="' + this.m_SearchRelativeUrl + '">';
	
	var currentUrl = "" + window.location;
	
	var previewId = "previewId=";
	var posStart = currentUrl.indexOf( previewId );
	

///////////////////////////////////////////////////
//Search Type - User Can search either Google, Full Text
//or search just Title (dDocTitle)
///////////////////////////////////////////////////


if (this.m_IsMSIE >= 0)
	{
	ds[di++] = '<input';
	ds[di++] = ' class = "' + this.m_ClassName + '"';
	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	
	var trik = this.m_UserText.replace(/"/g, '&quot;');	
	ds[di++] = ' INPUT TYPE="Radio" name="SearchType" value="Google" ';

	if (this.m_SearchType == 'Google')	
	{
		ds[di++] = 'checked';
	}	
	ds[di++] = '>';
	ds[di++] = '<span class="' + this.m_ClassName + '"';
	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	ds[di++] = '>Google</span> ';
	}

else
	{ds[di++] = '<BR><BR>';}


	ds[di++] = '<input';
	ds[di++] = ' class = "' + this.m_ClassName + '"';

	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	
	var trik = this.m_UserText.replace(/"/g, '&quot;');	
	ds[di++] = ' INPUT TYPE="Radio" name="SearchType" value="FullText" ';

	if (this.m_SearchType == 'FullText')	
	{
		ds[di++] = 'checked';
	}	
	ds[di++] = '><span class="' + this.m_ClassName + '"';
	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	ds[di++] = '>Full Text</span> ';




	ds[di++] = '<input';
	ds[di++] = ' class = "' + this.m_ClassName + '"';

	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	
	var trik = this.m_UserText.replace(/"/g, '&quot;');	
	ds[di++] = ' INPUT TYPE="Radio" name="SearchType" value="TitleSearch" ';

	if (this.m_SearchType == 'TitleSearch')	
	{
		ds[di++] = 'checked';
	}	
	ds[di++] = '><span class="' + this.m_ClassName + '"';
	if (this.m_TextColor != '')	
	{
		ds[di++] = ' style="color:' + this.m_TextColor + ';"';
	}	
	ds[di++] = '>Title</span>';




		ds[di++] = '&nbsp;<input';
		ds[di++] = ' class = "' + this.m_ClassName + '"';
		ds[di++] = ' style="font-weight: normal; color:#000000;"';
	
		var trik = this.m_UserText.replace(/"/g, '&quot;');	
		ds[di++] = ' type=text name="ssUserText" maxlength="100" value="' + trik + '"';
		ds[di++] = ' onFocus="if&#40;this.value==&#39;'+ trik + '&#39;&#41; {this.value=&#39;&#39;;}" onBlur="if&#40;this.value==&#39;&#39;&#41; {this.value=&#39;'+ trik + '&#39;;}"';
		ds[di++] = ' onsubmit={document.aspnetForm.action="'+ this.m_strServer + this.m_UrlPrefix + 'GoogleResults/' + this.m_ResultsPage +'";document.go_image.border=1;submit();}; ';
		ds[di++] = ' >';
	
	if (this.m_Image  != '')
	{
		ds[di++] = '<img src="' + this.m_Image  + '"' ;
		ds[di++] = ' name = "go_image"';	
		ds[di++] = ' border = "0.0"';	
		ds[di++] = ' class = "' + this.m_ClassName + '"';	
		ds[di++] = ' STYLE="position:relative; HEIGHT: 0em WIDTH:0em; LEFT: 0em; TOP: 0.25em"';	
		ds[di++] = ' title="Click here to search" ';
		ds[di++] = ' onclick={document.aspnetForm.action="'+ this.m_strServer + this.m_UrlPrefix + 'GoogleResults/' + this.m_ResultsPage +'";document.go_image.border=1;submit();}; ';
		ds[di++] = ' />';


	}
	else
	{
		ds[di++] = '<input';
		ds[di++] = ' class = "' + this.m_ClassName + '"';	

		if (this.m_TextColor != '')	
		{
			ds[di++] = ' style="color:' + this.m_TextColor + ';"';
		}	
	
		ds[di++] = ' type=submit value="' + this.m_ButtonText + '">';
	}	

	
///////////////////////////////////////////////////
//This particular fragment searches within the specified node.
//The hidden field below will capture the nodeID and 
//pass it to the search query.
///////////////////////////////////////////////////

		ds[di++] = '<input';
		ds[di++] = ' class = "' + this.m_ClassName + '"';

		if (this.m_TextColor != '')	
		{
			ds[di++] = ' style="color:' + this.m_TextColor + ';"';
		}		
		var trik = this.m_UserText.replace(/"/g, '&quot;');	
		ds[di++] = ' INPUT TYPE="hidden" name="SearchNodeID" value="' + this.m_SearchNodeID + '">';



//	ds[di++] = '</form>';

	document.write(ds.join(''));
}
