/* JTip
 * By Cody Lindley (http://www.codylindley.com)
 * Under an Attribution, Share Alike License
 * JTip is built on top of the very light weight jquery library.
 * josephl@apogeeinvent.com 2007.10.10 - Modified for AI
 * 2007.10.18 - Added Calendar  popup */
function JT_init(){$("a.tip-hover").hover(function(){JT_show(this.href,this.id,this.name)},function(){$('#JT'+this.id).remove()}).click(function(){return false});$("a.tip-click").click(function(){if($("#JT"+this.id).is(':visible')){$('#JT'+this.id).remove()}else{JT_show(this.href,this.id,this.name)}return false});$("a.tip-hover-stick").click(function(){return false}).hover(function(){if($("#JT"+this.id).is(':visible')){$('#JT'+this.id).remove()}else{JT_show(this.href,this.id,this.name)}return false},function(){return true})};function JT_show(a,b,c){if(c==false)c="&nbsp;";var d=document.documentElement;var w=self.innerWidth||(d&&d.clientWidth)||document.body.clientWidth;var e=w-getAbsoluteLeft(b);var f=getAbsoluteTop(b)-3;var g=a.replace(/^[^\?]+\??/,'');var h=parseQuery(g);if(h['width']===undefined){h['width']=250};if(h['link']!==undefined){$('#'+b).bind('click',function(){window.location=h['link']});$('#'+b).css('cursor','pointer')}if(e>((h['width']*1)+75)){$("body").append("<div class='JT' id='JT"+b+"' style='width:"+h['width']*1+"px''><div id='JT_arrow_left'></div><div id='JT_close_left'>"+c+"</div><div><a href='#' onClick='$(\"#JT"+b+"\").remove(); return false;' style=\"display:block; float:right; padding-right:3px;font-size:10px;\"> Close <img style=\"border:none;\" src=\"includes/plugins/tool_tip/images/x_mar_square_10.gif\" /> </a></div><div id='JT_copy"+b+"' class='JT_copy'><div class='JT_loader'><div></div></div>");var i=getElementWidth(b)+11;var j=getAbsoluteLeft(b)+i}else{$("body").append("<div class='JT' id='JT"+b+"' style='width:"+h['width']*1+"px''><div id='JT_arrow_right' style='left:"+((h['width']*1)+1)+"px'></div><div id='JT_close_right'>"+c+"</div><div><a href='#' onClick='$(\"#JT"+b+"\").remove(); return false;' style=\"display:block; float:right; padding-right:3px;font-size:10px;\">Close <img style=\"border:none;\" src=\"includes/plugins/tool_tip/images/x_mar_square_10.gif\" /> </a></div><div class='JT_copy' id='JT_copy"+b+"'><div class='JT_loader'><div></div></div>");var j=getAbsoluteLeft(b)-((h['width']*1)+15)}$('#JT'+b).css({left:j+"px",top:f+"px"});$('#JT'+b).show();$('#JT_copy'+b).load('tool_tip.php?ai_skin=full_page&te_mode=ajax&ajax_cmd=get_tip&tip_id='+b+'&div_id=JT_copy'+b)};function getElementWidth(a){x=document.getElementById(a);return x.offsetWidth};function getAbsoluteLeft(a){o=document.getElementById(a);oLeft=o.offsetLeft;while(o.offsetParent!=null){oParent=o.offsetParent;oLeft+=oParent.offsetLeft;o=oParent}return oLeft};function getAbsoluteTop(a){o=document.getElementById(a);oTop=o.offsetTop;while(o.offsetParent!=null){oParent=o.offsetParent;oTop+=oParent.offsetTop;o=oParent}return oTop};function parseQuery(a){var b=new Object();if(!a)return b;var c=a.split(/[;&]/);for(var i=0;i<c.length;i++){var d=c[i].split('=');if(!d||d.length!=2)continue;var e=unescape(d[0]);var f=unescape(d[1]);f=f.replace(/\+/g,' ');b[e]=f}return b};function blockEvents(a){if(a.target){a.preventDefault()}else{a.returnValue=false}};var open_tip="";function show_calendar(a,b,c){if(open_tip!=""){if($(open_tip).is(":visible")){$(open_tip).remove()}}title="Please Select a Date";var d=document.documentElement;var w=self.innerWidth||(d&&d.clientWidth)||document.body.clientWidth;var e=w-getAbsoluteLeft(b);var f=getAbsoluteTop(b)-3;var g=a.replace(/^[^\?]+\??/,'');var h=parseQuery(g);if(h['width']===undefined){h['width']=280};if(h['link']!==undefined){$('#'+b).css('cursor','pointer')}if(e>((h['width']*1)+75)){$("body").append("<div class='JT' id='JT"+b+"' style='width:"+h['width']*1+"px''><div id='JT_arrow_left'></div><div id='JT_close_left'>"+title+"</div><div><a href='#' onClick='$(\"#JT"+b+"\").remove(); return false;' style=\"display:block; float:right; padding-right:3px;font-size:10px;\"> Close <img style=\"border:none;\" src=\"includes/plugins/tool_tip/images/x_mar_square_10.gif\" /> </a></div><div id='JT_copy"+b+"' class='JT_copy'><div class='JT_loader'><div></div></div>");var i=getElementWidth(b)+11;var j=getAbsoluteLeft(b)+i}else{$("body").append("<div class='JT' id='JT"+b+"' style='width:"+h['width']*1+"px''><div id='JT_arrow_right' style='left:"+((h['width']*1)+1)+"px'></div><div id='JT_close_right'>"+title+"</div><div><a href='#' onClick='$(\"#JT"+b+"\").remove(); return false;' style=\"display:block; float:right; padding-right:3px;font-size:10px;\">Close <img style=\"border:none;\" src=\"includes/plugins/tool_tip/images/x_mar_square_10.gif\" /> </a></div><div class='JT_copy' id='JT_copy"+b+"'><div class='JT_loader'><div></div></div>");var j=getAbsoluteLeft(b)-((h['width']*1)+15)}$('#JT'+b).css({left:j+"px",top:f+"px"});$('#JT'+b).show();var k="";if(($('#'+c+'_datetime_month').val()!="")&&($('#'+c+'_datetime_day').val()!="")&&($('#'+c+'_datetime_year').val()!="")){var l=new Date($('#'+c+'_datetime_month').val()+'/'+$('#'+c+'_datetime_day').val()+'/'+$('#'+c+'_datetime_year').val()+' 01:01:01');k='&selected_date='+l.valueOf()}$('#JT_copy'+b).load('tool_tip.php?ai_skin=full_page&te_mode=ajax&ajax_cmd=calendar&date_id='+c+'&div_id=JT_copy'+b+k);open_tip="#JT"+b;return false};function set_datetime(a,b){var c=new Date(a);var d=c.getMonth();d=d+1;d=d+"";if(d.length==1){d="0"+d}$('#'+b+'_datetime_month').val(d);var e=c.getDate();e=e+"";if(e.length==1){e="0"+e}$('#'+b+'_datetime_day').val(e);$('#'+b+'_datetime_year').val(c.getFullYear());$('#'+b+'_datetime_hour').val('01');$('#'+b+'_datetime_minute').val('01');$('#'+b+'_datetime_second').val('01');$('#'+b).val(c.getFullYear()+'-'+d+'-'+e+' 01:01:01');$(open_tip).remove();return false};
