stBackgroundColor = '#EFF3F6';
stHighlightColor  = '#F9FEFF';
grBackgroundColor = '#EFF3F6';
grHighlightColor  = '#F9FEFF'; 
 
function Focus(Cell,Over,grupa) {
  if (grupa) {
    bcol = grBackgroundColor;
    hcol = grHighlightColor;
  } else {
    bcol = stBackgroundColor;
    hcol = stHighlightColor;
  }
  Cell.bgColor   = bcol;
  if (Over) Cell.bgColor = hcol;
  Cell.style.cursor = 'hand';
}
   
function OpnLnk(url,grupa) {
  if (grupa) {
    window.navigate(url);
  } else { 
    window.navigate(url);
    // window.open(url, '', 'height=370, width=302, top=100, left=100, scrollbars=yes');
  }
  return true;
} 
function OpnTrLnk(url) {
   parent.main.window.navigate(url); 
} 
function smallbig() {
  var smallwidth = 200;
  var smallheight = 150;
  //Set the amplificationfactor:
  amplificationfactor = 1.3;
  var largewidth = amplificationfactor * smallwidth;
  var largeheight = amplificationfactor * smallheight;
  if (document.image1.width == smallwidth) {
    document.image1.width  = largewidth;
    document.image1.height = largeheight;
  } else {
    document.image1.width  = smallwidth;
    document.image1.height = smallheight;
  }
}
function SearchDB(text) {
  srchhdr =  ' <html>                                                                       ' +
             '  <head>                                                                      ' +
             '   <META http-equiv=Content-Language content=bg>                              ' +
             '   <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> ' +
             '   <link rel="stylesheet" href="stylesheet.css" type="text/css">              ' +
             '   <script src = "functions.js"> </script>                                    ' +
             '  </head>                                                                     ' +
             '  <body style="background-color: #F3FEF3" topmargin="0" OnSelectStart="return false">' +
             '  <table border="0" height="5" width="100">                                          ' +
             '   <tr><td></td></tr>                                                                ' +
             '  </table>                                                                           ' +
             '  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>                          ' +
             '   <TR>                                                                              ' +
             '    <TD class=infoBoxHeading height=14>                                              ' +
             '     <IMG height=14 alt="" src="corner_left.bmp" width=11 border=0>                  ' +
             '    </TD>                                                                            ' +
             '    <TD class=infoBoxHeading width="100%" height=14>Резултати от търсенето</TD>      ' +
             '    <TD class=infoBoxHeading height=14>                                              ' +
             '     <IMG height=14 alt="" src="corner_right_left.bmp" width=11 border=0>            ' +
             '    </TD>                                                                            ' +
             '   </TR>                                                                             ' +
             '  </TABLE>                                                                           ' ;
             
  srchftr =  '  <table border="0" height="1" cellSpacing=0 cellPadding=0 width="100%" bgcolor="#B6B7CB"> ' +
             '   <tr><td height="1"> </td></tr>                                                          ' +
             '  </table>                                                                                 ' +
             '                                                                                           ' +
             '  <table border="0" height="5" width="100">                                                ' +
             '   <tr><td></td></tr>                                                                      ' +
             '  </table>                                                                                 ' +
             '                                                                                           ' +
             ' </body>                                                                                   ' +
             '</html>                                                                                    ' ;
      var res = '';
      var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
      var objNodeList;
      var objNode;
      var objNodeValList;
      var objNodeVal;
      xmlDoc.async = false;
      xmlDoc.load("data.xml");
      objNodeList    = xmlDoc.getElementsByTagName("K");
      objNodeValList = xmlDoc.getElementsByTagName("V");
      for ( var i = 0; i < objNodeList.length; i ++ ) {
        objNode    = objNodeList.nextNode();
        objNodeVal = objNodeValList.nextNode();
        if(objNode.text.toLowerCase(objNode.text).indexOf(text.toLowerCase(text))!= -1 ) {
        res = res +
            ' <table cellSpacing=0 cellPadding=0 border=0 width=\'100%\' bgcolor=\'#EFF3F6\' >                     ' +
            ' <TR onMouseOver=\'Focus(this,true,true)\' onMouseOut=\'Focus(this,false,true)\' OnClick=\'OpnLnk("' + objNodeVal.text +
            '",true)\' > ' +
            '  <TD width="40%" > ' +
            '   <img border="0" src="srch.bmp" width="16" height="16" align="left" hspace="0"> </img> ' +
            '    <font size="2" color="#555555"> ' +
            '    &nbsp; ' + objNode.text +
            '  </TD>  ' +
            ' </TR>   ' +
            '</table> ' ;
        }
      }
      if ( res.length > 0 ) {
        res = srchhdr + res + srchftr;
        parent.frames[1].document.body.innerHTML = res;
      } else {
        parent.frames[1].document.body.innerHTML = 
            srchhdr +  
            ' <table cellSpacing=0 cellPadding=0 border=0 width=\'100%\' bgcolor=\'#EFF3F6\' > ' +
            ' <TR onMouseOver=\'Focus(this,true,true)\' onMouseOut=\'Focus(this,false,true)\' > ' +
            '  <TD width="40%" > ' +
            '   <img border="0" src="srch.bmp" width="16" height="16" align="left" hspace="0"> </img> ' +
            '    <font size="2" color="#555555"> ' +
            '    &nbsp; Няма намерени резултати ' +
            '  </TD>  ' +
            ' </TR>   ' +
            '</table> ' +
            srchftr   ; 
      }
    }
   function SetCaption(text){
     try{
       parent.document.title=text;
       parent.parent.document.title=text;
     }
     catch(MyErr){}
     finally{}
   }

