// JavaScript Document

function borleiras(theURL) {
	www=screen.width;
	hhh=screen.height;
	np=window.open(theURL,'Miri','width=400,height=280,left='+(www-400)/2+',top='+(hhh-280)/2+',toolbar=0,menubar=0,status=0,resizable=no,resize=0, scrollbars=yes ,scrolling=1 ,margin=0,border=0');
	np.focus();
}



/* SOURCE FILE: AnchorPosition.js */
function getAnchorPosition(anchorname){var useWindow=false;var coordinates=new Object();var x=0,y=0;var use_gebi=false, use_css=false, use_layers=false;if(document.getElementById){use_gebi=true;}else if(document.all){use_css=true;}else if(document.layers){use_layers=true;}if(use_gebi && document.all){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_gebi){var o=document.getElementById(anchorname);x=AnchorPosition_getPageOffsetLeft(o);y=AnchorPosition_getPageOffsetTop(o);}else if(use_css){x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);}else if(use_layers){var found=0;for(var i=0;i<document.anchors.length;i++){if(document.anchors[i].name==anchorname){found=1;break;}}if(found==0){coordinates.x=0;coordinates.y=0;return coordinates;}x=document.anchors[i].x;y=document.anchors[i].y;}else{coordinates.x=0;coordinates.y=0;return coordinates;}coordinates.x=x;coordinates.y=y;return coordinates;}
function getAnchorWindowPosition(anchorname){var coordinates=getAnchorPosition(anchorname);var x=0;var y=0;if(document.getElementById){if(isNaN(window.screenX)){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else{x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}}else if(document.all){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else if(document.layers){x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}coordinates.x=x;coordinates.y=y;return coordinates;}
function AnchorPosition_getPageOffsetLeft(el){var ol=el.offsetLeft;while((el=el.offsetParent) != null){ol += el.offsetLeft;}return ol;}
function AnchorPosition_getWindowOffsetLeft(el){return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;}
function AnchorPosition_getPageOffsetTop(el){var ot=el.offsetTop;while((el=el.offsetParent) != null){ot += el.offsetTop;}return ot;}
function AnchorPosition_getWindowOffsetTop(el){return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;}

/* SOURCE FILE: date.js */
var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
function LZ(x){return(x<0||x>9?"":"0")+x}
function isDate(val,format){var date=getDateFromFormat(val,format);if(date==0){return false;}return true;}
function compareDates(date1,dateformat1,date2,dateformat2){var d1=getDateFromFormat(date1,dateformat1);var d2=getDateFromFormat(date2,dateformat2);if(d1==0 || d2==0){return -1;}else if(d1 > d2){return 1;}return 0;}
function formatDate(date,format){format=format+"";var result="";var i_format=0;var c="";var token="";var y=date.getYear()+"";var M=date.getMonth()+1;var d=date.getDate();var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;var value=new Object();if(y.length < 4){y=""+(y-0+1900);}value["y"]=""+y;value["yyyy"]=y;value["yy"]=y.substring(2,4);value["M"]=M;value["MM"]=LZ(M);value["MMM"]=MONTH_NAMES[M-1];value["NNN"]=MONTH_NAMES[M+11];value["d"]=d;value["dd"]=LZ(d);value["E"]=DAY_NAMES[E+7];value["EE"]=DAY_NAMES[E];value["H"]=H;value["HH"]=LZ(H);if(H==0){value["h"]=12;}else if(H>12){value["h"]=H-12;}else{value["h"]=H;}value["hh"]=LZ(value["h"]);if(H>11){value["K"]=H-12;}else{value["K"]=H;}value["k"]=H+1;value["KK"]=LZ(value["K"]);value["kk"]=LZ(value["k"]);if(H > 11){value["a"]="PM";}else{value["a"]="AM";}value["m"]=m;value["mm"]=LZ(m);value["s"]=s;value["ss"]=LZ(s);while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(value[token] != null){result=result + value[token];}else{result=result + token;}}return result;}
function _isInteger(val){var digits="1234567890";for(var i=0;i < val.length;i++){if(digits.indexOf(val.charAt(i))==-1){return false;}}return true;}
function _getInt(str,i,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var token=str.substring(i,i+x);if(token.length < minlength){return null;}if(_isInteger(token)){return token;}}return null;}
function getDateFromFormat(val,format){val=val+"";format=format+"";var i_val=0;var i_format=0;var c="";var token="";var token2="";var x,y;var now=new Date();var year=now.getYear();var month=now.getMonth()+1;var date=1;var hh=now.getHours();var mm=now.getMinutes();var ss=now.getSeconds();var ampm="";while(i_format < format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c) &&(i_format < format.length)){token += format.charAt(i_format++);}if(token=="yyyy" || token=="yy" || token=="y"){if(token=="yyyy"){x=4;y=4;}if(token=="yy"){x=2;y=2;}if(token=="y"){x=2;y=4;}year=_getInt(val,i_val,x,y);if(year==null){return 0;}i_val += year.length;if(year.length==2){if(year > 70){year=1900+(year-0);}else{year=2000+(year-0);}}}else if(token=="MMM"||token=="NNN"){month=0;for(var i=0;i<MONTH_NAMES.length;i++){var month_name=MONTH_NAMES[i];if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){if(token=="MMM"||(token=="NNN"&&i>11)){month=i+1;if(month>12){month -= 12;}i_val += month_name.length;break;}}}if((month < 1)||(month>12)){return 0;}}else if(token=="EE"||token=="E"){for(var i=0;i<DAY_NAMES.length;i++){var day_name=DAY_NAMES[i];if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){i_val += day_name.length;break;}}}else if(token=="MM"||token=="M"){month=_getInt(val,i_val,token.length,2);if(month==null||(month<1)||(month>12)){return 0;}i_val+=month.length;}else if(token=="dd"||token=="d"){date=_getInt(val,i_val,token.length,2);if(date==null||(date<1)||(date>31)){return 0;}i_val+=date.length;}else if(token=="hh"||token=="h"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>12)){return 0;}i_val+=hh.length;}else if(token=="HH"||token=="H"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>23)){return 0;}i_val+=hh.length;}else if(token=="KK"||token=="K"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<0)||(hh>11)){return 0;}i_val+=hh.length;}else if(token=="kk"||token=="k"){hh=_getInt(val,i_val,token.length,2);if(hh==null||(hh<1)||(hh>24)){return 0;}i_val+=hh.length;hh--;}else if(token=="mm"||token=="m"){mm=_getInt(val,i_val,token.length,2);if(mm==null||(mm<0)||(mm>59)){return 0;}i_val+=mm.length;}else if(token=="ss"||token=="s"){ss=_getInt(val,i_val,token.length,2);if(ss==null||(ss<0)||(ss>59)){return 0;}i_val+=ss.length;}else if(token=="a"){if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}else{return 0;}i_val+=2;}else{if(val.substring(i_val,i_val+token.length)!=token){return 0;}else{i_val+=token.length;}}}if(i_val != val.length){return 0;}if(month==2){if( ((year%4==0)&&(year%100 != 0) ) ||(year%400==0) ){if(date > 29){return 0;}}else{if(date > 28){return 0;}}}if((month==4)||(month==6)||(month==9)||(month==11)){if(date > 30){return 0;}}if(hh<12 && ampm=="PM"){hh=hh-0+12;}else if(hh>11 && ampm=="AM"){hh-=12;}var newdate=new Date(year,month-1,date,hh,mm,ss);return newdate.getTime();}
function parseDate(val){var preferEuro=(arguments.length==2)?arguments[1]:false;generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d');monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d');dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M');var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst');var d=null;for(var i=0;i<checkList.length;i++){var l=window[checkList[i]];for(var j=0;j<l.length;j++){d=getDateFromFormat(val,l[j]);if(d!=0){return new Date(d);}}}return null;}

