var TourWin = null;

function openTour(URL,winName,width,height) {

windowWidth=width;
windowHeight=height;

if(screen.availWidth < windowWidth)  windowWidth=screen.availWidth;
if(screen.availHeight < windowHeight)  windowHeight=screen.availHeight;

if(TourWin && TourWin.open && !TourWin.closed)
{
//alert('Tour open')
viewTour();
}
else
{
//alert('Tour closed')
TourWin=window.open(URL,winName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+windowWidth+',height='+windowHeight);

//TourWin.blur()

setTimeout("resizeTourWindow(windowWidth,windowHeight)",750);

setTimeout("TourWin.focus()",1000);

}

return false;
}



function viewTour() {

 TourWin.document.body.rows = '420,0,*';

 resizeTourWindow(780,420);
 
TourWin.tourFrame.document.getElementById('pagecontent').style.visibility='visible';

 TourWin.focus();

}


function resizeTourWindow(width,height) {

var oW=width;
var oH=height;
  if( !oH ) { return false; }
  if( !oH ) { return false; }
 
//TourWin.moveTo(0,0);
  
  TourWin.window.resizeTo( oW + 50, oH + 50 );
  var myW = 0, myH = 0, d = TourWin.document.documentElement, b = TourWin.document.body;
  if( TourWin.innerWidth ) { myW = TourWin.innerWidth; myH = TourWin.innerHeight; }
  else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
  else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
  
  if( window.opera && !document.childNodes ) { myW += 16; }
  TourWin.window.resizeTo( oW + ( ( oW + 50 ) - myW ), oH + ( (oH + 50 ) - myH ) );
  
TourWin.moveTo(screen.availWidth/2-(oW/2),screen.availHeight/2-(oH/2));

}