/*
 * Collection of helpful javascript classes/methods
 *
 * @author Markus Kobler
 */

var FunctionUtil = {

  scopedPointer: function( thisObj, func ) {
    var f = typeof func == "string" ? thisObj[func] : func;
    return function() {
      f.apply(thisObj, arguments );
    };
  }

};

function openWindow( url, target, features ) {

  if( target == null ) target = "_blank";
  if( features == null ) features = "toolbar=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes";
  window.open( url, target, features ).focus();

  return false;
}

function openCustomWindow( url, target, width, height, features, centre ) {
  
  var f = "width="+width;
  if( centre ) f += ",left=" + ((screen.availWidth - width) / 2);
  f += ",height="+height;
  if( centre ) f += ", top=" + ((screen.availHeight - height) / 2);
  f += "," + (features != null ? features : "toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");

  window.open( url, target, f ).focus();

  return false;

}

function openCenteredWindow( url, target, width, height, features ) {

  return openCustomWindow( url, target, width, height, features, true ); 

}

//Exit Popup

/**
var userClicked123=false;
document.onkeydown=spyclick123;
document.onmousedown=spyclick123;
function spyclick123()
{
      userClicked123=true;
      setTimeout("userClicked123=false",2000);
}
function popup123()
{
      if(!userClicked123)
      {
	  //alert(".");
            var win123 = window.open("http://www.boomerangtv.co.uk/advertising_microsites/survey/index.html","_blank","width=500,height=550,scrollbars=1,resizable=1");
      }
}
window.onbeforeunload=popup123;
**/