/* SOURCE FILE: PopupWindow.js */
function PopupWindow_getXYPosition(anchorname){var coordinates;if(this.type == "WINDOW"){coordinates = getAnchorWindowPosition(anchorname);}else{coordinates = getAnchorPosition(anchorname);}this.x = coordinates.x;this.y = coordinates.y;}
function PopupWindow_setSize(width,height){this.width = width;this.height = height;}
function PopupWindow_populate(contents){this.contents = contents;this.populated = false;}
function PopupWindow_setUrl(url){this.url = url;}
function PopupWindow_setWindowProperties(props){this.windowProperties = props;}
function PopupWindow_refresh(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).innerHTML = this.contents;}else if(this.use_css){document.all[this.divName].innerHTML = this.contents;}else if(this.use_layers){var d = document.layers[this.divName];d.document.open();d.document.writeln(this.contents);d.document.close();}}else{if(this.popupWindow != null && !this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url;}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close();}this.popupWindow.focus();}}}
function PopupWindow_showPopup(anchorname){this.getXYPosition(anchorname);this.x += this.offsetX;this.y += this.offsetY;if(!this.populated &&(this.contents != "")){this.populated = true;this.refresh();}if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.left = this.x + "px";document.getElementById(this.divName).style.top = this.y + "px";document.getElementById(this.divName).style.visibility = "visible";}else if(this.use_css){document.all[this.divName].style.left = this.x;document.all[this.divName].style.top = this.y;document.all[this.divName].style.visibility = "visible";}else if(this.use_layers){document.layers[this.divName].left = this.x;document.layers[this.divName].top = this.y;document.layers[this.divName].visibility = "visible";}}else{if(this.popupWindow == null || this.popupWindow.closed){if(this.x<0){this.x=0;}if(this.y<0){this.y=0;}if(screen && screen.availHeight){if((this.y + this.height) > screen.availHeight){this.y = screen.availHeight - this.height;}}if(screen && screen.availWidth){if((this.x + this.width) > screen.availWidth){this.x = screen.availWidth - this.width;}}var avoidAboutBlank = window.opera ||( document.layers && !navigator.mimeTypes['*']) || navigator.vendor == 'KDE' ||( document.childNodes && !document.all && !navigator.taintEnabled);this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}this.refresh();}}
function PopupWindow_hidePopup(){if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.visibility = "hidden";}else if(this.use_css){document.all[this.divName].style.visibility = "hidden";}else if(this.use_layers){document.layers[this.divName].visibility = "hidden";}}else{if(this.popupWindow && !this.popupWindow.closed){this.popupWindow.close();this.popupWindow = null;}}}
function PopupWindow_isClicked(e){if(this.divName != null){if(this.use_layers){var clickX = e.pageX;var clickY = e.pageY;var t = document.layers[this.divName];if((clickX > t.left) &&(clickX < t.left+t.clip.width) &&(clickY > t.top) &&(clickY < t.top+t.clip.height)){return true;}else{return false;}}else if(document.all){var t = window.event.srcElement;while(t.parentElement != null){if(t.id==this.divName){return true;}t = t.parentElement;}return false;}else if(this.use_gebi && e){var t = e.originalTarget;while(t.parentNode != null){if(t.id==this.divName){return true;}t = t.parentNode;}return false;}return false;}return false;}
function PopupWindow_hideIfNotClicked(e){if(this.autoHideEnabled && !this.isClicked(e)){this.hidePopup();}}
function PopupWindow_autoHide(){this.autoHideEnabled = true;}
function PopupWindow_hidePopupWindows(e){for(var i=0;i<popupWindowObjects.length;i++){if(popupWindowObjects[i] != null){var p = popupWindowObjects[i];p.hideIfNotClicked(e);}}}
function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP);}window.popupWindowOldEventListener = document.onmouseup;if(window.popupWindowOldEventListener != null){document.onmouseup = new Function("window.popupWindowOldEventListener();PopupWindow_hidePopupWindows();");}else{document.onmouseup = PopupWindow_hidePopupWindows;}}
function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex = 0;}if(!window.popupWindowObjects){window.popupWindowObjects = new Array();}if(!window.listenerAttached){window.listenerAttached = true;PopupWindow_attachListener();}this.index = popupWindowIndex++;popupWindowObjects[this.index] = this;this.divName = null;this.popupWindow = null;this.width=0;this.height=0;this.populated = false;this.visible = false;this.autoHideEnabled = false;this.contents = "";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName = arguments[0];}else{this.type="WINDOW";}this.use_gebi = false;this.use_css = false;this.use_layers = false;if(document.getElementById){this.use_gebi = true;}else if(document.all){this.use_css = true;}else if(document.layers){this.use_layers = true;}else{this.type = "WINDOW";}this.offsetX = 0;this.offsetY = 0;this.getXYPosition = PopupWindow_getXYPosition;this.populate = PopupWindow_populate;this.setUrl = PopupWindow_setUrl;this.setWindowProperties = PopupWindow_setWindowProperties;this.refresh = PopupWindow_refresh;this.showPopup = PopupWindow_showPopup;this.hidePopup = PopupWindow_hidePopup;this.setSize = PopupWindow_setSize;this.isClicked = PopupWindow_isClicked;this.autoHide = PopupWindow_autoHide;this.hideIfNotClicked = PopupWindow_hideIfNotClicked;}


/* SOURCE FILE: CalendarPopup.js */

