   /**
    * Used to be able to tab to ad input field when inserting ads and FCKEditor is used
    */
   function focusIframeOnTab (caller, tabTargetId, callEvent) {

     keycode=callEvent.keyCode;

     //alert(keycode);
     if (keycode == 9) {   //tab
       document.getElementById(tabTargetId).contentWindow.focus();
     }

   }

    function fullScreenWindow (url) {
      window.open(url, 'fullScreenZoom', 'left=0, top=0, width=' + (screen.width-10) + ', height=' + (screen.height-50) + ', scrollbars=yes, toolbar=no, resizeable=yes');
    }

    
    function var_dump(obj) {
      if(typeof obj == "object") {
          return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
      } else {
          return "Type: "+typeof(obj)+"\nValue: "+obj;
      }
    }

    function in_array(strNeedle, arrayHaystack) {
      for (i = 0; i < arrayHaystack.length; i++) {
          if (strNeedle == arrayHaystack[i]) return true;
      }
      return false;
    }


    function getCheckedValue(radioOrCheckboxControl){
    
      for(var i = 0; i < radioOrCheckboxControl.length; i++){
        if(radioOrCheckboxControl[i].checked){
          return(radioOrCheckboxControl[i].value);
        }
      }
    
      return false;
    }


    

// Zoom In/Zoom Out izPart1 (14-03-2005)
// by Vic Phillips http://www.vicsjavascripts.org.uk
//
// Click the Thumbnail to progressivly Zoom In.
// Click again to progressivly Zoom Out.
// The Thumbnail Image is swapped for the Large Image before Zooming.
//
// This can be applied to any number of Thumbnails on the same page.
// When one Thumbnail is zooming other Zoom functions
// are locked out until the zoom is complete.
// The speed of zoom acounts for final image size
// and can be optionally modified to requirement in the Zoom function call.

// Typical application to Zoom onClick
//    <img src="../../StdImages/One.gif" width="75"  height="56" border="0"
//     onmouseover="javascript:izClick(this,'*LargeImage*',*Width,*Height*,*Speed*);"  />
// Typical application to Zoom onMouseOver/onMouseOut
//    <img src="../../StdImages/One.gif" width="75"  height="56" border="0"
//     onmouseover="javascript:izZoom(this,'*LargeImage*',*Width,*Height*,*Speed*);"
//     onmouseout="javascript:izZoom(this);"
//  />
// where
// *LargeImage* = The large image to zoom   (string)
// *Width*      = the maximum zoom width    (digits)
// *Height*     = the maximum zoom height   (digits)
// *Speed*     = the zoom speed (optional)  (digits)
//
// Customising Variables - include directly on page.
// var izLoading='Loading.gif'; // the image to display as large images are loading
// var izZIndex=0;              // the base Z-Index for the images

// Zoom In/Zoom Out izPart2 (14-03-2005)
// by Vic Phillips http://www.vicsjavascripts.org.uk
//

// No Need to Change
// Set Arrays and Initial Conditions for izLk & ThisPhoto
var izObjAry=new Array()
var izObjNu=0;
var izLk=0;
var izInc,izAdd;
var izCursor='pointer';
if (document.all){ izCursor='hand'; }

//PreLoad Loading Image
var Loading = new Image();
 Loading.src=izLoading;

function izClick(izobj,izphoto,izmw,izmh,izspd){
 izobj.style.cursor='hand';
 if (!izobj.getAttribute('title')){
  izobj.title='Click to Zoom In/Click to Zoom Out';
 }
// Set izspd to 1 if izspd is not set in Zoom function call
 if (izspd==null){ izobj.izspd=1;}
 izobj.onclick=function(){ izZoom(izobj,izphoto,izmw,izmh,izspd); }
}

