
/*************************************************************\
 *	DYNIFS - Dynamic IFrame Auto Size v1.0.0
 *
 *	Copyright (C) 2006, Markus (phpMiX)
 *	This script is released under GPL License.
 *	Feel free to use this script (or part of it) wherever you need
 *	it ...but please, give credit to original author. Thank you. :-)
 *	We will also appreciate any links you could give us.
 *	http://www.phpmix.org
 *
 *	Enjoy! ;-)
\*************************************************************/

var DYNIFS = {
	// Storage for known IFrames.
	iframes: {},
	// Here we save any previously installed onresize handler.
	oldresize: null,
	// Flag that tell us if we have already installed our onresize handler.
	ready: false,
	// The document dimensions last time onresize was executed.
	dim: [-1,-1],
	// Timer ID used to defer the actual resize action.
	timerID: 0,
	// Obtain the dimensions (width,height) of the given document.
	getDim: function(d) {
		var w=200, h=200, scr_h, off_h;
		if( d.height ) { return [d.width,d.height]; }
		with( d.body ) {
			if( scrollHeight ) { h=scr_h=scrollHeight; w=scrollWidth; }
			if( offsetHeight ) { h=off_h=offsetHeight; w=offsetWidth; }
			if( scr_h && off_h ) h=Math.max(scr_h, off_h);
		}
		return [w,h];
	},
	// This is our window.onresize handler.
	onresize: function() {
		// Invoke any previously installed onresize handler.
		if( typeof this.oldresize == 'function' ) { this.oldresize(); }
		// Check if the document dimensions really changed.
		var dim = this.getDim(document);
		if( this.dim[0] == dim[0] && this.dim[1] == dim[1] ) return;
		// Defer the resize action to prevent endless loop in quirksmode.
		if( this.timerID ) return;
		this.timerID = setTimeout('DYNIFS.deferred_resize();', 10);
	},
	// This is where the actual IFrame resize is invoked.
	deferred_resize: function() {
		// Walk the list of known IFrames to see if they need to be resized.
		for( var id in this.iframes ) this.resize(id);
		// Store resulting document dimensions.
		this.dim = this.getDim(document);
		// Clear the timer flag.
		this.timerID = 0;
	},
	// This is invoked when the IFrame is loaded or when the main window is resized.
	resize: function(id) {
		// Browser compatibility check.
		if( !window.frames || !window.frames[id] || !document.getElementById || !document.body )
			return;
		// Get references to the IFrame window and layer.
		var iframe = window.frames[id];
		var div = document.getElementById(id);
		if( !div ) return;
		// Save the IFrame id for later use in our onresize handler.
		if( !this.iframes[id] ) {
			this.iframes[id] = true;
		}
		// Should we inject our onresize event handler?
		if( !this.ready ) {
			this.ready = true;
			this.oldresize = window.onresize;
			window.onresize = new Function('DYNIFS.onresize();');
		}
		// This appears to be necessary in MSIE to compute the height
		// when the IFrame'd document is in quirksmode.
		// OTOH, it doesn't seem to break anything in standards mode, so...
		if( document.all ) div.style.height = '0px';
		// Resize the IFrame container.
		var dim = this.getDim(iframe.document);
		div.style.height = (dim[1]+30) + 'px';
	}
}