function CalendarPopup(){var c;if(arguments.length>0){c = new PopupWindow(arguments[0]);}else{c = new PopupWindow();c.setSize(150,175);}c.offsetX = -152;c.offsetY = 25;c.autoHide();c.monthNames = new Array("Január","Február","Március","Ápril","Május","Június","Július","Augusztus","Szeptember","Octóber","November","December");c.monthAbbreviations = new Array("Jan","Feb","Mar","Apr","Máj","Jún","Júl","Aug","Szep","Okt","Nov","Dec");c.dayHeaders = new Array("V","H","K","Sz","Cs","P","Sz");c.returnFunction = "CP_tmpReturnFunction";c.returnMonthFunction = "CP_tmpReturnMonthFunction";c.returnQuarterFunction = "CP_tmpReturnQuarterFunction";c.returnYearFunction = "CP_tmpReturnYearFunction";c.weekStartDay = 0;c.isShowYearNavigation = false;c.displayType = "date";c.disabledWeekDays = new Object();c.disabledDatesExpression = "";c.yearSelectStartOffset = 2;c.currentDate = null;c.todayText="Mai nap";c.cssPrefix="";c.isShowNavigationDropdowns=false;c.isShowYearNavigationInput=false;window.CP_calendarObject = null;window.CP_targetInput = null;window.CP_dateFormat = "MM/dd/yyyy";c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow;c.setReturnFunction = CP_setReturnFunction;c.setReturnMonthFunction = CP_setReturnMonthFunction;c.setReturnQuarterFunction = CP_setReturnQuarterFunction;c.setReturnYearFunction = CP_setReturnYearFunction;c.setMonthNames = CP_setMonthNames;c.setMonthAbbreviations = CP_setMonthAbbreviations;c.setDayHeaders = CP_setDayHeaders;c.setWeekStartDay = CP_setWeekStartDay;c.setDisplayType = CP_setDisplayType;c.setDisabledWeekDays = CP_setDisabledWeekDays;c.addDisabledDates = CP_addDisabledDates;c.setYearSelectStartOffset = CP_setYearSelectStartOffset;c.setTodayText = CP_setTodayText;c.showYearNavigation = CP_showYearNavigation;c.showCalendar = CP_showCalendar;c.hideCalendar = CP_hideCalendar;c.getStyles = getCalendarStyles;c.refreshCalendar = CP_refreshCalendar;c.getCalendar = CP_getCalendar;c.select = CP_select;c.setCssPrefix = CP_setCssPrefix;c.showNavigationDropdowns = CP_showNavigationDropdowns;c.showYearNavigationInput = CP_showYearNavigationInput;c.copyMonthNamesToWindow();return c;}
function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null){window.MONTH_NAMES = new Array();for(var i=0;i<this.monthNames.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthNames[i];}for(var i=0;i<this.monthAbbreviations.length;i++){window.MONTH_NAMES[window.MONTH_NAMES.length] = this.monthAbbreviations[i];}}}
function CP_tmpReturnFunction(y,m,d){if(window.CP_targetInput!=null){var dt = new Date(y,m-1,d,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow();}window.CP_targetInput.value = formatDate(dt,window.CP_dateFormat);}else{alert('Use setReturnFunction() to define which function will get the clicked results!');}}
function CP_tmpReturnMonthFunction(y,m){alert('Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , month='+m);}
function CP_tmpReturnQuarterFunction(y,q){alert('Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year='+y+' , quarter='+q);}
function CP_tmpReturnYearFunction(y){alert('Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year='+y);}
function CP_setReturnFunction(name){this.returnFunction = name;}
function CP_setReturnMonthFunction(name){this.returnMonthFunction = name;}
function CP_setReturnQuarterFunction(name){this.returnQuarterFunction = name;}
function CP_setReturnYearFunction(name){this.returnYearFunction = name;}
function CP_setMonthNames(){for(var i=0;i<arguments.length;i++){this.monthNames[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setMonthAbbreviations(){for(var i=0;i<arguments.length;i++){this.monthAbbreviations[i] = arguments[i];}this.copyMonthNamesToWindow();}
function CP_setDayHeaders(){for(var i=0;i<arguments.length;i++){this.dayHeaders[i] = arguments[i];}}
function CP_setWeekStartDay(day){this.weekStartDay = day;}
function CP_showYearNavigation(){this.isShowYearNavigation =(arguments.length>0)?arguments[0]:true;}
function CP_setDisplayType(type){if(type!="date"&&type!="week-end"&&type!="month"&&type!="quarter"&&type!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false;}this.displayType=type;}
function CP_setYearSelectStartOffset(num){this.yearSelectStartOffset=num;}
function CP_setDisabledWeekDays(){this.disabledWeekDays = new Object();for(var i=0;i<arguments.length;i++){this.disabledWeekDays[arguments[i]] = true;}}
function CP_addDisabledDates(start, end){if(arguments.length==1){end=start;}if(start==null && end==null){return;}if(this.disabledDatesExpression!=""){this.disabledDatesExpression+= "||";}if(start!=null){start = parseDate(start);start=""+start.getFullYear()+LZ(start.getMonth()+1)+LZ(start.getDate());}if(end!=null){end=parseDate(end);end=""+end.getFullYear()+LZ(end.getMonth()+1)+LZ(end.getDate());}if(start==null){this.disabledDatesExpression+="(ds<="+end+")";}else if(end  ==null){this.disabledDatesExpression+="(ds>="+start+")";}else{this.disabledDatesExpression+="(ds>="+start+"&&ds<="+end+")";}}
function CP_setTodayText(text){this.todayText = text;}
function CP_setCssPrefix(val){this.cssPrefix = val;}
function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns =(arguments.length>0)?arguments[0]:true;}
function CP_showYearNavigationInput(){this.isShowYearNavigationInput =(arguments.length>0)?arguments[0]:true;}
function CP_hideCalendar(){if(arguments.length > 0){window.popupWindowObjects[arguments[0]].hidePopup();}else{this.hidePopup();}}
function CP_refreshCalendar(index){var calObject = window.popupWindowObjects[index];if(arguments.length>1){calObject.populate(calObject.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]));}else{calObject.populate(calObject.getCalendar());}calObject.refresh();}
function CP_showCalendar(anchorname){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date();}else{this.currentDate=new Date(parseDate(arguments[1]));}}this.populate(this.getCalendar());this.showPopup(anchorname);}
function CP_select(inputobj, linkname, format){var selectedDate=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return;}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return;}if(inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return;}if(inputobj.disabled){return;}window.CP_targetInput = inputobj;window.CP_calendarObject = this;this.currentDate=null;var time=0;if(selectedDate!=null){time = getDateFromFormat(selectedDate,format)}else if(inputobj.value!=""){time = getDateFromFormat(inputobj.value,format);}if(selectedDate!=null || inputobj.value!=""){if(time==0){this.currentDate=null;}else{this.currentDate=new Date(time);}}window.CP_dateFormat = format;this.showCalendar(linkname);}
function getCalendarStyles(){var result = "";var p = "";if(this!=null && typeof(this.cssPrefix)!="undefined" && this.cssPrefix!=null && this.cssPrefix!=""){p=this.cssPrefix;}result += "<STYLE>\n";result += "."+p+"cpYearNavigation,."+p+"cpMonthNavigation{background-color:#C0C0C0;text-align:center;vertical-align:center;text-decoration:none;color:#000000;font-weight:bold;}\n";result += "."+p+"cpDayColumnHeader, ."+p+"cpYearNavigation,."+p+"cpMonthNavigation,."+p+"cpCurrentMonthDate,."+p+"cpCurrentMonthDateDisabled,."+p+"cpOtherMonthDate,."+p+"cpOtherMonthDateDisabled,."+p+"cpCurrentDate,."+p+"cpCurrentDateDisabled,."+p+"cpTodayText,."+p+"cpTodayTextDisabled,."+p+"cpText{font-family:arial;font-size:8pt;}\n";result += "TD."+p+"cpDayColumnHeader{text-align:right;border:solid thin #C0C0C0;border-width:0px 0px 1px 0px;}\n";result += "."+p+"cpCurrentMonthDate, ."+p+"cpOtherMonthDate, ."+p+"cpCurrentDate{text-align:right;text-decoration:none;}\n";result += "."+p+"cpCurrentMonthDateDisabled, ."+p+"cpOtherMonthDateDisabled, ."+p+"cpCurrentDateDisabled{color:#D0D0D0;text-align:right;text-decoration:line-through;}\n";result += "."+p+"cpCurrentMonthDate, .cpCurrentDate{color:#000000;}\n";result += "."+p+"cpOtherMonthDate{color:#808080;}\n";result += "TD."+p+"cpCurrentDate{color:white;background-color: #C0C0C0;border-width:1px;border:solid thin #800000;}\n";result += "TD."+p+"cpCurrentDateDisabled{border-width:1px;border:solid thin #FFAAAA;}\n";result += "TD."+p+"cpTodayText, TD."+p+"cpTodayTextDisabled{border:solid thin #C0C0C0;border-width:1px 0px 0px 0px;}\n";result += "A."+p+"cpTodayText, SPAN."+p+"cpTodayTextDisabled{height:20px;}\n";result += "A."+p+"cpTodayText{color:black;}\n";result += "."+p+"cpTodayTextDisabled{color:#D0D0D0;}\n";result += "."+p+"cpBorder{border:solid thin #808080;}\n";result += "</STYLE>\n";return result;}
function CP_getCalendar(){var now = new Date();if(this.type == "WINDOW"){var windowref = "window.opener.";}else{var windowref = "";}var result = "";if(this.type == "WINDOW"){result += "<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";result += '<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n';}else{result += '<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';result += '<TR><TD ALIGN=CENTER>\n';result += '<CENTER>\n';}if(this.displayType=="date" || this.displayType=="week-end"){if(this.currentDate==null){this.currentDate = now;}if(arguments.length > 0){var month = arguments[0];}else{var month = this.currentDate.getMonth()+1;}if(arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]){var year = arguments[1];}else{var year = this.currentDate.getFullYear();}
var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if( ((year%4 == 0)&&(year%100 != 0) ) ||(year%400 == 0) ){daysinmonth[2] = 29;}var current_month = new Date(year,month-1,1);var display_year = year;var display_month = month;var display_date = 1;var weekday= current_month.getDay();var offset = 0;offset =(weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ;if(offset > 0){display_month--;if(display_month < 1){display_month = 12;display_year--;}display_date = daysinmonth[display_month]-offset+1;}var next_month = month+1;var next_month_year = year;if(next_month > 12){next_month=1;next_month_year++;}var last_month = month-1;var last_month_year = year;if(last_month < 1){last_month=12;last_month_year--;}var date_class;if(this.type!="WINDOW"){result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";}result += '<TR>\n';var refresh = windowref+'CP_refreshCalendar';var refreshLink = 'javascript:' + refresh;
if(this.isShowNavigationDropdowns){result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpMonthNavigation" name="cpMonth" onChange="'+refresh+'('+this.index+',this.options[this.selectedIndex].value-0,'+(year-0)+');">';for( var monthCounter=1;monthCounter<=12;monthCounter++){var selected =(monthCounter==month) ? 'SELECTED' : '';result += '<option value="'+monthCounter+'" '+selected+'>'+this.monthNames[monthCounter-1]+'</option>';}result += '</select></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpYearNavigation" name="cpYear" onChange="'+refresh+'('+this.index+','+month+',this.options[this.selectedIndex].value-0);">';for( var yearCounter=year-this.yearSelectStartOffset;yearCounter<=year+this.yearSelectStartOffset;yearCounter++){
var selected =(yearCounter==year) ? 'SELECTED' : '';result += '<option value="'+yearCounter+'" '+selected+'>'+yearCounter+'</option>';}result += '</select></TD>';}else{if(this.isShowYearNavigation){result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;</A></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+'</SPAN></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;</A></TD>';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';
result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year-1)+');">&lt;</A></TD>';if(this.isShowYearNavigationInput){result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onBlur="'+refresh+'('+this.index+','+month+',this.value-0);"></TD>';}else{result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+'</SPAN></TD>';}result += '<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+'('+this.index+','+month+','+(year+1)+');">&gt;</A></TD>';}else{
result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+last_month+','+last_month_year+');">&lt;&lt;</A></TD>\n';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+' '+year+'</SPAN></TD>\n';result += '<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+'('+this.index+','+next_month+','+next_month_year+');">&gt;&gt;</A></TD>\n';}}result += '</TR></TABLE>\n';result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n';result += '<TR>\n';for(var j=0;j<7;j++){result += '<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+'</TD>\n';}result += '</TR>\n';
for(var row=1;row<=6;row++){result += '<TR>\n';for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")");}var dateClass = "";if((display_month == this.currentDate.getMonth()+1) &&(display_date==this.currentDate.getDate()) &&(display_year==this.currentDate.getFullYear())){dateClass = "cpCurrentDate";}else if(display_month == month){dateClass = "cpCurrentMonthDate";}else{dateClass = "cpOtherMonthDate";}if(disabled || this.disabledWeekDays[col-1]){result += '        <TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+'</SPAN></TD>\n';}else{var selected_date = display_date;var selected_month = display_month;var selected_year = display_year;if(this.displayType=="week-end"){var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate() +(7-col));selected_year = d.getYear();
if(selected_year < 1000){selected_year += 1900;}selected_month = d.getMonth()+1;selected_date = d.getDate();}result += '        <TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+'('+selected_year+','+selected_month+','+selected_date+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+'</A></TD>\n';}display_date++;if(display_date > daysinmonth[display_month]){display_date=1;display_month++;}if(display_month > 12){display_month=1;display_year++;}}result += '</TR>';}var current_weekday = now.getDay() - this.weekStartDay;if(current_weekday < 0){current_weekday += 7;}result += '<TR>\n';result += '        <TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")");}
if(disabled || this.disabledWeekDays[current_weekday+1]){result += '                <SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+'</SPAN>\n';}else{result += '                <A CLASS="'+this.cssPrefix+'cpTodayText" HREF="javascript:'+windowref+this.returnFunction+'(\''+now.getFullYear()+'\',\''+(now.getMonth()+1)+'\',\''+now.getDate()+'\');'+windowref+'CP_hideCalendar(\''+this.index+'\');">'+this.todayText+'</A>\n';}result += '                <BR>\n';result += '        </TD></TR></TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year"){if(arguments.length > 0){var year = arguments[0];}else{if(this.displayType=="year"){var year = now.getFullYear()-this.yearSelectStartOffset;}else{var year = now.getFullYear();}}if(this.displayType!="year" && this.isShowYearNavigation){result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result += '<TR>\n';
result += '        <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-1)+');">&lt;&lt;</A></TD>\n';result += '        <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+'</TD>\n';result += '        <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+1)+');">&gt;&gt;</A></TD>\n';result += '</TR></TABLE>\n';}}if(this.displayType=="month"){result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<4;i++){result += '<TR>';for(var j=0;j<3;j++){var monthindex =((i*3)+j);
result += '<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+'('+year+','+(monthindex+1)+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+'</A></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="quarter"){result += '<BR><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<2;i++){result += '<TR>';for(var j=0;j<2;j++){var quarter =((i*2)+j+1);result += '<TD WIDTH=50% ALIGN=CENTER><BR><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+'('+year+','+quarter+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+'</A><BR><BR></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}if(this.displayType=="year"){var yearColumnSize = 4;
result += "<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result += '<TR>\n';result += '        <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';result += '        <TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+'CP_refreshCalendar('+this.index+','+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';result += '</TR></TABLE>\n';result += '<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n';for(var i=0;i<yearColumnSize;i++){for(var j=0;j<2;j++){var currentyear = year+(j*yearColumnSize)+i;
result += '<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+'('+currentyear+');'+windowref+'CP_hideCalendar(\''+this.index+'\');" CLASS="'+date_class+'">'+currentyear+'</A></TD>';}result += '</TR>';}result += '</TABLE></CENTER></TD></TR></TABLE>\n';}
if(this.type == "WINDOW"){result += "</BODY></HTML>\n";}return result;}




