﻿		
			var yScroll,popupDiv;
			
			function addLoadEvent(func){
				var oldonload = window.onload;
				if(typeof window.onload != 'function'){
				window.onload = func;
				}else{
				window.onload = function(){
				oldonload();
				func();
				}
				}
			}
			
			function $id(){
				var elements = new Array();
				for (var i = 0; i < arguments.length; i++){
					var element = arguments[i];
					if (typeof element == 'string')
						element = document.getElementById(element);
					if (arguments.length == 1)
						return element;
					elements.push(element);
				} 
					return elements;
			}
			
			function _getbodySize(){
				if (window.innerHeight && window.scrollMaxY) {    
					yScroll = window.innerHeight + window.scrollMaxY;
				} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
					yScroll = document.body.scrollHeight;
				} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
					yScroll = document.body.offsetHeight;
				}
				return yScroll;
			}
			
			function popupTips(obj,shei,bhei,divHei){
				if(!$id(obj)){return false;}
				if (!document.createElement) return false;
					popupDiv = $id(obj);
					popupDiv.className = "popupdiv";
					popupDiv.style.marginLeft = "-" + popupDiv.clientWidth/2 + "px";
					popupBg = document.createElement("div");
					popupBg.setAttribute("id","popupbg");
					
					pHeight = popupDiv.clientHeight;
					if (shei>1){sHeight=shei;}else{sHeight = screen.height;}
					if (bhei>1){bHeight=bhei;}else{bHeight = yScroll;}
					if(pHeight>bHeight){
						popupDiv.style.top =0;
						popupBg.style.height = pHeight+240+"px";
						popupDiv.style.marginTop = "120px";
					}else{
						if(bHeight>sHeight){
							popupBg.style.height = bHeight+"px";
						}else{
							popupBg.style.height = sHeight+"px";
						}
						popupDiv.style.marginTop = "-" + pHeight/2 + "px";
					}
					if (divHei>1){
						popupDiv.style.top= divHei;
					}
				
				
				document.body.appendChild(popupBg);
			
				placeholder = document.createElement("iframe");
				placeholder.setAttribute("id","divshim");
				placeholder.setAttribute("src","");
				placeholder.setAttribute("scrolling","no");
				placeholder.setAttribute("frameborder","0");
				placeholder.setAttribute("allowtransparency","true");
				
				placeholder.className = "popupifra";
				placeholder.style.height = popupBg.style.height;
				placeholder.style.width = popupBg.style.width;
				insertAfter(placeholder,popupBg);
			}
			
			function insertAfter(newElement,targetElement) {
			var parent = targetElement.parentNode;
			if (parent.lastChild == targetElement) {
				parent.appendChild(newElement);
			} else {
				parent.insertBefore(newElement,targetElement.nextSibling);
			}
			}
			
			function closeDiv(obj){
				popupBg.className = "hidden";
				placeholder.className="hidden";
				//popupBg.delete();
				//placeholder.delete();
				$id(obj).className = "hidden";
			}
			
			addLoadEvent(_getbodySize);