//JS code for opening sizes and swatches windows
//(Code used on the product pages)
//Script by Pure Energy Multimedia

var SizeWindow,SwatchWindow;

function OpenProductCmnWnd(str_thewindow,SwatchNo,w,h) {
  var windowobj;
  windowobj = eval(str_thewindow);
  if (windowobj) {          //If the window has been created (from this page - all we know) already,
    if (windowobj.closed) {windowobj = Actual_OpenProductCmnWnd(str_thewindow,SwatchNo,w,h)} //If it's been closed open it again
  }
  else {windowobj = Actual_OpenProductCmnWnd(str_thewindow,SwatchNo,w,h)} //If we haven't opened the window,
                                                             //or at least not from this page, open it

  windowobj.focus() ; //Give the window focus whatever happened above, to make sure it is on top
}

function Actual_OpenProductCmnWnd(str_thewindow,SwatchNo,w,h) {
  if (str_thewindow == 'SizeWindow') {
    SizeWindow = window.open('SizeWindow.html','SizeWindow','height=410,width=600,screenX=50,left=50,screenY=50,top=50,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
    return SizeWindow;
  }
  else if (str_thewindow == 'SwatchWindow') {
    SwatchWindow = window.open('swatches/' + SwatchNo + '.html','SwatchWindow','height=' + h*160 + ',width=' + w*165 + ',screenX=50,left=50,screenY=50,top=50,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
    return SwatchWindow;
  }
}
