HMC.Util = {
nodeIsPortlet: function(node) {
if (node != null &&
node.nodeType == 1 && 
node.nodeName.toUpperCase() == 'DIV' &&
Liferay.Util.startsWith(node.id, 'p_p_id')) {
return true;
}
else {
return false;
}
},
getPrevPortlet: function(portlet) {
var prevPortlet = portlet.previousSibling;
while (!this.nodeIsPortlet(prevPortlet)) {
prevPortlet = prevPortlet.previousSibling;
}
return prevPortlet;
},
getNextPortlet: function(portlet) {
var nextPortlet = portlet.nextSibling;
while (!this.nodeIsPortlet(nextPortlet)) {
nextPortlet = nextPortlet.nextSibling;
}
return nextPortlet;
},
getBrowserWidth: function() {
var browserWidth = 0;
if (typeof(window.innerWidth) == 'number') {
//Non-IE
browserWidth = window.innerWidth;
}
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
browserWidth = document.documentElement.clientWidth;
}
else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible
browserWidth = document.body.clientWidth;
}
return browserWidth;
},
getBrowserHeight: function() {
var browserHeight = 0;
if (typeof(window.innerHeight) == 'number') {
//Non-IE
browserHeight = window.innerHeight;
}
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
browserHeight = document.documentElement.clientHeight;
}
else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible
browserHeight = document.body.clientHeight;
}
return browserHeight;
}
};