//------------------------------------------------------------------------------- // Copyright (C) Ektron Inc. All rights reserved. //------------------------------------------------------------------------------- // ajax.js // Ektron Ajax Framework. // Resource for Search, Poll, Listsummary, Collection, Metadatalist and Taxonomy. function __LoadTaxonomyShowAll(v){ var location=document.location.href; location=location.replace(/&__taxonomyshowall=[0-9]/ig,''); if(location.indexOf("?")==-1) location=location+"?"; if(v.checked) document.location.href=location+"&__taxonomyshowall=1"; else document.location.href=location+"&__taxonomyshowall=0"; } var EBubble=new function(){ this.bubblewidth="0"; this.CurrentStyle=function(element,styleprop){ var x;var y; try{ x = document.getElementById(element); if (x.currentStyle) y = x.currentStyle[styleprop]; else if (window.getComputedStyle) y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleprop); } catch(e){ y='0'; } return y; }; this.CreateBubble=function(){ try{ if(document.getElementById('FloatBubble')==null){ var divElt = document.createElement('div'); divElt.setAttribute("id", "FloatBubble"); document.getElementsByTagName("body")[0].appendChild(divElt); var e=document.getElementById('FloatBubble'); var s=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+='
 
'; e.innerHTML=s; } if(document.getElementById('FloatBubbleT')==null){ var divElt = document.createElement('div'); divElt.setAttribute("id", "FloatBubbleT"); document.getElementsByTagName("body")[0].appendChild(divElt); var e=document.getElementById('FloatBubbleT'); var s=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+=''; s+='
 
'; e.innerHTML=s; } } catch(e) { } }; this.ShowHoverOverBubble=function(flag,text,widthheight,X,Y,SX,SY){ var width='';var height='';var suffix='';var wtop=0; if(widthheight!='0'){var str=widthheight.split(",");width=str[0];height=str[1]}; if(height!='' && parseInt(SY)-parseInt(height)>=180) suffix='T'; var element =document.getElementById("FloatBubble"+suffix); document.getElementById("FloatBubble").style.display = "none"; document.getElementById("FloatBubbleT").style.display = "none"; if(ECommon.Ie()){wtop=parseInt(document.documentElement.scrollTop);}else{wtop=0;} if(flag==1){ if(EBubble.bubblewidth=="0"){EBubble.bubblewidth=EBubble.CurrentStyle("EkBubbleTable"+suffix,"width").replace(/\px/g,'');} document.getElementById("EkBubbleData"+suffix).innerHTML=text; if(!(parseInt(width)>40)){ width=parseInt(EBubble.bubblewidth); } document.getElementById("EkBubbleTable"+suffix).style.width=width+"px"; document.getElementById("EkBubbleData"+suffix).style.width=(parseInt(width)-40)+"px"; if(height!=undefined && height!='' && parseInt(height)>100){document.getElementById("EkBubbleData"+suffix).style.maxHeight=height+"px";} else{document.getElementById("EkBubbleData"+suffix).style.height="auto";} element.style.display = "block"; if(height!='' && parseInt(SY)-parseInt(height)>=180){ element.style.top = wtop+parseInt(Y)-(parseInt(height)+120) + 'px'; document.getElementById("EkBubbleData"+suffix).style.height=height+"px"; } else{ element.style.top = parseInt(parseInt(Y) +wtop)+ "px"; } element.style.left = parseInt(X)-50+ "px"; } }; this.EventX=function(event){ var xVal;if (ECommon.Ie()){xVal = event.x;}else{ xVal = event.pageX;} return(xVal+'&SX='+event.screenX) }; this.EventY=function(event){ var yVal;if (ECommon.Ie()){yVal = event.y;}else{yVal = event.pageY;} return(yVal+'&SY='+event.screenY) }; }; var ECommon=new function(){ this.Decode=function(str){ var ret=str; ret = ret.replace(/\</g,'<'); ret = ret.replace(/\>/g,'>'); ret = ret.replace(/\"/g,'"'); ret = ret.replace(/\'/g,'\''); return ret; }; this.Ie=function(){ var ua = window.navigator.userAgent.toLowerCase(); return((ua.indexOf('msie') > -1) && (!(ua.indexOf('opera') > -1))); }; }; function IAjax(){ } IAjax.Pop=function(url){ window.open(url,'showcontent','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=600'); }; IAjax.Digit=function(str) { if (str==null) return false; for (var i = 0; i < str.length; i++) { var d = str.charAt(i); if ((d < "0") || (d > "9")) return false; } return true; }; IAjax.ValidateKey=function(item,control){ if (item.keyCode==13){ __LoadSearchResult(IAjax.getArguments(),'control='+control+'&__ecmcurrentpage=1'); return false; } }; IAjax.ValidateTaxonomyKey=function(item,control){ try{ if (item.keyCode==13){ __LoadTaxonomy(IAjax.getArguments(),'pagerequest=search&control='+control+'&__ecmcurrentpage=1'); return false; } }catch(e){} }; IAjax.DisplayError=function(message, context) { alert('An unhandled exception has occurred:\n' + message); try { Ektron.ready.ClientScriptCallbackEvent.errorCallback(message, context); } catch (ex) {} }; IAjax.DisplayResult=function(result, context) { this.QueryString=function(key){ var value = null; for (var i=0;i= 0) { var argname = unescape(pairs[i].substring(0,pos)); var value = unescape(pairs[i].substring(pos+1)); this.QueryString.keys[this.QueryString.keys.length] = argname; this.QueryString.values[this.QueryString.values.length] = value; } } }; this.ParseQueryString(context); var ____pagerequest=this.QueryString("pagerequest"); if(____pagerequest=='bubble' || ____pagerequest=='showcontent') { switch (____pagerequest){ case "bubble": EBubble.ShowHoverOverBubble(1,result,this.QueryString("bubblewidth"),this.QueryString("X"),this.QueryString("Y"),this.QueryString("SX"),this.QueryString("SY")); break; case "showcontent": var __showcontrol=this.QueryString("__ecmdiv"); try{ document.getElementById(__showcontrol).innerHTML=result; }catch(e){}; break; } } else { var c1=this.QueryString("control"); if (result == '') { result = document.getElementById(c1).innerHTML; } else { document.getElementById(c1).innerHTML=''; var dataelem = document.createElement('div');dataelem.innerHTML=result; document.getElementById(c1).appendChild(dataelem); } try { if(document.getElementById("__EkAjaxHidden"+c1)!=null){ document.getElementById("__EkAjaxHidden"+c1).value=result; if(ECommon.Ie()){ window.location.replace((window.location.href).replace(window.location.hash,"")+"#"+c1) IAjax.CacheHtml(c1); } } } catch(e) { } try { var astViewFrm = window.frames[0] //document.frames[0]; if(astViewFrm) { if( astViewFrm.setPostInfo ) { astViewFrm.setPostInfo(); } if( astViewFrm.SetFormDataInfo ) { astViewFrm.SetFormDataInfo(); } } } catch(e) { } } try { Ektron.ready.ClientScriptCallbackEvent.eventCallback(result, context); } catch (ex) {} }; IAjax.getArguments=IAjax.getArguements=function(){ return(IAjax.serializeForm()); }; IAjax.serializeForm = function() { var element = document.forms[0].elements; var len = element.length; var query_string = ""; this.AddFormField = function(name,value) { if (query_string.length>0) { query_string += "&"; } query_string += encodeURIComponent(name) + "=" + encodeURIComponent(value); }; for (var i=0; i=0) { this.AddFormField(item.name,item.options[item.selectedIndex].value); } break; case 'select-multiple': for (var j=0; j