var mythemejs = {
   // expandit
   expandit : function (id) {
      expandit(id);
      var el = document.getElementById(id);
      if (el.style.display) {
         var date = new Date();
		   date.setTime(date.getTime()+(365*24*60*60*1000));
         this.setCookie(id, 1, date);
      } else {
         this.deleteCookie(id);
      }
   },
   /**
    * Sets a Cookie with the given name and value.
    *
    * name       Name of the cookie
    * value      Value of the cookie
    * [expires]  Expiration date of the cookie (default: end of current session)
    * [path]     Path where the cookie is valid (default: path of calling document)
    * [domain]   Domain where the cookie is valid
    *              (default: domain of calling document)
    * [secure]   Boolean value indicating if the cookie transmission requires a
    *              secure transmission
    */
   setCookie : function(name, value, expires, path, domain, secure) {
       document.cookie= name + "=" + escape(value) +
           ((expires) ? "; expires=" + expires.toGMTString() : "") +
           ((path) ? "; path=" + path : "") +
           ((domain) ? "; domain=" + domain : "") +
           ((secure) ? "; secure" : "");
   },
   /**
    * Gets the value of the specified cookie.
    *
    * name  Name of the desired cookie.
    *
    * Returns a string containing value of specified cookie,
    *   or null if cookie does not exist.
    */
   getCookie : function(name) {
       var dc = document.cookie;
       var prefix = name + "=";
       var begin = dc.indexOf("; " + prefix);
       if (begin == -1) {
           begin = dc.indexOf(prefix);
           if (begin != 0) return null;
       } else {
           begin += 2;
       }
       var end = document.cookie.indexOf(";", begin);
       if (end == -1) {
           end = dc.length;
       }
       return unescape(dc.substring(begin + prefix.length, end));
   },
   /**
    * Deletes the specified cookie.
    *
    * name      name of the cookie
    * [path]    path of the cookie (must be same as path used to create cookie)
    * [domain]  domain of the cookie (must be same as domain used to create cookie)
    */
   deleteCookie : function(name, path, domain) {
       if (this.getCookie(name)) {
           document.cookie = name + "=" +
               ((path) ? "; path=" + path : "") +
               ((domain) ? "; domain=" + domain : "") +
               "; expires=Thu, 01-Jan-70 00:00:01 GMT";
       }
   }
}

function mytheme_expandit(id) {
   mythemejs.expandit(id);
}


var behavior="TD"
var ns6=document.getElementById&&!document.all
var ie=document.all
function changeto(e,color)
{
 source=ie? event.srcElement : e.target
 if(source.tagName=="TABLE")
 return
 while(source.tagName!=behavior && source.tagName!="HTML")
 source=ns6? source.parentNode : source.parentElement
 if(source.style.backgroundColor!=color&&source.id!="ignore")
 source.style.backgroundColor=color
}
function contains_ns6(master, slave)
{
 while (slave.parentNode)
 if ((slave = slave.parentNode) == master)
 return true;
 return false;
}
function changeback(e,originalcolor)
{
 if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
 return
 else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
 return
 if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
 source.style.backgroundColor=originalcolor
}

 var offsetxpoint=-60
 var offsetypoint=20
 var ie=document.all
 var ns6=document.getElementById && !document.all
 var enabletip=false
 if (ie||ns6)
 var tipobj=document.all? document.all["calendar_tooltip"] : document.getElementById? document.getElementById("calendar_tooltip") : ""
 function ietruebody()
  {
   return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  }
 function ddrivetip(thetext, thecolor, thewidth)
  {
  if (ns6||ie)
     {
      if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
      if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
      tipobj.innerHTML=thetext
      enabletip=true
      return false
     }
  }
 function positiontip(e)
  {
   if (enabletip)
      {
       var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
       var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
       var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
       var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
       var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
       if (rightedge<tipobj.offsetWidth)
           ipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
       else if (curX<leftedge)
           tipobj.style.left="5px"
       else
           tipobj.style.left=curX+offsetxpoint+"px"
           if (bottomedge<tipobj.offsetHeight)
              tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
           else
              tipobj.style.top=curY+offsetypoint+"px"
              tipobj.style.visibility="visible"
      }
  }
 function hideddrivetip()
  {
   if (ns6||ie)
      {
       enabletip=false
       tipobj.style.visibility="hidden"
       tipobj.style.left="-1000px"
       tipobj.style.backgroundColor=''
       tipobj.style.width=''
      }
  }
  document.onmousemove=positiontip