// automatically closes window if click on originating window
function MM_closeBrWindow() { 

 if ( openPopup ) { 
  popUp.close();
  openPopup = false;
 }

 if (window != top) { 
  top.close();
 }
}

// set the popup window width and height
var windowW=825// wide
var windowH=700// high

// set the screen position where the popup should appear
//var windowX = (screen.width)-(windowW+20); // from left
var windowX = (screen.width)-20; // from left
//var windowY = (screen.height)-200; // from top

// variable indicating whether or not popup is open
var openPopup = false; 
var s = "left="+windowX+",top="+windowY+",height="+windowH+",width="+windowW;

// used to open pop-up window with frameset
function MM_openBrWindow(theURL) { //v2.0
  var beIE = document.all?true:false
  //browser detection
  if (beIE) {
     popUp = window.open(theURL,"JoanKaysRugs","scrollbars,"+s);
     popUp.resizeTo(windowW,windowH);
     popUp.moveTo(windowX,windowY); 
  openPopup = true;
  } else { 
    popUp = window.open(theURL,"JoanKaysRugs","scrollbars,"+s);
  openPopup = true; 
  }

}