function openwin(kn,lapszam,w,h) {
        www=screen.width;
        hhh=screen.height;
        np=window.open('index.phtml?ow_page_number=1981&kepnev='+kn+'&lsz='+lapszam,'ingatlan','width='+w+',height='+h+',left='+(www-w)/2+',top='+(hhh-h)/2+',toolbar=0,menubar=0,status=0,resizable=no,resize=0, scrollbars=no ,scrolling=0 ,margin=0,border=0');
        np.focus();
}

/** $Id: domLib.js 2321 2006-06-12 06:45:41Z dallen $ */
// {{{ license

/*
 * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// }}}
// {{{ intro

/**
 * Title: DOM Library Core
 * Version: 0.70
 *
 * Summary:
 * A set of commonly used functions that make it easier to create javascript
 * applications that rely on the DOM.
 *
 * Updated: 2005/05/17
 *
 * Maintainer: Dan Allen <dan.allen@mojavelinux.com>
 * Maintainer: Jason Rust <jrust@rustyparts.com>
 *
 * License: Apache 2.0
 */

// }}}
// {{{ global constants (DO NOT EDIT)

// -- Browser Detection --
var domLib_userAgent = navigator.userAgent.toLowerCase();
var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
// NOTE: could use window.opera for detecting Opera
var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
// Both konqueror and safari use the khtml rendering engine
var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && (domLib_userAgent.indexOf('msie 5') != -1 || domLib_userAgent.indexOf('msie 6') != -1 || domLib_userAgent.indexOf('msie 7') != -1));
var domLib_isIE5up = domLib_isIE;
var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
// safari and konq may use string "khtml, like gecko", so check for destinctive /
var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
var domLib_isMacIE = (domLib_isIE && domLib_isMac);
var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;

// -- Browser Abilities --
var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
// fixed in Konq3.2
var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);

// -- Event Variables --
var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
var domLib_eventButton = domLib_isIE ? 'button' : 'which';
var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
var domLib_hidePosition = '-1000px';
var domLib_scrollbarWidth = 14;
var domLib_autoId = 1;
var domLib_zIndex = 100;

// -- Detection --
var domLib_collisionElements;
var domLib_collisionsCached = false;

var domLib_timeoutStateId = 0;
var domLib_timeoutStates = new Hash();

// }}}
// {{{ DOM enhancements

if (!document.ELEMENT_NODE)
{
        document.ELEMENT_NODE = 1;
        document.ATTRIBUTE_NODE = 2;
        document.TEXT_NODE = 3;
        document.DOCUMENT_NODE = 9;
        document.DOCUMENT_FRAGMENT_NODE = 11;
}

function domLib_clone(obj)
{
        var copy = {};
        for (var i in obj)
        {
                var value = obj[i];
                try
                {
                        if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
                        {
                                copy[i] = domLib_clone(value);
                        }
                        else
                        {
                                copy[i] = value;
                        }
                }
                catch(e)
                {
                        copy[i] = value;
                }
        }

        return copy;
}

// }}}
// {{{ class Hash()

function Hash()
{
        this.length = 0;
        this.numericLength = 0;
        this.elementData = [];
        for (var i = 0; i < arguments.length; i += 2)
        {
                if (typeof(arguments[i + 1]) != 'undefined')
                {
                        this.elementData[arguments[i]] = arguments[i + 1];
                        this.length++;
                        if (arguments[i] == parseInt(arguments[i]))
                        {
                                this.numericLength++;
                        }
                }
        }
}

// using prototype as opposed to inner functions saves on memory
Hash.prototype.get = function(in_key)
{
        if (typeof(this.elementData[in_key]) != 'undefined') {
                return this.elementData[in_key];
        }

        return null;
}

Hash.prototype.set = function(in_key, in_value)
{
        if (typeof(in_value) != 'undefined')
        {
                if (typeof(this.elementData[in_key]) == 'undefined')
                {
                        this.length++;
                        if (in_key == parseInt(in_key))
                        {
                                this.numericLength++;
                        }
                }

                return this.elementData[in_key] = in_value;
        }

        return false;
}

Hash.prototype.remove = function(in_key)
{
        var tmp_value;
        if (typeof(this.elementData[in_key]) != 'undefined')
        {
                this.length--;
                if (in_key == parseInt(in_key))
                {
                        this.numericLength--;
                }

                tmp_value = this.elementData[in_key];
                delete this.elementData[in_key];
        }

        return tmp_value;
}

Hash.prototype.size = function()
{
        return this.length;
}

Hash.prototype.has = function(in_key)
{
        return typeof(this.elementData[in_key]) != 'undefined';
}

Hash.prototype.find = function(in_obj)
{
        for (var tmp_key in this.elementData)
        {
                if (this.elementData[tmp_key] == in_obj)
                {
                        return tmp_key;
                }
        }

        return null;
}

Hash.prototype.merge = function(in_hash)
{
        for (var tmp_key in in_hash.elementData)
        {
                if (typeof(this.elementData[tmp_key]) == 'undefined')
                {
                        this.length++;
                        if (tmp_key == parseInt(tmp_key))
                        {
                                this.numericLength++;
                        }
                }

                this.elementData[tmp_key] = in_hash.elementData[tmp_key];
        }
}

Hash.prototype.compare = function(in_hash)
{
        if (this.length != in_hash.length)
        {
                return false;
        }

        for (var tmp_key in this.elementData)
        {
                if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
                {
                        return false;
                }
        }

        return true;
}

// }}}
// {{{ domLib_isDescendantOf()

function domLib_isDescendantOf(in_object, in_ancestor, in_bannedTags)
{
        if (in_object == null)
        {
                return false;
        }

        if (in_object == in_ancestor)
        {
                return true;
        }

        if (typeof(in_bannedTags) != 'undefined' &&
                (',' + in_bannedTags.join(',') + ',').indexOf(',' + in_object.tagName + ',') != -1)
        {
                return false;
        }

        while (in_object != document.documentElement)
        {
                try
                {
                        if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
                        {
                                return true;
                        }
                        else if ((tmp_object = in_object.parentNode) == in_ancestor)
                        {
                                return true;
                        }
                        else
                        {
                                in_object = tmp_object;
                        }
                }
                // in case we get some wierd error, assume we left the building
                catch(e)
                {
                        return false;
                }
        }

        return false;
}

// }}}
// {{{ domLib_detectCollisions()

/**
 * For any given target element, determine if elements on the page
 * are colliding with it that do not obey the rules of z-index.
 */
