///////////////////////////////////////
//  Copyright SpectoDesign 2004      //
//  www.spectodesign.com             //
//  Axel Muench, September 03, 2004  //
//  $version: 1.0.1 mod: 10-21-04    //
///////////////////////////////////////

var debug = false;
var myWind = null;

function onTop() {
  if (myWind.blur) myWind.focus();
}

function blowOut() {
  if (myWind != null && myWind.open) myWind.close();
}


function NewWindowCopy(url, name, scroll, oldwindow) {
	var w = getWinWidth(oldwindow);
	var h = getWinHeight(oldwindow);
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'fullscreen=no,toolbar=yes,status=yes,menubar=yes,location=yes,directories=yes,height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	if (debug) {alert(winprops);}
	myWind = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { myWind.window.focus(); }
}




function NewWindowCopy2(url, name, scroll) {
	var w, h;
	
	if (document.layers){
		w=window.outerWidth;
		h=window.outerHeight;
		//alert("1 - w="+w+" h="+h);
	} else if (document.all){
		w=document.body.clientWidth;
		h=document.body.clientHeight;
		//alert("2 - w="+w+" h="+h);
	} else if(document.getElementById){
		w=window.outerWidth;
		h=window.outerHeight;
		//alert("3 - w="+w+" h="+h);
	} else {
		w = 600;
		h = 480;
	}
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'fullscreen=no,toolbar=yes,status=yes,menubar=yes,location=yes,location=yes,height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	if (debug) {alert(winprops);}
	myWind = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { myWind.window.focus(); }
	window.onLoad = NewWindowCopy2;
}

function NewCenterWindow(url, name, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	if (debug) {alert(winprops);}
	myWind = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { myWind.window.focus(); }
}


function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth + 'Height = ' + myHeight );
 }
 
 
 function getWinHeight(window) {
  var myHeight = 400;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
 }
 
 function getWinWidth(window) {
  var myWidth = 400;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return  myWidth;
 }