document.write('<div class=\"column\" onmouseover=\"stay()\">\<input  type=\"text\"  onfocus=\"ScripNameOnFocus();\" onblur=\"ScripNameOnBlur();\" value=\"Scrip Name\" id=\"Top1_TxtQuotes\" style=\"width:80px\"/>\
  <select name=\"Top1_DD_Profile\" id=\"Top1_DD_Profile\" align=\"absmiddle\"    style=\"width:100px\">\
  <option value="0">Detailed Quote</option>\
   <option value="1">Company Snapshot</option>\
   <option value="4">Company News</option>\
   <option value="7">Charting</option>\
  </select>\
\
  <img src=\"'+vpath+'images/Revamp/go.gif\" onclick=\"SearchCompany();\" alt=\"Go\" title=\"Go\" width=\"43\" height=\"22\" align=\"absbottom\" /></div>');
  
 function SearchCompany()
	{	 
		var SrchComp = document.getElementById("Top1_TxtQuotes");
		 
		if(InStr(SrchComp.value,"'")!=-1)
		{
			alert("Please enter valid symbol...");	
			document.getElementById("Top1_TxtQuotes").value =" ";	
			return;	
		}
		
	 	var PageId = document.getElementById("Top1_DD_Profile").value;
		//var  coName = 
		 
		var arr = new Array("Detailed Quote","Company Snapshot","","","Company News","","","Charting");
		var selectPage = arr[PageId];
		 
		if(selectPage == "Detailed Quote" || selectPage == "Charting")
		{
		    PageId = 1;
		}
		
		if(selectPage == "Company Snapshot" || selectPage == "Company News")
		{
		    PageId = 0;
		} 
	
		var StrUrl = vpath+"Markets/RevampCompanyInfo/GenInformation.do?reqCode=generalInfo&page="+PageId + "&selectOption="+selectPage + "&coName="+SrchComp.value;
				 
		if(TrimSpaces(SrchComp.value)=="ScripName")
		{
			alert("Please enter symbol ..!!!");			
		}
		else
		{
			window.location = StrUrl;
		}
	}
	
function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}
function InStr(strSearch, charSearchFor)
{
 
            for (i=0; i < strSearch.length; i++)
            {
                  if (charSearchFor == Mid(strSearch, i, 1))
                  {
                        return i;
                       
                  }
            }
            return -1;
}
/* To search topnav.jsp: start here */
function ScripNameOnFocus()
{	
	var txtScripName = document.getElementById("Top1_TxtQuotes");
		
	if(txtScripName.value=='Scrip Name')
	{
		txtScripName.value="";
		return true;
	}	
	return false;
}
function ScripNameOnBlur()
{	
	var txtScripName = document.getElementById("Top1_TxtQuotes");	
		
	if(TrimSpaces(txtScripName.value)=='')
	{
		txtScripName.value="Scrip Name";
		return true;
	}	
	return false;
}
/**/
/* Below is utility function used to trim the space in String */
function TrimSpaces(checkString)
{
    newString = "";    // REVISED/CORRECTED STRING
    for (i = 0; i < checkString.length; i++) 
    {
        ch = checkString.substring(i, i+1);
        if (ch != " " ) 
        {
            newString += ch;
        }
    }
        return newString;
}