function izZoom(izobj,izphoto,izmw,izmh,izspd){
 if (izLk){ return; }
// prevents re-Zoom while Zooming
 izLk=1;
// Convert Local Variables to Global
 izObj=izobj;
 if (izspd==null){ izObj.izspd=1;}
// izspd of Zoom
// Check izObjAry for izObj and add if required
 izAdd=1;
 for (var iz0=0;iz0<izObjAry.length;iz0++){
  if (izObjAry[iz0]==izObj){
   izObj.src=izObj.large.src;
   izAdd=0;
  }
 }
 if (izAdd){
  izObj.clone=izObj.cloneNode(true);
  if (!izObj.izspd){ izObj.izspd=izspd; }
  izObj.izt=zxcTop(izObj);
  izObj.izl=zxcLeft(izObj);
  izObjAry[izObjNu]=izObj;
  izObj.style.position='absolute';
  izObj.style.zIndex=izZIndex+1;
  izObj.style.top=izObj.izt+'px';
  izObj.style.left=izObj.izl+'px';
  izObj.minw=izObj.offsetWidth;
  izObj.minh=izObj.offsetHeight;
  izObj.maxh=izmh;
  izObj.maxw=izmw;
  izObj.thumb=izObj.src;
  izObj.src=Loading.src; // change Thumb Image to 'Loading' Large Image
  izObj.zoom='In';
  izObj.large=new Image();
  izObj.large.obj=izObj;
  izObj.large.onload=function(){ izObj.large.obj.src=this.src; }
  izObj.large.src=izphoto;
  izObj.parentNode.insertBefore(izObj.clone,izObj);
  izObjNu++;
 }

// izspd of Zoom
 izInc=((izObj.maxw-izObj.minw)/100);   // Account for Zoom In size
 izInc=izInc*izObj.izspd;           // Speed specified in Local variable

 // Calculate Ratios
 izRatio=(izObj.maxh/izObj.maxw);

// Establish Photo and Zoom
 if (izObj.zoom=='Out'){
  izZoomOut();
  izObj.zoom='In';
 }
 else {
  izZoomIn();
  izObj.zoom='Out';
 }
}

function izZoomIn(){
 izObj.width=izObj.offsetWidth+izInc;
 izObj.height=izObj.offsetWidth*izRatio;
 izObj.style.top=(izObj.izt-(izObj.offsetHeight-izObj.minh)/2)+'px';
 izObj.style.left=(izObj.izl-(izObj.offsetWidth-izObj.minw)/2)+'px';

 if (izObj.offsetWidth<izObj.maxw){ setTimeout('izZoomIn();',10); }
 else {
  izLk=0;
  izObj.width=izObj.maxw;
  izObj.height=izObj.maxh;
 }
}

function izZoomOut(){
 izObj.width=izObj.offsetWidth-izInc;
 izObj.height=izObj.offsetWidth*izRatio;
 izObj.style.top=((izObj.izt+izObj.minh/2)-(izObj.offsetHeight/2))+'px';
 izObj.style.left=((izObj.izl+izObj.minw/2)-(izObj.offsetWidth/2))+'px';
 if (izObj.offsetWidth>izObj.minw){ setTimeout('izZoomOut()',10); }
  else {
   izLk=0;
   izObj.width=izObj.minw;
   izObj.height=izObj.minh;
   izObj.style.zIndex=izZIndex;
   izObj.style.top=(izObj.izt)+'px';
   izObj.style.left=(izObj.izl)+'px';
   //izObj.src=izObj.thumb; //Disabled to have fetched images stay behind as tiny thumbnails
  }
}

function zxcLeft(zxc){
 zxcObjLeft=zxc.offsetLeft;
 while(zxc.offsetParent!=null){
  zxcObjParent=zxc.offsetParent;
  zxcObjLeft+=zxcObjParent.offsetLeft;
  zxc=zxcObjParent;
 }
 return zxcObjLeft;
}

function zxcTop(zxc){
 zxcObjTop=zxc.offsetTop;
 while(zxc.offsetParent!=null){
  zxcObjParent=zxc.offsetParent;
  zxcObjTop+=zxcObjParent.offsetTop;
  zxc=zxcObjParent;
 }
 return zxcObjTop;
}

// END ImageZoom




