var whi = {
	browser : {
		IE : !!(window.attachEvent && !window.opera),
		IE7 : !!(navigator.userAgent.indexOf("MSIE 7") != -1),
		FF : navigator.userAgent.indexOf("Firefox") != -1,
		Safari : navigator.userAgent.indexOf("Safari") != -1,
		Opera : !!window.opera
	},
	debug : {
		enabled : true,
		started : false,
		error_log : function(str){
			if (!whi.debug.started && document.body){
				whi.debug.started = true;
				var txt = document.createElement("textarea");
				txt.id = "error_log";
				txt.style.width = "500px";
				txt.style.height = "200px";
				txt.style.position = whi.browser.IE ? "absolute" : "fixed";
				txt.style.zIndex = "1000";
				txt.style.left = "10px";
				txt.style.top = "10px";
				document.body.insertBefore(txt, document.body.firstChild);
			}
			try{
				var a;
				if (a = document.getElementById("error_log")){
					if (whi.browser.IE){
						a.innerHTML = a.innerHTML + '<br/>' +str;
						/* var insStr = document.createTextNode("\n"+str);
						if (a.firstChild) a.insertBefore(insStr, a.firstChild);
						else a.appendChild(insStr); */
					}
					else a.value = str+"\n"+a.value;
				}
			}catch(e){}
		}
	},
	DOM : {
		contains : function(elem, targ){
			if (elem == targ) return false;
			try{
				while (targ != document.body && (targ != elem)){
					targ = targ.parentNode;
				}
			}catch(e){}
			return elem == targ;
		}
/* 		init : function(){
			alert(Object.contains);
			if (typeof Object.prototype.contains == "undefined"){
				Object.prototype.contains = function(elem) {
					if (this == elem) return false;
					try{
						while (elem && (elem != this)){
							elem = elem.parentNode;
						}
					}catch(e){}
					return this == elem;
				}
			}
		} */
	},
	string : {
		init : function(){
			if (typeof String.prototype.trim == "undefined"){
				String.prototype.trim = function(chr) {
					if (chr){
						chr = chr.replace(' ','');
						chr = chr.replace(/(.)/g,'\\\$1');
						chr = '['+chr+']';
					}else chr = '\\\s';
					var reg = new RegExp('^'+chr+'+|'+chr+'+$','g');
					return this.replace(reg,'');
				}
			}
			if (typeof String.prototype.ucfirst == "undefined"){
				String.prototype.ucfirst = function(){
					// http://kevin.vanzonneveld.net
					// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
					// *     example 1: ucfirst('kevin van zonneveld');
					// *     returns 1: 'Kevin van zonneveld'
					var f = this.charAt(0).toUpperCase();
					return f + this.substr(1, this.length-1);
				}
			}
		}
	},
	math : {
		init : function(){
			if (typeof Math.sgn == "undefined"){
				Math.sgn = function(nr){
					return nr >= 0 ? 1 : -1;
				}
			}
		}
	},
	functions : {
		init : function(){
			if (typeof Function.prototype.bind == "undefined"){
				Function.prototype.bind = function() {
					var __method = this, object = arguments[0];
					return function() { return __method.apply(object, arguments); }
				}
			}
			if (typeof Function.prototype.bind_prop == "undefined"){
				Function.prototype.bind_prop = function() {
					var __method = this, args = new Array(), object = arguments[0];
					for (var i=1; i<arguments.length; i++) args.push(arguments[i]);
					return function() { return __method.apply(object, args); }
				}
			}
		},
		overload : {
			init : function(){
				this.getContructorName = function(obj){
					if (obj){
						var retVal = obj.constructor.toString().replace(/(?:function)\s+/,'').match(/(?:[a-zA-Z0-9]+)/i);
						if (retVal == null){
							retVal = (typeof obj).toString().ucfirst();
						}
						return retVal;
					}
					return null;
				};
				this.calcOverloadedFunction = function(){
					var this_fnc = arguments.callee;
					var next_fnc = false;
					var cr_args = new Array();
					var retPos = new Array();
					var fncInd = -1;
					var maxArg = 0;
					var argNum = new Array();
					for (var j=0; j<arguments.length; j++){
						cr_args.push(arguments[j]);
					}
					for (var i=0; i<this_fnc.overloadedFunctions.length; i++){
						next_fnc = false;
						var overArg = this_fnc.overloadedFunctions[i].argumentTypes;
						for (var j=0; j<arguments.length; j++){
							if ((typeof overArg[j] != "undefined") && (overArg[j].type != '') && (whi.functions.overload.getContructorName(arguments[j]) != overArg[j].type)){
								next_fnc = true;
								break;
							}
						}
						if (!next_fnc){
							if (overArg.length == arguments.length){
								fncInd = i;
								break;
							}
							if (overArg.length >= maxArg){
								maxArg = overArg.length;
								fncInd = i;
								if (argNum[maxArg]) throw "Ambiguos: Unable to choose wich function to execute";
							}
						}
					}
					if (fncInd >= 0){
						return this_fnc.overloadedFunctions[fncInd].apply(this,cr_args);
					}
					if (this_fnc.overloadedFunctions.length>0){
						var cr_args_types = new Array();
						for (var j=0; j<arguments.length; j++){
							cr_args_types.push(whi.functions.overload.getContructorName(arguments[j]));
						}
						throw "None of the overloaded functions have ["+cr_args_types.join(",")+"] parameters";
					}
				}
				window.oldFunctionConstructor = Function;
				window.Function = function(){
					var multiple_fncs = false;
					var one_fnc = true;
					var args = new Array();
					var overFnc = null;
					var overTmp = null;
					var escReg = new RegExp('"','g');
				
					if (arguments.length){
						if ("Array" == whi.functions.overload.getContructorName(arguments[0])){
							multiple_fncs = true;
							one_fnc = false;
							
							overFnc = whi.functions.overload.calcOverloadedFunction;
							overFnc.overloaded = true;
							overFnc.overloadedFunctions = new Array();
						}
						for (var i=0; i<arguments.length; i++){
					                if (true == multiple_fncs){
								args = new Array();
								overArgs = new Array();
								overTmp = null;
				
								for (var j=0; j<arguments[i].length; j++){
									var arg = "";
									if (j == arguments[i].length-1){
										if ("String" == whi.functions.overload.getContructorName(arguments[i][j])){
											args.push(arguments[i][j]);
										}else if ("Function" == whi.functions.overload.getContructorName(arguments[i][j])){
											//:-?
										}else{
											throw "Incorrect function body";
										}
									}else{
										if ("String" == whi.functions.overload.getContructorName(arguments[i][j])){
											var arg = arguments[i][j].toString().trim().split(' ');
											var arg_type = "", arg_name = "";
											if (arg.length == 2){
												arg_type = arg[0];
												arg_name = arg[1];
											}else{
												arg_name = arg.join(' ');
											}
											args.push(arg_name.replace(/"/,'\\\"'));
											overArgs.push({name : arg_name, type : arg_type});
										}else throw "Function parameter must be String";
									}
								}
				
				                                overTmp = eval('new window.oldFunctionConstructor("'+args.join('", "')+'")');
				                                overTmp.argumentTypes = overArgs;
				                                overFnc.overloadedFunctions.push(overTmp);
				
							}else{
								args.push(arguments[i].toString().replace(escReg,'\\\"'));
							}
						}
					}
					if (true == one_fnc){
						return eval('new window.oldFunctionConstructor("'+args.join('", "')+'")');
					}else{
						return overFnc;
					}
				};
			}
		}
	},
	events : {
		stopEvent : function(e){
			if (!e) var e = window.event;
			e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
		},
		getTargetElement : function(e) {
			if (!e) var e = window.event;
			return (e.relatedTarget) ? e.relatedTarget : (e.toElement || e.fromElement);
;
		},
		getSrcElement : function(e) {
			if (!e) var e = window.event;
			return e.target || e.srcElement;
		},
		iframeOnload : function(ifr, fnc){
			if (whi.browser.IE){
				ifr.onreadystatechange = function(){if (this.readyState == 'interactive') fnc();}
			}else{
				ifr.onload = fnc;
			}
		},
		init : function(){

			// original source from
			// -----------------------------
			// written by Dean Edwards, 2005
			// with input from Tino Zijdel, Matthias Miller, Diego Perini
			// http://dean.edwards.name/weblog/2005/10/add-event/
			
			this.addEvent = function(element, type, handler) {
				if (type == 'resize' && element != window){
					whi.events.addEvent.checkResizeElements.push(element);
					whi.events.addEvent.oldElementDimensions.push([0,0]);//[element.offsetWidth, element.offsetHeight]);
					whi.events.addEvent.oldResizeHandlers.push(handler);
					if (!whi.events.addEvent.resizeInterval){
						whi.events.addEvent.resizeInterval = setInterval(whi.events.addEvent.checkResize,100);
					}
					return;
				}
				if (type === "DOMContentLoaded" || type === "domload") {
					whi.events.addDOMLoadEvent(handler);
					return;
				}

				if (0 && element.addEventListener && type != 'submit') {//nu merge submit :-?
					element.addEventListener(type, handler, false);
				} else {
					// assign each event handler a unique ID
					if (!handler.$$guid) handler.$$guid = whi.events.addEvent.guid++;
					// create a hash table of event types for the element
					if (!element.events) element.events = {};
					// create a hash table of event handlers for each element/event pair
					var handlers = element.events[type];
					if (!handlers) {
						handlers = element.events[type] = {};
						// store the existing event handler (if there is one)
						if (element["on" + type]) {
							handlers[0] = element["on" + type];
						}
					}
					// store the event handler in the hash table
					handlers[handler.$$guid] = handler;
					// assign a global event handler to do all the work
					element["on" + type] = type == 'submit' ?
						whi.events.handleEvent.bind_prop(element, {type:'submit'}) :
						whi.events.handleEvent;
				}
			};
			// a counter used to create unique IDs
			this.addEvent.guid = 1;
			this.addEvent.checkResizeElements = new Array();
			this.addEvent.oldElementDimensions = new Array();
			this.addEvent.oldResizeHandlers = new Array();
			this.addEvent.resizeInterval = 0;
			this.addEvent.checkResize = function(){
				if (whi.events.addEvent.checkResizeElements.length == 0){
					clearInterval(whi.events.addEvent.resizeInterval);
					whi.events.addEvent.resizeInterval = 0;
				}
				for (var i=0; i<whi.events.addEvent.checkResizeElements.length; i++){
					try{
						if (!whi.events.addEvent.checkResizeElements[i]) continue;
						if ((whi.events.addEvent.checkResizeElements[i].offsetWidth != whi.events.addEvent.oldElementDimensions[i][0]) ||
							(whi.events.addEvent.checkResizeElements[i].offsetHeight != whi.events.addEvent.oldElementDimensions[i][1])){
								whi.events.addEvent.oldElementDimensions[i][0] = whi.events.addEvent.checkResizeElements[i].offsetWidth;
								whi.events.addEvent.oldElementDimensions[i][1] = whi.events.addEvent.checkResizeElements[i].offsetHeight;

								whi.events.addEvent.oldResizeHandlers[i].apply(whi.events.addEvent.checkResizeElements[i]);
						}
					}catch(e){
 						delete(whi.events.addEvent.checkResizeElements[i]);
						delete(whi.events.addEvent.oldElementDimensions[i]);
						delete(whi.events.addEvent.oldResizeHandlers[i]);
					}
				}
			};
			this.removeEvent = function(element, type, handler) {
				if (0 && element.removeEventListener) {
					element.removeEventListener(type, handler, false);
				} else {
					// delete the event handler from the hash table
					if (element.events && element.events[type]) {
						delete element.events[type][handler.$$guid];
					}
				}
			};
			this.fireEvent = function(element, type) {
				if (typeof element["on"+type] == "function"){
					element["on"+type]({"type" : type});
				}
			};
			this.handleEvent = function(event) {
				var returnValue = true;
				// grab the event object (IE uses a global event object)
				event = event || whi.events.fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
				// get a reference to the hash table of event handlers
				var handlers = this.events[event.type];
				// execute each event handler

				for (var i in handlers) {
					if (!Object.prototype[i]){
						this.$$handleEvent = handlers[i];
						if (this.$$handleEvent(event) === false) {
							returnValue = false;
						}
					}
				}
				//alert(event.type+' : '+returnValue);
				return returnValue;
			};
			this.fixEvent = function(event) {
				// add W3C standard event methods
				event.preventDefault = whi.events.fixEvent.preventDefault;
				event.stopPropagation = whi.events.fixEvent.stopPropagation;
    				return event;
			};
			this.fixEvent.preventDefault = function() {
				this.returnValue = false;
			};
			this.fixEvent.stopPropagation = function() {
				this.cancelBubble = true;
			};
			//setInterval(this.addEvent.checkResize,100);
			
			
			
			// Tino Zijdel - crisp@xs4all.nl This little snippet fixes the problem that the onload attribute on
			// the body-element will overwrite previous attached events on the window object for the onload event.
			if (!window.addEventListener) {
				document.onreadystatechange = function(){
					if (window.onload && window.onload !== whi.events.handleEvent) {
						whi.events.addEvent(window, 'load', window.onload);
						window.onload = whi.events.handleEvent;
					}
				};
			}
			
			// Here are my functions for adding the DOMContentLoaded event to browsers other
			// than Mozilla.
			
			// Array of DOMContentLoaded event handlers.
			window.onDOMLoadEvents = [];
			window.DOMContentLoadedInitDone = false;

			// Function that adds DOMContentLoaded listeners to the array.
			this.addDOMLoadEvent = function(listener) {
				// If the DOMContentLoaded event has happened, run the function.
				if(window.DOMContentLoadedInitDone){
					listener();
					return;
				}
			
				window.onDOMLoadEvents[window.onDOMLoadEvents.length]=listener;
			}
			
			// Function to process the DOMContentLoaded events array.
			this.DOMContentLoadedInit = function() {
				// quit if this function has already been called
				if (window.DOMContentLoadedInitDone) {
					return;
				}
			
				// flag this function so we don't do the same thing twice
				window.DOMContentLoadedInitDone = true;
			
				// iterates through array of registered functions 
				for (var i=0; i<window.onDOMLoadEvents.length; i++) {
					var func = window.onDOMLoadEvents[i];
					func();
				}
			}
			
			this.DOMContentLoadedScheduler = function() {
				// quit if the init function has already been called
				if (window.DOMContentLoadedInitDone) {
					return true;
				}
				
				// First, check for Safari or KHTML.
				// Second, check for IE.
				//if DOM methods are supported, and the body element exists
				//(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1] 
				//in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)
				if(/KHTML|WebKit/i.test(navigator.userAgent)) {
					if(/loaded|complete/.test(document.readyState)) {
						whi.events.DOMContentLoadedInit();
					} else {
						// Not ready yet, wait a little more.
						setTimeout("whi.events.DOMContentLoadedScheduler()", 250);
					}
				} else if(document.getElementById("__ie_onload")) {
					return true;
				}
			
				// Check for custom developer provided function.
				if(typeof DOMContentLoadedCustom === "function") {
					if(typeof document.getElementsByTagName !== 'undefined' && (document.getElementsByTagName('body')[0] !== null || document.body !== null)) {
						// Call custom function.
						if(DOMContentLoadedCustom()) {
							DOMContentLoadedInit();
						} else {
							// Not ready yet, wait a little more.
							setTimeout("whi.events.DOMContentLoadedScheduler()", 250);
						}
					}
				}
			
				return true;
			}
			
			// If addEventListener supports the DOMContentLoaded event.
			if(document.addEventListener) {
				document.addEventListener("DOMContentLoaded", whi.events.DOMContentLoadedInit, false);
			}
			
			// Schedule to run the init function.
			setTimeout("whi.events.DOMContentLoadedScheduler()", 250);
			
			// Just in case window.onload happens first, add it there too.
			whi.events.addEvent(window, "load", whi.events.DOMContentLoadedInit);
			
			/* for Internet Explorer */
			/*@cc_on
				@if (@_win32 || @_win64)
				document.write("<script id=__ie_onload defer src=\"//:\"><\/script>");
				var script = document.getElementById("__ie_onload");
				script.onreadystatechange = function() {
					if (this.readyState == "complete") {
						whi.events.DOMContentLoadedInit(); // call the onload handler
					}
				};
				@end
			@*/

		}
	},
	getElementLeft : function(pElt){
		var intX = pElt.offsetLeft;
		while ((pElt = pElt.offsetParent) != null){
			intX += pElt.offsetLeft;
		}
		return intX;
	},
	getElementTop : function(pElt){
		var intY = pElt.offsetTop;
		while((pElt = pElt.offsetParent) != null){
			intY += pElt.offsetTop;
		}
		return intY;
	},
	getElementWidth : function(el){
		return el.offsetWidth;
	},
	getElementHeight : function(el){
		return el.offsetHeight;
	},
	getSelectionStart : function(o) {
		if (o.createTextRange) {
			var r = document.selection.createRange().duplicate();
			r.moveEnd('character', o.value.length);
			if (r.text == '') return o.value.length;
			return o.value.lastIndexOf(r.text)
		} else return o.selectionStart;
	},
	getSelectionEnd : function(o) {
		if (o.createTextRange) {
			var r = document.selection.createRange().duplicate();
			r.moveStart('character', -o.value.length);
			return r.text.length;
		} else return o.selectionEnd;
	},
	getStyle : function(oElm, strCssRule){
		var strValue = "";
		if(document.defaultView && document.defaultView.getComputedStyle){
			strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
		}
		else try{
			if(oElm.currentStyle){
				strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
					return p1.toUpperCase();
				});
				strValue = oElm.currentStyle[strCssRule];
			}
		}catch(e){}
		return strValue;
	},
	getPageSize : function(){
		var xScroll, yScroll;
	
		if (window.innerHeight && window.scrollMaxY) {
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
	
		xScr = xScroll;
		yScr = yScroll;
	
	
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
	
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
	
	
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight,xScr,yScr)
		return arrayPageSize;
	},
	getScrollXY : function() {
		var scrOfX = 0, scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
		return [ scrOfX, scrOfY ];
	},
	has_class : function(el,str){
		if ((typeof el == "object") && str && (el != null)){
			var cls = "";
			var t = el.className.split(" ");
			if (t.length){
				for (var i=0; i<t.length; i++){
					if (t[i] == str){
						return true;
					}
				}
			}
		}
		return false;
	},
	add_class : function(el,str){
		if ((typeof el == "object") && str && (el != null)){
			var cls = "";
			var t = el.className.split(" ");
			if (t.length){
				for (var i=0; i<t.length; i++){
					if (t[i] == str){
						delete(t[i]);
					}
				}
			}
			cls = t.join(" ");
			cls+= " "+str;
			el.className = cls;
		}
	},
	remove_class : function(el,str){
		if ((typeof el == "object") && str && (el != null)){
			var cls = "";
			var t = el.className.split(" ");
			if (t.length){
				for (var i=0; i<t.length; i++){
					if (t[i] == str){
						delete(t[i]);
					}
				}
			}
			el.className = t.join(" ");
		}
	},
	getObject : function(obj, def){
		switch (typeof obj){
			case "number" :
			case "undefined" :
			case "null" :		break;
			case "string" : 	if (a = document.getElementById(obj)) return a; break;
			case "object" : 	return obj; break;
		}
		return def;
	},
	createAutoIframe : function(args){
		var non_attrs = ["onload", "autoresize", "container"];
		var non_inline = ["name", "id", "src"];
		var attrs = {};
		var arg_str = '';
		var ifr_src = '';
		var container = typeof args.container == "object" ? args.container : null;
		for (key in args){
			var nxt = false;
			for (var i=0; i<non_attrs.length; i++){
				if (non_attrs[i] == key){
					nxt = true;
				}
			}
			if (!nxt){
				attrs[key] = args[key];
				for (var i=0; i<non_inline.length; i++){
					if (non_inline[i] == key){
						nxt = true;
					}
				}
				if (!nxt){
					arg_str += ' '+key+'="'+escape(args[key])+'"';
				}
			}
		}
		var ifr;
		if (whi.browser.IE){
	        	ifr = document.createElement('<iframe'+arg_str+'></iframe>');
	 	}else{
			ifr = document.createElement("iframe");
		}
		for (key in attrs){
			if (key == "src") ifr_src = attrs[key];
			else if (typeof args[key] != "object" && typeof args[key] != "function"){
				ifr.setAttribute(key,attrs[key]);
			}else{
				try{
					ifr[key] = attrs[key];
				}catch(e){}
			}
		}
		ifr.style.visibility = "hidden";

		ifr.loaded = false;
		ifr.old_src = ifr_src;

		//default extra margins
		if (whi.browser.FF) ifr.style.marginBottom = "-2.5em";
		if (whi.browser.Safari || whi.browser.Opera) ifr.style.marginBottom = "-0.5em";
		whi.events.iframeOnload(ifr, function(force){
			var ifrInd = window.frames.length-1;

	                if (whi.browser.IE){
				if (!force){
					setTimeout(arguments.callee.bind_prop(this, true), 500);
					return;
				}else{
					try{
						if (window.frames[ifrInd].document.body.innerHTML == ''){
							window.frames[ifrInd].location.reload();
						}
					}catch(e){}
				}
			}

			/* whi.debug.error_log(window.frames[ifrInd].document.documentElement.scrollWidth+"_"+
				window.frames[ifrInd].document.body.offsetWidth+"_"+
				window.frames[ifrInd].innerWidth); */

			if (whi.browser.Opera && typeof this.onunload == "function"){
				this.onunload();
			}else{
				if (this.unloaded){
					this.width = "10px";
					this.height = "10px";
				}
			}
			this.unloaded = false;
			this.loaded = true;

                        /* whi.debug.error_log(window.frames[ifrInd].document.documentElement.scrollWidth+"_"+
				window.frames[ifrInd].document.body.offsetWidth+"_"+
				window.frames[ifrInd].innerWidth); */

			var ifrInd = window.frames.length-1;
			var totalWidth = window.frames[ifrInd].document.documentElement.scrollWidth+9;//borders
	                var totalHeight = window.frames[ifrInd].document.documentElement.scrollHeight;


	                var lastResizedHeight = totalHeight;
	                var lastResizedWidth = totalWidth;
			if (whi.browser.FF){
				this.style.visibility = "hidden";
				this.style.visibility = "visible";
			}
                        this.height = totalHeight + 'px';
			this.width = totalWidth + 'px';

	   		this.setAttribute("scrolling","no");
			window.frames[ifrInd].document.body.style.border = "1px solid #FFFFFF";//prevent colapsing borders
			//window.frames[ifrInd].document.body.style.border = "1px solid blue";
			try{
				if(whi.browser.Opera){
					this.onunload = function(){
						this.unloaded = true;
						this.width = "10px";
						this.height = "10px";
					}.bind(this);
				}else{
					if (typeof(window.frames[ifrInd].attachEvent) != 'undefined'){
						//ie
						window.frames[ifrInd].attachEvent('onunload', function(){
							this.unloaded = true;
						}.bind(this));
					}else{
						window.frames[ifrInd].onunload = function(){
							this.unloaded = true;
						}.bind(this);
					}
				}
			}catch(e){alert(e);}
	    		whi.events.addEvent(window.frames[ifrInd].document.body, 'resize', function(){
			    	var doc = window.frames[ifrInd].document;
			    	if (!doc.body || !this.loaded || this.unloaded) return;
	 			if (container && whi.browser.FF){
					container.style.visibility = "visible";
					container.style.visibility = "hidden";
				}
				var totalWidth = doc.documentElement.scrollWidth;
				var totalHeight = doc.documentElement.scrollHeight+4;

	                        if (totalHeight < lastResizedHeight){
	                        	if (totalHeight > doc.body.offsetHeight) totalHeight = doc.body.offsetHeight;
	                        }else if (totalHeight > doc.body.offsetHeight+18) {
					totalHeight = doc.body.offsetHeight;
					if (whi.browser.FF) totalHeight += 20;
				}
				//if (whi.browser.FF) totalHeight += 10;
				//else totalHeight += 5;

				this.height = totalHeight+"px";
				this.width = totalWidth+'px';

				if (totalHeight != lastResizedHeight || lastResizedWidth != totalWidth){
					this.style.visibility = "hidden";
				}
				lastResizedHeight = totalHeight;
				lastResizedWidth = totalWidth;
			}.bind(this));
		}.bind(ifr));
		if (ifr_src) ifr.src = ifr_src;
		return ifr;
	}
}
if (whi.browser.Opera){
	opera.setOverrideHistoryNavigationMode('compatible');
}




whi.string.init();
//whi.DOM.init();
whi.math.init();
whi.functions.init();
whi.events.init();
