// Simple JS Database engine
// by NileLogic (www.nilelogic.com); 
// (c) 2002 NileLogic 
// Code grade 3/10

function loadPage (destination,url,extra) {
var s="";
s="<table id='"+destination.id+"' border='0' cellpadding='2' cellspacing='1'  height='100%' width='100%'  style='{font-family:verdana;font-size:10pt}' bgcolor='#0b86b8'>";
s=s+"<tr bgcolor='white' align='center' valign='middle'>";
s=s+"<td>"
s=s+"<iframe width=100% height='100%' frameborder=0 allowTransparency=true src="+url+"></iframe>";
s=s+"</td>"
s=s+"</tr>";

s=s+"<tr bgcolor='white' align='center' valign='top' height='1' style='{font-family:verdana;font-size:14pt}'>";
s=s+"<td>"
if (extra) s=s+'<b>'+extra;
s=s+"</td>"
s=s+"</tr>";

s=s+"</table>";
destination.outerHTML=s;
return false;
}

function catalogElement (category,photo,reference,desc,packaging,cartSize,volume,netWeight,grossWeight) 
{
this.category=category;
this.photo=photo;
this.reference=reference;
this.desc=desc;
this.packaging=packaging;
this.cartSize=cartSize;
this.volume=volume;
this.netWeight=netWeight;
this.grossWeight=grossWeight;
}

function addCatalog(category,photo,reference,desc,packaging,cartSize,volume,netWeight,grossWeight){
catalog[catalog.length]=new catalogElement(category,photo,reference,desc,packaging,cartSize,volume,netWeight,grossWeight);
}

function renderCatalog (category,destination) {
var s="";
s="<table id='"+destination.id+"' border='0' cellpadding='2' cellspacing='1' width='100%' style='{font-family:verdana;font-size:10pt}' bgcolor='#0b86b8'>";
s=s+"<tr bgcolor='#0b86b8'>";
s=s+"<td nowrap><font color='white'>Photo</font></td>";
s=s+"<td nowrap><font color='white'>Ref #</font></td>";
s=s+"<td nowrap><font color='white'>Describtion</font></td>";
s=s+"<td nowrap><font color='white'>Packaging</font></td>";
s=s+"<td nowrap><font color='white'>Cartoon Size</font></td>";
s=s+"<td nowrap><font color='white'>Volume</font></td>";
s=s+"<td nowrap><font color='white'>Net weight</font></td>";
s=s+"<td nowrap><font color='white'>Gross Weight</font></td>";
s=s+"</tr>";
for (i=0;i<catalog.length;i++){
if (catalog[i].category!=category) continue;
s=s+"<tr bgcolor='white' align='center' valign='middle'>";
s=s+"<td nowrap><a href='#' onclick='return renderElement("+destination.id+","+i+");'>"+"<img border=0 src='"+imageBase+catalog[i].photo+"s.jpg'></a></td>";
s=s+"<td nowrap><a href='#' onclick='return renderElement("+destination.id+","+i+");'>"+catalog[i].reference+"</a></td>";
s=s+"<td nowrap><a href='#' onclick='return renderElement("+destination.id+","+i+");'>"+catalog[i].desc+"</a></td>";
s=s+"<td nowrap>"+catalog[i].packaging+"</td>";
s=s+"<td nowrap>"+catalog[i].cartSize+"</td>";
s=s+"<td nowrap>"+catalog[i].volume+"</td>";
s=s+"<td nowrap>"+catalog[i].netWeight+"</td>";
s=s+"<td nowrap>"+catalog[i].grossWeight+"</td>";
s=s+"</tr>";
}
s=s+"</table>";
destination.outerHTML=s;
return false;
}

function renderElement (destination,idx) {
var s="";
s="<table border='0' cellpadding='2' cellspacing='1' width='100%'";
s=s+"id='"+destination.id+"'";
s=s+"style='{font-family:verdana;font-size:10pt}' bgcolor='white'><tr align='center' valign='middle' bgcolor='white'><td nowrap><div align='right'>";
s=s+"<a href='#' onclick='";
s=s+"return renderCatalog("+catalog[idx].category+","+destination.id+")";
s=s+"'>&lt;&lt; back</a></div></td></tr><tr bgcolor='#0b86b8' align='center' valign='middle'><td nowrap><font color='white'><b>Photo</b></font></td></tr><tr bgcolor='white' align='center' valign='middle'><td nowrap><img";
s=s+" src='"+imageBase+catalog[idx].photo+".jpg'";
s=s+" border='0'></td></tr><tr bgcolor='white'><td><table border='0' cellpadding='2' cellspacing='1' width='100%' style='{font-family:verdana;font-size:10pt}' bgcolor='#0b86b8'><tr bgcolor='#0b86b8'>";
s=s+"<td nowrap><font color='white'><b>Packaged photo</b></font></td><td nowrap><font color='white'><b>Ref #</b></font></td><td nowrap><font color='white'><b>Describtion</b></font></td><td nowrap><font color='white'><b>Packaging</b></font></td></tr><tr bgcolor='white' align='center' valign='middle'><td nowrap><img";
s=s+" src='"+imageBase+catalog[idx].photo+"p.jpg'";
s=s+"></td><td nowrap>";
s=s+catalog[idx].reference;
s=s+"</td><td nowrap>";
s=s+catalog[idx].desc;
s=s+"</td><td nowrap>";
s=s+catalog[idx].packaging;
s=s+"</td></tr></table></td></tr><tr bgcolor='white'><td><table border='0' cellpadding='2' cellspacing='1' width='100%' style='{font-family:verdana;font-size:10pt}' bgcolor='#0b86b8'><tr bgcolor='#0b86b8'><td nowrap><font color='white'><b>Cartoon Size</b></font></td><td nowrap><font color='white'><b>Volume</b></font></td><td nowrap><font color='white'><b>Net weight</b></font></td><td nowrap><font color='white'><b>Gross Weight</b></font></td></tr><tr bgcolor='white' align='center' valign='middle'>";
s=s+"<td nowrap>";
s=s+catalog[idx].cartSize;
s=s+"</td><td nowrap>";
s=s+catalog[idx].volume;
s=s+"</td><td nowrap>";
s=s+catalog[idx].netWeight;
s=s+"</td><td nowrap>";
s=s+catalog[idx].grossWeight;
s=s+"</td></tr></table></td></tr></table>";

destination.outerHTML=s;
}

imageBase="images/";
catalog=new Array;


