﻿// JScript File

var imgWindow;
function Show(path,pn)
{
   var txt = ""
   var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
   xmlDoc.async="false"
   xmlDoc.load(path + "xml/product.xml")

   imgWindow=window.open("","content","status=0,scrollbars=0,resizable=0,width=600,height=400,left=100,top=100");
   imgWindow.document.open();

   tree=xmlDoc.documentElement
   search(path,tree,pn)
}
function search(path,tree, pn)
{
   //alert("pn:" + pn)
   var photo;
   var name;
   var partnumber;
   var description;
   var manufacturer;
   if(tree.hasChildNodes()) {
      //imgWindow.document.writeln("p1 has: " + tree.childNodes.length)
       for(var i=0; i<tree.childNodes.length; i++)
       {
         photo="";
         name="";
         partnumber="";
         description="";
         manufacturer="";
         var nodes2=tree.childNodes(i);
         for(var j=0; j<nodes2.childNodes.length; j++)
         {
            switch(nodes2.childNodes(j).tagName)
            {
                case 'PhotoSource':
                   photo = nodes2.childNodes(j).text
                   break;
                case 'FullName':
                   name = nodes2.childNodes(j).text
                   break;
                case 'PartNumber':
                   partnumber = nodes2.childNodes(j).text
                   break;
                case 'Description':
                   description = nodes2.childNodes(j).text
                   break;
                      
                case 'Manufacturer':
                   manufacturer = nodes2.childNodes(j).text
                   break;
            }  
         }
         
         if (partnumber==pn)
         {
         //alert("pn -end" + pn)
         imgWindow.document.writeln("<html>")
         imgWindow.document.writeln("<head>")
         imgWindow.document.writeln("<link rel=\"Stylesheet\" type=\"text/css\" href=\"" + path + "scripts/css/satori.css\">")
         imgWindow.document.writeln("<head>")
         imgWindow.document.writeln("</head>")
         imgWindow.document.writeln("<body style=\"background-color: #FFFFFF\">")
            //imgWindow.document.writeln("<br> $"+ i + "$- -" +j +" - - - items : " + photo + " * " + name + " * " + partnumber + " * " + description + " * " + manufacturer)
                     
            imgWindow.document.writeln("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"3\" class=\"contentGeneral\">")
              imgWindow.document.writeln("<tr>")
                         
                imgWindow.document.writeln("<td colspan=\"2\" class=\"txtBTitle\ valign=\"top\" style=\"border-bottom: solid 1 #0A2E6A;\">")
                imgWindow.document.writeln("Equipment Information")
                imgWindow.document.writeln("</td>")
              imgWindow.document.writeln("</tr>")
              imgWindow.document.writeln("<tr>")
                         
                imgWindow.document.writeln("<td colspan=\"2\" class=\"txtBTitle\ valign=\"top\">")
                imgWindow.document.writeln("<br>")
                imgWindow.document.writeln("</td>")
              imgWindow.document.writeln("</tr>")                                         
              imgWindow.document.writeln("<tr>")
                         
                imgWindow.document.writeln("<td width=\"20%\" valign=\"top\">")
                  if(photo=="")                                     
                     imgWindow.document.writeln("<img src=\"" + path + "img/logo_notavailable.jpg\">")
                  else
                  {
                     imgWindow.document.writeln("<img src=\""  + path + photo +  "\">")
                     }
                  
                                                       
                imgWindow.document.writeln("</td>")
                                                       
                imgWindow.document.writeln("<td width=\"60%\" valign=\"top\">")
                  imgWindow.document.writeln("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"txtNormal\" style=\"font-size:9pt;\">")
                                                            
                    imgWindow.document.writeln("<tr>")
                      imgWindow.document.writeln("<td class=\"txtBTitle\">" + name + "</td>")
                    imgWindow.document.writeln("</tr>")
                                                           
                    imgWindow.document.writeln("<tr>")
                      imgWindow.document.writeln("<td>Part Number: " + partnumber + "<br><br></td>")
                    imgWindow.document.writeln("</tr>")
                    
                    imgWindow.document.writeln("<tr>")
                      imgWindow.document.writeln("<td><p>")
                      imgWindow.document.writeln(description)
                      imgWindow.document.writeln("</p></td>")
                    imgWindow.document.writeln("</tr>")                                       
                                                  
                  imgWindow.document.writeln("</table>")
                imgWindow.document.writeln("</td>")
              imgWindow.document.writeln("</tr>")
                                                     
            imgWindow.document.writeln("</table>")
            imgWindow.document.writeln("<div STYLE=\"display: block; position: absolute;top: 380px; right: 0px; bottom:0px; left:250;\">")
               
            imgWindow.document.writeln("</div>")
            imgWindow.document.writeln("</body></html>")
          }       
      }
   }
   else
   {
      imgWindow.document.writeln("nothing")
   }
   
}