function domLib_detectCollisions(in_object, in_recover, in_useCache)
{
        // the reason for the cache is that if the root menu is built before
        // the page is done loading, then it might not find all the elements.
        // so really the only time you don't use cache is when building the
        // menu as part of the page load
        if (!domLib_collisionsCached)
        {
                var tags = [];

                if (!domLib_canDrawOverFlash)
                {
                        tags[tags.length] = 'object';
                }

                if (!domLib_canDrawOverSelect)
                {
                        tags[tags.length] = 'select';
                }

                domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
                domLib_collisionsCached = in_useCache;
        }

        // if we don't have a tip, then unhide selects
        if (in_recover)
        {
                for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
                {
                        var thisElement = domLib_collisionElements[cnt];

                        if (!thisElement.hideList)
                        {
                                thisElement.hideList = new Hash();
                        }

                        thisElement.hideList.remove(in_object.id);
                        if (!thisElement.hideList.length)
                        {
                                domLib_collisionElements[cnt].style.visibility = 'visible';
                                if (domLib_isKonq)
                                {
                                        domLib_collisionElements[cnt].style.display = '';
                                }
                        }
                }

                return;
        }
        else if (domLib_collisionElements.length == 0)
        {
                return;
        }

        // okay, we have a tip, so hunt and destroy
        var objectOffsets = domLib_getOffsets(in_object);

        for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
        {
                var thisElement = domLib_collisionElements[cnt];

                // if collision element is in active element, move on
                // WARNING: is this too costly?
                if (domLib_isDescendantOf(thisElement, in_object))
                {
                        continue;
                }

                // konqueror only has trouble with multirow selects
                if (domLib_isKonq &&
                        thisElement.tagName == 'SELECT' &&
                        (thisElement.size <= 1 && !thisElement.multiple))
                {
                        continue;
                }

                if (!thisElement.hideList)
                {
                        thisElement.hideList = new Hash();
                }

                var selectOffsets = domLib_getOffsets(thisElement);
                var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
                var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
                // the encompassing circles are overlapping, get in for a closer look
                if (center2centerDistance < radiusSum)
                {
                        // tip is left of select
                        if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
                        // tip is right of select
                                (objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
                        // tip is above select
                                (objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
                        // tip is below select
                                (objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
                        {
                                thisElement.hideList.remove(in_object.id);
                                if (!thisElement.hideList.length)
                                {
                                        thisElement.style.visibility = 'visible';
                                        if (domLib_isKonq)
                                        {
                                                thisElement.style.display = '';
                                        }
                                }
                        }
                        else
                        {
                                thisElement.hideList.set(in_object.id, true);
                                thisElement.style.visibility = 'hidden';
                                if (domLib_isKonq)
                                {
                                        thisElement.style.display = 'none';
                                }
                        }
                }
        }
}

// }}}
// {{{ domLib_getOffsets()

function domLib_getOffsets(in_object, in_preserveScroll)
{
        if (typeof(in_preserveScroll) == 'undefined') {
                in_preserveScroll = false;
        }

        var originalObject = in_object;
        var originalWidth = in_object.offsetWidth;
        var originalHeight = in_object.offsetHeight;
        var offsetLeft = 0;
        var offsetTop = 0;

        while (in_object)
        {
                offsetLeft += in_object.offsetLeft;
                offsetTop += in_object.offsetTop;
                in_object = in_object.offsetParent;
                // consider scroll offset of parent elements
                if (in_object && !in_preserveScroll)
                {
                        offsetLeft -= in_object.scrollLeft;
                        offsetTop -= in_object.scrollTop;
                }
        }

        // MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
        if (domLib_isMacIE) {
                offsetLeft += 10;
                offsetTop += 10;
        }

        return new Hash(
                'left',                offsetLeft,
                'top',                offsetTop,
                'right',        offsetLeft + originalWidth,
                'bottom',        offsetTop + originalHeight,
                'leftCenter',        offsetLeft + originalWidth/2,
                'topCenter',        offsetTop + originalHeight/2,
                'radius',        Math.max(originalWidth, originalHeight)
        );
}

// }}}
// {{{ domLib_setTimeout()

function domLib_setTimeout(in_function, in_timeout, in_args)
{
        if (typeof(in_args) == 'undefined')
        {
                in_args = [];
        }

        if (in_timeout == -1)
        {
                // timeout event is disabled
                return 0;
        }
        else if (in_timeout == 0)
        {
                in_function(in_args);
                return 0;
        }

        // must make a copy of the arguments so that we release the reference
        var args = domLib_clone(in_args);

        if (!domLib_hasBrokenTimeout)
        {
                return setTimeout(function() { in_function(args); }, in_timeout);
        }
        else
        {
                var id = domLib_timeoutStateId++;
                var data = new Hash();
                data.set('function', in_function);
                data.set('args', args);
                domLib_timeoutStates.set(id, data);

                data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
                return id;
        }
}

// }}}
// {{{ domLib_clearTimeout()

function domLib_clearTimeout(in_id)
{
        if (!domLib_hasBrokenTimeout)
        {
                if (in_id > 0) {
                        clearTimeout(in_id);
                }
        }
        else
        {
                if (domLib_timeoutStates.has(in_id))
                {
                        clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
                        domLib_timeoutStates.remove(in_id);
                }
        }
}

// }}}
// {{{ domLib_getEventPosition()

function domLib_getEventPosition(in_eventObj)
{
        var eventPosition = new Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);

        // IE varies depending on standard compliance mode
        if (domLib_isIE)
        {
                var doc = (domLib_standardsMode ? document.documentElement : document.body);
                // NOTE: events may fire before the body has been loaded
                if (doc)
                {
                        eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
                        eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
                        eventPosition.set('scrollX', doc.scrollLeft);
                        eventPosition.set('scrollY', doc.scrollTop);
                }
        }
        else
        {
                eventPosition.set('x', in_eventObj.pageX);
                eventPosition.set('y', in_eventObj.pageY);
                eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
                eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
        }

        return eventPosition;
}

// }}}
// {{{ domLib_cancelBubble()

function domLib_cancelBubble(in_event)
{
        var eventObj = in_event ? in_event : window.event;
        eventObj.cancelBubble = true;
}

// }}}
// {{{ domLib_getIFrameReference()

function domLib_getIFrameReference(in_frame)
{
        if (domLib_isGecko || domLib_isIE)
        {
                return in_frame.frameElement;
        }
        else
        {
                // we could either do it this way or require an id on the frame
                // equivalent to the name
                var name = in_frame.name;
                if (!name || !in_frame.parent)
                {
                        return null;
                }

                var candidates = in_frame.parent.document.getElementsByTagName('iframe');
                for (var i = 0; i < candidates.length; i++)
                {
                        if (candidates[i].name == name)
                        {
                                return candidates[i];
                        }
                }

                return null;
        }
}

// }}}
// {{{ domLib_getElementsByClass()

function domLib_getElementsByClass(in_class)
{
        var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
        var matches = [];
        var cnt = 0;
        for (var i = 0; i < elements.length; i++)
        {
                if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
                {
                        matches[cnt++] = elements[i];
                }
        }

        return matches;
}

// }}}
// {{{ domLib_getElementsByTagNames()

function domLib_getElementsByTagNames(in_list, in_excludeHidden)
{
        var elements = [];
        for (var i = 0; i < in_list.length; i++)
        {
                var matches = document.getElementsByTagName(in_list[i]);
                for (var j = 0; j < matches.length; j++)
                {
                        // skip objects that have nested embeds, or else we get "flashing"
                        if (matches[j].tagName == 'OBJECT' && domLib_isGecko)
                        {
                                var kids = matches[j].childNodes;
                                var skip = false;
                                for (var k = 0; k < kids.length; k++)
                                {
                                        if (kids[k].tagName == 'EMBED')
                                        {
                                                skip = true;
                                                break;
                                        }
                                }
                                if (skip) continue;
                        }

                        if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
                        {
                                continue;
                        }

                        elements[elements.length] = matches[j];
                }
        }

        return elements;
}

// }}}
// {{{ domLib_getComputedStyle()

function domLib_getComputedStyle(in_obj, in_property)
{
        if (domLib_isIE)
        {
                var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
                return eval('in_obj.currentStyle.' + humpBackProp);
        }
        // getComputedStyle() is broken in konqueror, so let's go for the style object
        else if (domLib_isKonq)
        {
                //var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
                return eval('in_obj.style.' + in_property);
        }
        else
        {
                return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
        }
}

// }}}
// {{{ makeTrue()

function makeTrue()
{
        return true;
}

// }}}
// {{{ makeFalse()

function makeFalse()
{
        return false;
}

// }}}















/** $Id: domTT.js 2324 2006-06-12 07:06:39Z dallen $ */
// {{{ license

/*
 * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// }}}
// {{{ intro

/**
 * Title: DOM Tooltip Library
 * Version: 0.7.3
 *
 * Summary:
 * Allows developers to add custom tooltips to the webpages.  Tooltips are
 * generated using the domTT_activate() function and customized by setting
 * a handful of options.
 *
 * Maintainer: Dan Allen <dan.allen@mojavelinux.com>
 * Contributors:
 *                 Josh Gross <josh@jportalhome.com>
 *                Jason Rust <jason@rustyparts.com>
 *
 * License: Apache 2.0
 * However, if you use this library, you earn the position of official bug
 * reporter :) Please post questions or problem reports to the newsgroup:
 *
 *   http://groups-beta.google.com/group/dom-tooltip
 *
 * If you are doing this for commercial work, perhaps you could send me a few
 * Starbucks Coffee gift dollars or PayPal bucks to encourage future
 * developement (NOT REQUIRED).  E-mail me for my snail mail address.

 *
 * Homepage: http://www.mojavelinux.com/projects/domtooltip/
 *
 * Newsgroup: http://groups-beta.google.com/group/dom-tooltip
 *
 * Freshmeat Project: http://freshmeat.net/projects/domtt/?topic_id=92
 *
 * Updated: 2005/07/16
 *
 * Supported Browsers:
 * Mozilla (Gecko), IE 5.5+, IE on Mac, Safari, Konqueror, Opera 7
 *
 * Usage:
 * Please see the HOWTO documentation.
**/

// }}}
// {{{ settings (editable)

// IE mouse events seem to be off by 2 pixels
var domTT_offsetX = (domLib_isIE ? -2 : 0);
var domTT_offsetY = (domLib_isIE ? 4 : 2);
var domTT_direction = 'southeast';
var domTT_mouseHeight = domLib_isIE ? 13 : 19;
var domTT_closeLink = 'X';
var domTT_closeAction = 'hide';
var domTT_activateDelay = 500;
var domTT_maxWidth = false;
var domTT_styleClass = 'domTT';
var domTT_fade = 'neither';
var domTT_lifetime = 0;
var domTT_grid = 0;
var domTT_trailDelay = 200;
var domTT_useGlobalMousePosition = true;
var domTT_postponeActivation = false;
var domTT_tooltipIdPrefix = '[domTT]';
var domTT_screenEdgeDetection = true;
var domTT_screenEdgePadding = 4;
var domTT_oneOnly = false;
var domTT_cloneNodes = false;
var domTT_detectCollisions = true;
var domTT_bannedTags = ['OPTION'];
var domTT_draggable = false;
if (typeof(domTT_dragEnabled) == 'undefined')
{
        domTT_dragEnabled = false;
}

// }}}
// {{{ globals (DO NOT EDIT)

var domTT_predefined = new Hash();
// tooltips are keyed on both the tip id and the owner id,
// since events can originate on either object
var domTT_tooltips = new Hash();
var domTT_lastOpened = 0;
var domTT_documentLoaded = false;
var domTT_mousePosition = null;

// }}}
// {{{ document.onmousemove

if (domLib_useLibrary && domTT_useGlobalMousePosition)
{
        document.onmousemove = function(in_event)
        {
                if (typeof(in_event) == 'undefined') { in_event = window.event; }

                domTT_mousePosition = domLib_getEventPosition(in_event);
                if (domTT_dragEnabled && domTT_dragMouseDown)
                {
                        domTT_dragUpdate(in_event);
                }
        }
}

// }}}
// {{{ domTT_activate()

function domTT_activate(in_this, in_event)
{
        if (!domLib_useLibrary || (domTT_postponeActivation && !domTT_documentLoaded)) { return false; }

        // make sure in_event is set (for IE, some cases we have to use window.event)
        if (typeof(in_event) == 'undefined') { in_event = window.event;        }

        // don't allow tooltips on banned tags (such as OPTION)
        if (in_event != null) {
                var target = in_event.srcElement ? in_event.srcElement : in_event.target;
                if (target != null && (',' + domTT_bannedTags.join(',') + ',').indexOf(',' + target.tagName + ',') != -1)
                {
                        return false;
                }
        }

        var owner = document.body;
        // we have an active event so get the owner
        if (in_event != null && in_event.type.match(/key|mouse|click|contextmenu/i))
        {
                // make sure we have nothing higher than the body element
                if (in_this.nodeType && in_this.nodeType != document.DOCUMENT_NODE)
                {
                        owner = in_this;
                }
        }
        // non active event (make sure we were passed a string id)
        else
        {
                if (typeof(in_this) != 'object' && !(owner = domTT_tooltips.get(in_this)))
                {
                        // NOTE: two steps to avoid "flashing" in gecko
                        var embryo = document.createElement('div');
                        owner = document.body.appendChild(embryo);
                        owner.style.display = 'none';
                        owner.id = in_this;
                }
        }

        // make sure the owner has a unique id
        if (!owner.id)
        {
                owner.id = '__autoId' + domLib_autoId++;
        }

        // see if we should only be opening one tip at a time
        // NOTE: this is not "perfect" yet since it really steps on any other
        // tip working on fade out or delayed close, but it get's the job done
        if (domTT_oneOnly && domTT_lastOpened)
        {
                domTT_deactivate(domTT_lastOpened);
        }

        domTT_lastOpened = owner.id;

        var tooltip = domTT_tooltips.get(owner.id);
        if (tooltip)
        {
                if (tooltip.get('eventType') != in_event.type)
                {
                        if (tooltip.get('type') == 'greasy')
                        {
                                tooltip.set('closeAction', 'destroy');
                                domTT_deactivate(owner.id);
                        }
                        else if (tooltip.get('status') != 'inactive')
                        {
                                return owner.id;
                        }
                }
                else
                {
                        if (tooltip.get('status') == 'inactive')
                        {
                                tooltip.set('status', 'pending');
                                tooltip.set('activateTimeout', domLib_setTimeout(domTT_runShow, tooltip.get('delay'), [owner.id, in_event]));

                                return owner.id;
                        }
                        // either pending or active, let it be
                        else
                        {
                                return owner.id;
                        }
                }
        }

        // setup the default options hash
        var options = new Hash(
                'caption',                '',
                'content',                '',
                'clearMouse',        true,
                'closeAction',        domTT_closeAction,
                'closeLink',        domTT_closeLink,
                'delay',                domTT_activateDelay,
                'direction',        domTT_direction,
                'draggable',        domTT_draggable,
                'fade',                        domTT_fade,
                'fadeMax',                100,
                'grid',                        domTT_grid,
                'id',                        domTT_tooltipIdPrefix + owner.id,
                'inframe',                false,
                'lifetime',                domTT_lifetime,
                'offsetX',                domTT_offsetX,
                'offsetY',                domTT_offsetY,
                'parent',                document.body,
                'position',                'absolute',
                'styleClass',        domTT_styleClass,
                'type',                        'greasy',
                'trail',                false,
                'lazy',                        false
        );

        // load in the options from the function call
        for (var i = 2; i < arguments.length; i += 2)
        {
                // load in predefined
                if (arguments[i] == 'predefined')
                {
                        var predefinedOptions = domTT_predefined.get(arguments[i + 1]);
                        for (var j in predefinedOptions.elementData)
                        {
                                options.set(j, predefinedOptions.get(j));
                        }
                }
                // set option
                else
                {
                        options.set(arguments[i], arguments[i + 1]);
                }
        }

        options.set('eventType', in_event != null ? in_event.type : null);

        // immediately set the status text if provided
        if (options.has('statusText'))
        {
                try { window.status = options.get('statusText'); } catch(e) {}
        }

        // if we didn't give content...assume we just wanted to change the status and return
        if (!options.has('content') || options.get('content') == '' || options.get('content') == null)
        {
                if (typeof(owner.onmouseout) != 'function')
                {
                        owner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
                }

                return owner.id;
        }

        options.set('owner', owner);

        domTT_create(options);

        // determine the show delay
        options.set('delay', (in_event != null && in_event.type.match(/click|mousedown|contextmenu/i)) ? 0 : parseInt(options.get('delay')));
        domTT_tooltips.set(owner.id, options);
        domTT_tooltips.set(options.get('id'), options);
        options.set('status', 'pending');
        options.set('activateTimeout', domLib_setTimeout(domTT_runShow, options.get('delay'), [owner.id, in_event]));

        return owner.id;
}

// }}}
// {{{ domTT_create()

function domTT_create(in_options)
{
        var tipOwner = in_options.get('owner');
        var parentObj = in_options.get('parent');
        var parentDoc = parentObj.ownerDocument || parentObj.document;

        // create the tooltip and hide it
        // NOTE: two steps to avoid "flashing" in gecko
        var embryo = parentDoc.createElement('div');
        var tipObj = parentObj.appendChild(embryo);
        tipObj.style.position = 'absolute';
        tipObj.style.left = '0px';
        tipObj.style.top = '0px';
        tipObj.style.visibility = 'hidden';
        tipObj.id = in_options.get('id');
        tipObj.className = in_options.get('styleClass');

        var contentBlock;
        var tableLayout = false;

        if (in_options.get('caption') || (in_options.get('type') == 'sticky' && in_options.get('caption') !== false))
        {
                tableLayout = true;
                // layout the tip with a hidden formatting table
                var tipLayoutTable = tipObj.appendChild(parentDoc.createElement('table'));
                tipLayoutTable.style.borderCollapse = 'collapse';
                if (domLib_isKHTML)
                {
                        tipLayoutTable.cellSpacing = 0;
                }

                var tipLayoutTbody = tipLayoutTable.appendChild(parentDoc.createElement('tbody'));

                var numCaptionCells = 0;
                var captionRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
                var captionCell = captionRow.appendChild(parentDoc.createElement('td'));
                captionCell.style.padding = '0px';
                var caption = captionCell.appendChild(parentDoc.createElement('div'));
                caption.className = 'caption';
                if (domLib_isIE50)
                {
                        caption.style.height = '100%';
                }

                if (in_options.get('caption').nodeType)
                {
                        caption.appendChild(domTT_cloneNodes ? in_options.get('caption').cloneNode(1) : in_options.get('caption'));
                }
                else
                {
                        caption.innerHTML = in_options.get('caption');
                }

                if (in_options.get('type') == 'sticky')
                {
                        var numCaptionCells = 2;
                        var closeLinkCell = captionRow.appendChild(parentDoc.createElement('td'));
                        closeLinkCell.style.padding = '0px';
                        var closeLink = closeLinkCell.appendChild(parentDoc.createElement('div'));
                        closeLink.className = 'caption';
                        if (domLib_isIE50)
                        {
                                closeLink.style.height = '100%';
                        }

                        closeLink.style.textAlign = 'right';
                        closeLink.style.cursor = domLib_stylePointer;
                        // merge the styles of the two cells
                        closeLink.style.borderLeftWidth = caption.style.borderRightWidth = '0px';
                        closeLink.style.paddingLeft = caption.style.paddingRight = '0px';
                        closeLink.style.marginLeft = caption.style.marginRight = '0px';
                        if (in_options.get('closeLink').nodeType)
                        {
                                closeLink.appendChild(in_options.get('closeLink').cloneNode(1));
                        }
                        else
                        {
                                closeLink.innerHTML = in_options.get('closeLink');
                        }

                        closeLink.onclick = function()
                        {
                                domTT_deactivate(tipOwner.id);
                        };
                        closeLink.onmousedown = function(in_event)
                        {
                                if (typeof(in_event) == 'undefined') { in_event = window.event; }
                                in_event.cancelBubble = true;
                        };
                        // MacIE has to have a newline at the end and must be made with createTextNode()
                        if (domLib_isMacIE)
                        {
                                closeLinkCell.appendChild(parentDoc.createTextNode("\n"));
                        }
                }

                // MacIE has to have a newline at the end and must be made with createTextNode()
                if (domLib_isMacIE)
                {
                        captionCell.appendChild(parentDoc.createTextNode("\n"));
                }

                var contentRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
                var contentCell = contentRow.appendChild(parentDoc.createElement('td'));
                contentCell.style.padding = '0px';
                if (numCaptionCells)
                {
                        if (domLib_isIE || domLib_isOpera)
                        {
                                contentCell.colSpan = numCaptionCells;
                        }
                        else
                        {
                                contentCell.setAttribute('colspan', numCaptionCells);
                        }
                }

                contentBlock = contentCell.appendChild(parentDoc.createElement('div'));
                if (domLib_isIE50)
                {
                        contentBlock.style.height = '100%';
                }
        }
        else
        {
                contentBlock = tipObj.appendChild(parentDoc.createElement('div'));
        }

        contentBlock.className = 'contents';

        var content = in_options.get('content');
        // allow content has a function to return the actual content
        if (typeof(content) == 'function') {
                content = content(in_options.get('id'));
        }

        if (content != null && content.nodeType)
        {
                contentBlock.appendChild(domTT_cloneNodes ? content.cloneNode(1) : content);
        }
        else
        {
                contentBlock.innerHTML = content;
        }

        // adjust the width if specified
        if (in_options.has('width'))
        {
                tipObj.style.width = parseInt(in_options.get('width')) + 'px';
        }

        // check if we are overridding the maxWidth
        // if the browser supports maxWidth, the global setting will be ignored (assume stylesheet)
        var maxWidth = domTT_maxWidth;
        if (in_options.has('maxWidth'))
        {
                if ((maxWidth = in_options.get('maxWidth')) === false)
                {
                        tipObj.style.maxWidth = domLib_styleNoMaxWidth;
                }
                else
                {
                        maxWidth = parseInt(in_options.get('maxWidth'));
                        tipObj.style.maxWidth = maxWidth + 'px';
                }
        }

        // HACK: fix lack of maxWidth in CSS for KHTML and IE
        if (maxWidth !== false && (domLib_isIE || domLib_isKHTML) && tipObj.offsetWidth > maxWidth)
        {
                tipObj.style.width = maxWidth + 'px';
        }

        in_options.set('offsetWidth', tipObj.offsetWidth);
        in_options.set('offsetHeight', tipObj.offsetHeight);

        // konqueror miscalcuates the width of the containing div when using the layout table based on the
        // border size of the containing div
        if (domLib_isKonq && tableLayout && !tipObj.style.width)
        {
                var left = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-left-width');
                var right = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-right-width');

                left = left.substring(left.indexOf(':') + 2, left.indexOf(';'));
                right = right.substring(right.indexOf(':') + 2, right.indexOf(';'));
                var correction = 2 * ((left ? parseInt(left) : 0) + (right ? parseInt(right) : 0));
                tipObj.style.width = (tipObj.offsetWidth - correction) + 'px';
        }

        // if a width is not set on an absolutely positioned object, both IE and Opera
        // will attempt to wrap when it spills outside of body...we cannot have that
        if (domLib_isIE || domLib_isOpera)
        {
                if (!tipObj.style.width)
                {
                        // HACK: the correction here is for a border
                        tipObj.style.width = (tipObj.offsetWidth - 2) + 'px';
                }

                // HACK: the correction here is for a border
                tipObj.style.height = (tipObj.offsetHeight - 2) + 'px';
        }

        // store placement offsets from event position
        var offsetX, offsetY;

        // tooltip floats
        if (in_options.get('position') == 'absolute' && !(in_options.has('x') && in_options.has('y')))
        {
                // determine the offset relative to the pointer
                switch (in_options.get('direction'))
                {
                        case 'northeast':
                                offsetX = in_options.get('offsetX');
                                offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
                        break;
                        case 'northwest':
                                offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
                                offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
                        break;
                        case 'north':
                                offsetX = 0 - parseInt(tipObj.offsetWidth/2);
                                offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
                        break;
                        case 'southwest':
                                offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
                                offsetY = in_options.get('offsetY');
                        break;
                        case 'southeast':
                                offsetX = in_options.get('offsetX');
                                offsetY = in_options.get('offsetY');
                        break;
                        case 'south':
                                offsetX = 0 - parseInt(tipObj.offsetWidth/2);
                                offsetY = in_options.get('offsetY');
                        break;
                }

                // if we are in an iframe, get the offsets of the iframe in the parent document
                if (in_options.get('inframe'))
                {
                        var iframeObj = domLib_getIFrameReference(window);
                        if (iframeObj)
                        {
                                var frameOffsets = domLib_getOffsets(iframeObj);
                                offsetX += frameOffsets.get('left');
                                offsetY += frameOffsets.get('top');
                        }
                }
        }
        // tooltip is fixed
        else
        {
                offsetX = 0;
                offsetY = 0;
                in_options.set('trail', false);
        }

        // set the direction-specific offsetX/Y
        in_options.set('offsetX', offsetX);
        in_options.set('offsetY', offsetY);
        if (in_options.get('clearMouse') && in_options.get('direction').indexOf('south') != -1)
        {
                in_options.set('mouseOffset', domTT_mouseHeight);
        }
        else
        {
                in_options.set('mouseOffset', 0);
        }

        if (domLib_canFade && typeof(Fadomatic) == 'function')
        {
                if (in_options.get('fade') != 'neither')
                {
                        var fadeHandler = new Fadomatic(tipObj, 10, 0, 0, in_options.get('fadeMax'));
                        in_options.set('fadeHandler', fadeHandler);
                }
        }
        else
        {
                in_options.set('fade', 'neither');
        }

        // setup mouse events
        if (in_options.get('trail') && typeof(tipOwner.onmousemove) != 'function')
        {
                tipOwner.onmousemove = function(in_event) { domTT_mousemove(this, in_event); };
        }

        if (typeof(tipOwner.onmouseout) != 'function')
        {
                tipOwner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
        }

        if (in_options.get('type') == 'sticky')
        {
                if (in_options.get('position') == 'absolute' && domTT_dragEnabled && in_options.get('draggable'))
                {
                        if (domLib_isIE)
                        {
                                captionRow.onselectstart = function() { return false; };
                        }

                        // setup drag
                        captionRow.onmousedown = function(in_event) { domTT_dragStart(tipObj, in_event);  };
                        captionRow.onmousemove = function(in_event) { domTT_dragUpdate(in_event); };
                        captionRow.onmouseup = function() { domTT_dragStop(); };
                }
        }
        else if (in_options.get('type') == 'velcro')
        {
                /* can use once we have deactivateDelay
                tipObj.onmouseover = function(in_event)
                {
                        if (typeof(in_event) == 'undefined') { in_event = window.event; }
                        var tooltip = domTT_tooltips.get(tipObj.id);
                        if (in_options.get('lifetime')) {
                                domLib_clearTimeout(in_options.get('lifetimeTimeout');
                        }
                };
                */
                tipObj.onmouseout = function(in_event)
                {
                        if (typeof(in_event) == 'undefined') { in_event = window.event; }
                        if (!domLib_isDescendantOf(in_event[domLib_eventTo], tipObj, domTT_bannedTags)) {
                                domTT_deactivate(tipOwner.id);
                        }
                };
                // NOTE: this might interfere with links in the tip
                tipObj.onclick = function(in_event)
                {
                        domTT_deactivate(tipOwner.id);
                };
        }

        if (in_options.get('position') == 'relative')
        {
                tipObj.style.position = 'relative';
        }

        in_options.set('node', tipObj);
        in_options.set('status', 'inactive');
}

// }}}
// {{{ domTT_show()

// in_id is either tip id or the owner id
function domTT_show(in_id, in_event)
{

        // should always find one since this call would be cancelled if tip was killed
        var tooltip = domTT_tooltips.get(in_id);
        var status = tooltip.get('status');
        var tipObj = tooltip.get('node');

        if (tooltip.get('position') == 'absolute')
        {
                var mouseX, mouseY;

                if (tooltip.has('x') && tooltip.has('y'))
                {
                        mouseX = tooltip.get('x');
                        mouseY = tooltip.get('y');
                }
                else if (!domTT_useGlobalMousePosition || domTT_mousePosition == null || status == 'active' || tooltip.get('delay') == 0)
                {
                        var eventPosition = domLib_getEventPosition(in_event);
                        var eventX = eventPosition.get('x');
                        var eventY = eventPosition.get('y');
                        if (tooltip.get('inframe'))
                        {
                                eventX -= eventPosition.get('scrollX');
                                eventY -= eventPosition.get('scrollY');
                        }

                        // only move tip along requested trail axis when updating position
                        if (status == 'active' && tooltip.get('trail') !== true)
                        {
                                var trail = tooltip.get('trail');
                                if (trail == 'x')
                                {
                                        mouseX = eventX;
                                        mouseY = tooltip.get('mouseY');
                                }
                                else if (trail == 'y')
                                {
                                        mouseX = tooltip.get('mouseX');
                                        mouseY = eventY;
                                }
                        }
                        else
                        {
                                mouseX = eventX;
                                mouseY = eventY;
                        }
                }
                else
                {
                        mouseX = domTT_mousePosition.get('x');
                        mouseY = domTT_mousePosition.get('y');
                        if (tooltip.get('inframe'))
                        {
                                mouseX -= domTT_mousePosition.get('scrollX');
                                mouseY -= domTT_mousePosition.get('scrollY');
                        }
                }

                // we are using a grid for updates
                if (tooltip.get('grid'))
                {
                        // if this is not a mousemove event or it is a mousemove event on an active tip and
                        // the movement is bigger than the grid
                        if (in_event.type != 'mousemove' || (status == 'active' && (Math.abs(tooltip.get('lastX') - mouseX) > tooltip.get('grid') || Math.abs(tooltip.get('lastY') - mouseY) > tooltip.get('grid'))))
                        {
                                tooltip.set('lastX', mouseX);
                                tooltip.set('lastY', mouseY);
                        }
                        // did not satisfy the grid movement requirement
                        else
                        {
                                return false;
                        }
                }

                // mouseX and mouseY store the last acknowleged mouse position,
                // good for trailing on one axis
                tooltip.set('mouseX', mouseX);
                tooltip.set('mouseY', mouseY);

                var coordinates;
                if (domTT_screenEdgeDetection)
                {
                        coordinates = domTT_correctEdgeBleed(
                                tooltip.get('offsetWidth'),
                                tooltip.get('offsetHeight'),
                                mouseX,
                                mouseY,
                                tooltip.get('offsetX'),
                                tooltip.get('offsetY'),
                                tooltip.get('mouseOffset'),
                                tooltip.get('inframe') ? window.parent : window
                        );
                }
                else
                {
                        coordinates = {
                                'x' : mouseX + tooltip.get('offsetX'),
                                'y' : mouseY + tooltip.get('offsetY') + tooltip.get('mouseOffset')
                        };
                }

                // update the position
                tipObj.style.left = coordinates.x + 'px';
                tipObj.style.top = coordinates.y + 'px';

                // increase the tip zIndex so it goes over previously shown tips
                tipObj.style.zIndex = domLib_zIndex++;
        }

        // if tip is not active, active it now and check for a fade in
        if (status == 'pending')
        {
                // unhide the tooltip
                tooltip.set('status', 'active');
                tipObj.style.display = '';
                tipObj.style.visibility = 'visible';

                var fade = tooltip.get('fade');
                if (fade != 'neither')
                {
                        var fadeHandler = tooltip.get('fadeHandler');
                        if (fade == 'out' || fade == 'both')
                        {
                                fadeHandler.haltFade();
                                if (fade == 'out')
                                {
                                        fadeHandler.halt();
                                }
                        }

                        if (fade == 'in' || fade == 'both')
                        {
                                fadeHandler.fadeIn();
                        }
                }

                if (tooltip.get('type') == 'greasy' && tooltip.get('lifetime') != 0)
                {
                        tooltip.set('lifetimeTimeout', domLib_setTimeout(domTT_runDeactivate, tooltip.get('lifetime'), [tipObj.id]));
                }
        }

        if (tooltip.get('position') == 'absolute' && domTT_detectCollisions)
        {
                // utilize original collision element cache
                domLib_detectCollisions(tipObj, false, true);
        }
}

// }}}
// {{{ domTT_close()

// in_handle can either be an child object of the tip, the tip id or the owner id
function domTT_close(in_handle)
{
        var id;
        if (typeof(in_handle) == 'object' && in_handle.nodeType)
        {
                var obj = in_handle;
                while (!obj.id || !domTT_tooltips.get(obj.id))
                {
                        obj = obj.parentNode;

                        if (obj.nodeType != document.ELEMENT_NODE) { return; }
                }

                id = obj.id;
        }
        else
        {
                id = in_handle;
        }

        domTT_deactivate(id);
}

// }}}
// {{{ domTT_closeAll()

// run through the tooltips and close them all
function domTT_closeAll()
{
        // NOTE: this will iterate 2x # of tooltips
        for (var id in domTT_tooltips.elementData) {
                domTT_close(id);
        }
}

// }}}
// {{{ domTT_deactivate()

// in_id is either the tip id or the owner id
function domTT_deactivate(in_id)
{
        var tooltip = domTT_tooltips.get(in_id);
        if (tooltip)
        {
                var status = tooltip.get('status');
                if (status == 'pending')
                {
                        // cancel the creation of this tip if it is still pending
                        domLib_clearTimeout(tooltip.get('activateTimeout'));
                        tooltip.set('status', 'inactive');
                }
                else if (status == 'active')
                {
                        if (tooltip.get('lifetime'))
                        {
                                domLib_clearTimeout(tooltip.get('lifetimeTimeout'));
                        }

                        var tipObj = tooltip.get('node');
                        if (tooltip.get('closeAction') == 'hide')
                        {
                                var fade = tooltip.get('fade');
                                if (fade != 'neither')
                                {
                                        var fadeHandler = tooltip.get('fadeHandler');
                                        if (fade == 'out' || fade == 'both')
                                        {
                                                fadeHandler.fadeOut();
                                        }
                                        else
                                        {
                                                fadeHandler.hide();
                                        }
                                }
                                else
                                {
                                        tipObj.style.display = 'none';
                                }
                        }
                        else
                        {
                                tooltip.get('parent').removeChild(tipObj);
                                domTT_tooltips.remove(tooltip.get('owner').id);
                                domTT_tooltips.remove(tooltip.get('id'));
                        }

                        tooltip.set('status', 'inactive');
                        if (domTT_detectCollisions) {
                                // unhide all of the selects that are owned by this object
                                // utilize original collision element cache
                                domLib_detectCollisions(tipObj, true, true);
                        }
                }
        }
}

// }}}
// {{{ domTT_mouseout()

function domTT_mouseout(in_owner, in_event)
{
        if (!domLib_useLibrary) { return false; }

        if (typeof(in_event) == 'undefined') { in_event = window.event;        }

        var toChild = domLib_isDescendantOf(in_event[domLib_eventTo], in_owner, domTT_bannedTags);
        var tooltip = domTT_tooltips.get(in_owner.id);
        if (tooltip && (tooltip.get('type') == 'greasy' || tooltip.get('status') != 'active'))
        {
                // deactivate tip if exists and we moved away from the owner
                if (!toChild)
                {
                        domTT_deactivate(in_owner.id);
                        try { window.status = window.defaultStatus; } catch(e) {}
                }
        }
        else if (!toChild)
        {
                try { window.status = window.defaultStatus; } catch(e) {}
        }
}

// }}}
// {{{ domTT_mousemove()

function domTT_mousemove(in_owner, in_event)
{
        if (!domLib_useLibrary) { return false; }

        if (typeof(in_event) == 'undefined') { in_event = window.event;        }

        var tooltip = domTT_tooltips.get(in_owner.id);
        if (tooltip && tooltip.get('trail') && tooltip.get('status') == 'active')
        {
                // see if we are trailing lazy
                if (tooltip.get('lazy'))
                {
                        domLib_setTimeout(domTT_runShow, domTT_trailDelay, [in_owner.id, in_event]);
                }
                else
                {
                        domTT_show(in_owner.id, in_event);
                }
        }
}

// }}}
// {{{ domTT_addPredefined()

function domTT_addPredefined(in_id)
{
        var options = new Hash();
        for (var i = 1; i < arguments.length; i += 2)
        {
                options.set(arguments[i], arguments[i + 1]);
        }

        domTT_predefined.set(in_id, options);
}

// }}}
// {{{ domTT_correctEdgeBleed()

function domTT_correctEdgeBleed(in_width, in_height, in_x, in_y, in_offsetX, in_offsetY, in_mouseOffset, in_window)
{
        var win, doc;
        var bleedRight, bleedBottom;
        var pageHeight, pageWidth, pageYOffset, pageXOffset;

        var x = in_x + in_offsetX;
        var y = in_y + in_offsetY + in_mouseOffset;

        win = (typeof(in_window) == 'undefined' ? window : in_window);

        // Gecko and IE swaps values of clientHeight, clientWidth properties when
        // in standards compliance mode from documentElement to document.body
        doc = ((domLib_standardsMode && (domLib_isIE || domLib_isGecko)) ? win.document.documentElement : win.document.body);

        // for IE in compliance mode
        if (domLib_isIE)
        {
                pageHeight = doc.clientHeight;
                pageWidth = doc.clientWidth;
                pageYOffset = doc.scrollTop;
                pageXOffset = doc.scrollLeft;
        }
        else
        {
                pageHeight = doc.clientHeight;
                pageWidth = doc.clientWidth;

                if (domLib_isKHTML)
                {
                        pageHeight = win.innerHeight;
                }

                pageYOffset = win.pageYOffset;
                pageXOffset = win.pageXOffset;
        }

        // we are bleeding off the right, move tip over to stay on page
        // logic: take x position, add width and subtract from effective page width
        if ((bleedRight = (x - pageXOffset) + in_width - (pageWidth - domTT_screenEdgePadding)) > 0)
        {
                x -= bleedRight;
        }

        // we are bleeding to the left, move tip over to stay on page
        // if tip doesn't fit, we will go back to bleeding off the right
        // logic: take x position and check if less than edge padding
        if ((x - pageXOffset) < domTT_screenEdgePadding)
        {
                x = domTT_screenEdgePadding + pageXOffset;
        }

        // if we are bleeding off the bottom, flip to north
        // logic: take y position, add height and subtract from effective page height
        if ((bleedBottom = (y - pageYOffset) + in_height - (pageHeight - domTT_screenEdgePadding)) > 0)
        {
                y = in_y - in_height - in_offsetY;
        }

        // if we are bleeding off the top, flip to south
        // if tip doesn't fit, we will go back to bleeding off the bottom
        // logic: take y position and check if less than edge padding
        if ((y - pageYOffset) < domTT_screenEdgePadding)
        {
                y = in_y + domTT_mouseHeight + in_offsetY;
        }

        return {'x' : x, 'y' : y};
}

// }}}
// {{{ domTT_isActive()

// in_id is either the tip id or the owner id
function domTT_isActive(in_id)
{
        var tooltip = domTT_tooltips.get(in_id);
        if (!tooltip || tooltip.get('status') != 'active')
        {
                return false;
        }
        else
        {
                return true;
        }
}

// }}}
// {{{ domTT_runXXX()

// All of these domMenu_runXXX() methods are used by the event handling sections to
// avoid the circular memory leaks caused by inner functions
function domTT_runDeactivate(args) { domTT_deactivate(args[0]); }
function domTT_runShow(args) { domTT_show(args[0], args[1]); }

// }}}
// {{{ domTT_replaceTitles()

function domTT_replaceTitles(in_decorator)
{
        var elements = domLib_getElementsByClass('tooltip');
        for (var i = 0; i < elements.length; i++)
        {
                if (elements[i].title)
                {
                        var content;
                        if (typeof(in_decorator) == 'function')
                        {
                                content = in_decorator(elements[i]);
                        }
                        else
                        {
                                content = elements[i].title;
                        }

                        content = content.replace(new RegExp('\'', 'g'), '\\\'');
                        elements[i].onmouseover = new Function('in_event', "domTT_activate(this, in_event, 'content', '" + content + "')");
                        elements[i].title = '';
                }
        }
}

// }}}
// {{{ domTT_update()

// Allow authors to update the contents of existing tips using the DOM
// Unfortunately, the tip must already exist, or else no work is done.
// TODO: make getting at content or caption cleaner
function domTT_update(handle, content, type)
{
        // type defaults to 'content', can also be 'caption'
        if (typeof(type) == 'undefined')
        {
                type = 'content';
        }

        var tip = domTT_tooltips.get(handle);
        if (!tip)
        {
                return;
        }

        var tipObj = tip.get('node');
        var updateNode;
        if (type == 'content')
        {
                // <div class="contents">...
                updateNode = tipObj.firstChild;
                if (updateNode.className != 'contents')
                {
                        // <table><tbody><tr>...</tr><tr><td><div class="contents">...
                        updateNode = updateNode.firstChild.firstChild.nextSibling.firstChild.firstChild;
                }
        }
        else
        {
                updateNode = tipObj.firstChild;
                if (updateNode.className == 'contents')
                {
                        // missing caption
                        return;
                }

                // <table><tbody><tr><td><div class="caption">...
                updateNode = updateNode.firstChild.firstChild.firstChild.firstChild;
        }

        // TODO: allow for a DOM node as content
        updateNode.innerHTML = content;
}

// }}}


        var domTT_styleClass = 'domTTOverlib';


