var pop;

function popUp(file)
{ 

var details;
var content;
if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 640, yMax=400;
    var xOffset = (xMax - 370)/2, yOffset = (yMax - 430)/2;
details  = "width=370,height=430,resizable=no,screenX=" + xOffset;
details += ",screenY=" +yOffset+ ",top=" + yOffset+ ",left=" + xOffset;
content  = "<HTML><HEAD>\n<TITLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PJ Design";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "</TITLE>\n<link href=\"style.css\" type=text/css rel=stylesheet>\n</HEAD>\n";
content += "<BODY onBlur='window.close()' BGCOLOR=\"#ff9966\" BACKGROUND=\"\">\n";
content += "<CENTER>\n<P>";
content += "<FORM><INPUT TYPE='BUTTON' VALUE='Close' onClick='window.close()'></FORM>\n";
content += "<IMG SRC='images/" + file + ".jpg' BORDER=0>\n";
content += "</CENTER>\n</BODY></HTML>";

pop = window.open("","",details);
pop.document.open();
pop.focus();
pop.document.write(content);
pop.document.close();
return false;
}

function popUpthumb(file)
{ 
var details;
var content;
if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 640, yMax=400;
    var xOffset = (xMax - 180)/2, yOffset = (yMax - 220)/2;
details  = "width=180,height=220,resizable=no,screenX=" + xOffset;
details += ",screenY=" +yOffset+ ",top=" + yOffset+ ",left=" + xOffset;
content  = "<HTML><HEAD>\n<TITLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "</TITLE>\n<link href=\"includes/pete1.css\" type=text/css rel=stylesheet>\n</HEAD>\n";
content += "<BODY onBlur='window.close()'>\n";
content += "<P style=\"text-align:center;\">";
content += "<FORM><INPUT TYPE='BUTTON' VALUE='Close' onClick='window.close()'></FORM>\n";
content += "<IMG SRC='" + file + "' BORDER=0>\n";
content += "</P>\n</BODY></HTML>";

pop = window.open("","",details);
pop.document.open();
pop.focus();
pop.document.write(content);
pop.document.close();
return false;
}

// ******************************************************************************************

function swapfinish(code,indx)
  {
  variants = eval(code + 'variants')[indx]; 
// 0 => code
// 1 => price
// 2 => per
// 3 => name
// 4 => imagefile
// 5 => finish
// alert ('originalitem ='+code+', code='+variants[0]+', price='+variants[1]+', per='+variants[2]+', name='+variants[3]+', image='+variants[4]+', finish='+variants[5]);

  var formname = code;
  var itemname = code + '_name';
  var itemcode = code + '_code';
  var itemprice = code + '_price';

//  document.images[formname].src = 'thumbs/' + variants[4] + '.jpg';
  var itemimage = code + '_image';
  document.getElementById(itemimage).src = 'thumbs/' + variants[4] + '.jpg';
  document.getElementById(itemcode).innerHTML = variants[0];
  document.getElementById(itemprice).innerHTML = variants[1] + ' ' + variants[2];
  document.getElementById(itemname).innerHTML = variants[3];
  }

function trunc(file)
{ 
var start = file.lastIndexOf("/") + 1;
var end = file.lastIndexOf(".");
file = file.substring(start,end);
// alert(file);
return file;
}

function popup1(file)
{ 
var details;
var content;
if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 640, yMax=400;
    var xOffset = (xMax - 370)/2, yOffset = (yMax - 430)/2;
details  = "width=370,height=430,resizable=no,screenX=" + xOffset;
details += ",screenY=" +yOffset+ ",top=" + yOffset+ ",left=" + xOffset;
content  = "<HTML><HEAD>\n<TITLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PJ Design";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
content += "</TITLE>\n<link href=\"includes/pete1.css\" type=text/css rel=stylesheet>\n</HEAD>\n";
content += "<BODY style=\"text-align:center;\" onBlur='window.close()'>\n";
content += "<P>";
content += "<FORM><INPUT TYPE='BUTTON' VALUE='Close' onClick='window.close()'></FORM>\n";
content += "<IMG SRC='images/" + file + ".jpg' BORDER=0 onError='this.src = \"spacer.gif\"'>\n";
content += "</P>\n</BODY></HTML>";

pop = window.open("","",details);
pop.document.open();
pop.focus();
pop.document.write(content);
pop.document.close();
return false;
}