/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
  this.ver=navigator.appVersion
  this.dom=document.getElementById?1:0
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
  this.ie4=(document.all && !this.dom)?1:0;
  this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
  return this
}
bw=new checkBrowser()
//With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
  else obj.visibility='visible'
}
//Shows the div
function show(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  obj.visibility='visible'
}
//Hides the div
function hide(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  obj.visibility='hidden'
}

function toggleOnOff(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  if(obj.display=='' || obj.visibility=='block') obj.display='none'
  else obj.display='block';
}
function on(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  obj.display='block';
}
function off(div,nest){
  obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
  obj.display='none';
}

// END hide/show functions



/* Message box */

function MessageBox() {

  var Callback;

  //Assumes a DIV with an MsgBox is already added to the document. Must have display, width and height set in style
  this.msgBoxDiv = window.document.getElementById("MsgBox");
  this.msgBoxTitle = window.document.getElementById("MsgBoxTitle");
  this.msgBoxText = window.document.getElementById("MsgBoxText");
  this.dimScreenDiv = window.document.getElementById("dimScreenDiv");

  this.Show = function (title, text, callback) {
  
    //Setup the event handler
    this.Callback = callback;
    
    //Set the text
    this.msgBoxTitle.innerHTML = title;
    this.msgBoxText.innerHTML = text;

    /* Dim screen */
    on("dimScreenDiv");
    this.dimScreenDiv.style.zindex = 1000000000;

    /* Show message box */
    on("MsgBox");
    this.msgBoxDiv.style.zindex = 1000000001;

    Callback = callback;

  }
  
  this.Hide = function (result) {

    off("MsgBox");
    off("dimScreenDiv");
    this.msgBoxDiv.style.zindex = -1;
    this.dimScreenDiv.style.zindex = -1;
    var s = Callback + "('" + result + "');";
    eval(s);

  }
  
  this.setMsgBoxPosition = function () {

    this.dimScreenDiv.style.left = getScrollLeftOffset();
    this.dimScreenDiv.style.top = getScrollTopOffset();
    this.dimScreenDiv.style.width = '100%';
    this.dimScreenDiv.style.height = '100%';
    
    /* Old */
    //this.msgBoxDiv.style.left = getScrollLeftOffset() + (getViewableWidth() - this.msgBoxDiv.offsetWidth)/2;
    //this.msgBoxDiv.style.top = getScrollTopOffset() + (getViewableHeight() - this.msgBoxDiv.offsetHeight)/2;

    this.msgBoxDiv.style.left = getScrollLeftOffset();
    this.msgBoxDiv.style.top = getScrollTopOffset();
    this.dimScreenDiv.style.width = '100%';
    this.dimScreenDiv.style.height = '100%';

  }

  this.setMsgBoxPosition();

}

function MsgBoxResultHandler(result){
  alert(result);
}


function getScrollLeftOffset() {
  return (document.all) ? document.body.scrollLeft : window.pageXOffset;
}
function getScrollTopOffset() {
  return (document.all) ? document.body.scrollTop : window.pageYOffset;
}

var viewWidth;
var viewHeight;

/* Viewable size-functions */
function determineViewableSize() {
  
  d=document;
  if (typeof window.innerWidth!='undefined') {
  viewWidth = window.innerWidth;
  viewHeight = window.innerHeight;
  } else {
  if (d.documentElement &&
  typeof d.documentElement.clientWidth!='undefined' &&
  d.documentElement.clientWidth!=0) {
  viewWidth = d.documentElement.clientWidth
  viewHeight = d.documentElement.clientHeight
  } else {
  if (d.body &&
  typeof d.body.clientWidth!='undefined') {
  viewWidth = d.body.clientWidth
  viewHeight = d.body.clientHeight
  }
  }
  }
}

function getViewableWidth() {
  if (!viewWidth) determineViewableSize();
  return viewWidth;
}

function getViewableHeight() {
  if (!viewHeight) determineViewableSize();
  return viewHeight;
}

function viewableSize() {
  return "<b>Viewable</b> size: " +
  getViewableWidth() + "x" + getViewableHeight() + ".";
}
