if (typeof WebGUI == 'undefined') {
WebGUI = {};
}
if(typeof WebGUI.widgetBox == 'undefined') {
WebGUI.widgetBox = {};
}
WebGUI.widgetBox = {
parentNodeId : null,
url : null,
// this function courtesy of http://www-128.ibm.com/developerworks/web/library/wa-ie2mozgd/
// lots of reformatting to be easier to read
getWidgetFrame : function( frameId ) {
var widgetFrame = null;
// standards compliant, i.e. gecko et al.
if (document.getElementById(frameId).contentDocument) {
widgetFrame = document.getElementById(frameId).contentDocument;
}
// not compliant, i.e. IE
else {
//widgetFrame = document.frames[frameId].document;
widgetFrame = document.getElementById(frameId).document;
}
return widgetFrame;
},
widget : function( url, parentId, width, height, templateId, styleTemplateId ) {
if(url == "") {
return "";
}
if(width == undefined) {
width = 600;
}
if(height == undefined) {
height = 400;
}
if(templateId == undefined) {
this.url = url + "?func=ajaxInlineView";
}
else {
this.url = url + "?func=widgetView&templateId=" + templateId;
this.url += ";width=" + width;
this.url += ";height=" + height;
this.url += ";styleTemplateId=" + styleTemplateId;
}
this.parentNodeId = parentId;
this.markup = "";
this.markup += "";
return this.markup;
},
retargetLinksAndForms : function() {
// get all the elements, change their target appropriately
var allLinks = document.getElementsByTagName('a');
for(var i = 0; i < allLinks.length; i++) {
// skip the gear links for widgets
if( allLinks[i].href.search(/#/) != -1 && allLinks[i].name.search(/^show/) != -1 ) {
continue;
}
else {
allLinks[i].target = '_blank';
}
}
// same for