// global check for the retarded browser (IE)
var uA = navigator.userAgent;
var ie = false;
if(uA.indexOf("MSIE") != -1){
ie = true;
}
//var innerWindowWidth = getWindowWidth();
var sash = 245;
// create a scroll object, put tabs in it, scroll the object;
// when the object is scrolled beyond display limits, clip or
// somehow constrain the left/riht sides of the object to disappear,
// or alternatively, have the tabs contained within the scrolled
// object disappear....
// contraints: left-side: <0, right-side: left > cell width?
// when the summed widths of the tabs exceed the cell width,
// scroll left by the number of tabs that have exceeded the
// cell width....
var WIDTH = 70;
var CONTWIDTH = 560;
function addTab() {
var scrollObj = document.getElementById('scrollObject');
var content = scrollObj.innerHTML;
var tabs = document.getElementsByName("rtab");
content = content + " results " + (tabs.length + 1) + " | ";
scrollObj.innerHTML = content;
if( tabs.length + 1 > 9 ){
panMenuRight();
enablePanLeft();
}
}
function enablePanLeft() {
var leftPos = parseInt( document.getElementById("scrollObject").style.left );
var panb = document.getElementById("panMLB");
if( leftPos < 0 ){
panb.src = "/G3/images/leftArrow.gif";
panb.style.border = 'thin outset';
panb.disabled = false;
panb.title = "More Results";
}else{
panb.disabled = true;
panb.style.border = 'thin solid lightgrey';
panb.src = "/G3/images/leftArrow_disabled.gif";
panb.title = "";
}
}
function enablePanRight() {
var soWidth = parseInt( document.getElementById("scrollObject").style.width );
var soLeftPos = parseInt( document.getElementById("scrollObject").style.left );
var cWidth = getWindowWidth() - sash;
//alert(cWidth);
if(cWidth < 0 || cWidth == 0 || cWidth == 'undefined'){
cWidth = parseInt( document.getElementById("container").style.width );
}
var delta = cWidth - soWidth;
var panb = document.getElementById("panMRB");
//alert(soWidth+", "+soLeftPos+", "+delta);
//if( soWidth <= parseInt( document.getElementById("container").style.width ) ||
if( soWidth <= cWidth ){
// ( soLeftPos != 0 && delta <= soLeftPos) ){
panb.disabled = true;
panb.style.border = 'thin solid lightgrey';
panb.src = "/G3/images/rightArrow_disabled.gif";
panb.title = "";
}else{
panb.src = "/G3/images/rightArrow.gif";
panb.style.border = 'thin outset';
panb.disabled = false;
panb.title = "More Results";
}
}
function showScrollers() {
document.getElementById("panMRB").style.visibility = 'visible';
document.getElementById("panMLB").style.visibility = 'visible';
}
function hideScrollers() {
document.getElementById("panMRB").style.visibility = 'hidden';
document.getElementById("panMLB").style.visibility = 'hidden';
}
function panMaxRight(dynContWidth) {
var scrollObj = document.getElementById("scrollObject");
var container = document.getElementById("container");
var rtabs = document.getElementsByName("rtab");
var rtLen = 0;
for(var i=0;i 0 ){
scrollObj.style.left = '0px';
enablePanLeft();
}else{
scrollObj.style.left = newLeft + 'px';
}
// set the state of the right pan button based on the left position
enablePanRight();
}
// calculate the width of the container and the scrollable object and
// determine the difference; scroll the scrollable object according
// to the difference; also, if the last tab in the scrollable object
// is selected, make sure the scrollable object is scrolled all the
// way to the right; otherwise, just leave the scrollable object
// where it is
function setNavTabs() {
//if( !ie ){
try{
var container = document.getElementById("container");
var scrollObj = document.getElementById("scrollObject");
//var tabs = document.getElementsByName("rtab");
var iwWidth = getWindowWidth();
var screenWidth = screen.width;
//alert(screenWidth);
var fudge = 242;
//var soWidth = parseInt( scrollObj.style.width );
//alert( iwWidth+", "+soWidth );
//wWidth = wWidth * 0.75;
//var derivedContWidth = parseInt( (iwWidth * 0.80) - 150 );
var derivedContWidth = container.clientWidth;
if(iwWidth != 0){
derivedContWidth = iwWidth - fudge;
}
//if( (iwWidth + fudge) < screenWidth ){
// derivedContWidth = 690;
//}
//alert(derivedContWidth);
//alert(window.innerWidth);
//if(derivedContWidth == 0){
// derivedContWidth = iwWidth;
//}
container.style.width = derivedContWidth+'px';
//var soWidth = scrollObj.clientWidth;
//var soWidth = parseInt( tabs[0].style.width ) * tabs.length;
var soWidth = parseInt( scrollObj.style.width );
//alert("window inner: "+iwWidth+", screen: "+screenWidth+", container: "+derivedContWidth+", so: "+soWidth);
//alert(soWidth + ", "+ derivedContWidth );
//container.style.width = derivedContWidth + 'px';
//var tw = parseInt( tabs[0].style.width );
//var divR = parseInt( wWidth/tw );
//if( tabs.length + 1 > divR ){
if( soWidth > derivedContWidth ){
showScrollers();
var lastTab = 'false';
try{
lastTab = document.getElementById("lastTabSelected").value;
}catch(err){}
//var lastTab = "false";
if( lastTab ){
panMaxRight(derivedContWidth);
enablePanLeft();
}else{
enablePanLeft();
enablePanRight();
}
}else{
hideScrollers();
panMaxRight(derivedContWidth);
}
scrollObj.style.visibility = 'visible';
}catch(err){}
//}
}
// for HTAP prototype
function fillPage() {
var content = document.getElementById('content');
var controls = document.getElementById('controls');
var contY = findPos(content);
var ctrlsY = findPos(controls);
var scrHeight = window.innerHeight - 20;
if(ie){
//scrHeight = window.clientHeight - 20;
scrHeight = document.body.clientHeight
}
var contHeight = scrHeight - contY;
var ctrlsHeight = scrHeight - ctrlsY;
content.style.height = contHeight;
controls.style.height = ctrlsHeight;
}
// for HTAP prototype
function fillPageGeneric(elmId) {
var content = document.getElementById(elmId);
//var controls = document.getElementById('controls');
var contY = findPos(content);
//var contX = findLeftPos(content);
//var scrWidth = window.innnerWidth - 20;
var scrHeight = window.innerHeight - 20;
if(ie){
scrHeight = document.body.clientHeight;
}
var headerHeight = 50;
if(ie){
headerHeight = 100;
}
var winURL = window.location.href;
if( winURL.indexOf('iLineage') > -1 || winURL.indexOf('iDownload') > -1 ){
headerHeight = 100;
}
var contHeight = scrHeight - (contY + headerHeight);
if(ie){
contHeight = scrHeight - headerHeight;
}
//alert("win height: "+scrHeight+", content Y: "+contY+", content height: "+contHeight);
content.style.height = contHeight + 'px';
}
function resetPageSize(elmId){
var content = document.getElementById(elmId);
var scrWidth;
if(ie){
scrWidth = document.body.clientWidth - 30;
}else{
scrWidth = window.innerWidth - 70;
}
//alert(content.style.width + ", " + scrWidth);
content.style.width = scrWidth + 'px';
}
function findPos(obj) {
var curTop = 0;
if( obj.offsetParent ){
do {
curTop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return curTop;
}
function findLeftPos(obj) {
var curLeft = curTop = 0;
if( obj.offsetParent ){
do {
curLeft += obj.offsetLeft;
curTop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return curLeft;
}
function removeResults() {
var prot = window.parent.location.protocol;
var host = window.parent.location.host;
var path = window.parent.location.pathname;
var parentHref = prot + "//" + host + path;
//alert(parentHref);
var parentSearch = window.parent.location.search;
//alert(parentSearch);
var idx = parentSearch.indexOf("instance_id=");
//alert(idx);
var instanceStr = "";
if( parentSearch.indexOf("&") > - 1){
instanceStr = parentSearch.substring(idx,parentSearch.indexOf("&",idx));
}else{
instanceStr = parentSearch.substring(idx);
}
//alert(instanceStr);
parentHref = parentHref + "?" + instanceStr;
//alert(parentHref);
window.parent.location = parentHref;
}
function scrollTopMenu()
{
scrollMenu("");
}
function scrollMenu(parentElmId) {
//try{
var smenu = document.getElementById('scrollableMenu');
var vTab;
if(parentElmId != null && parentElmId != ""){
vTab = document.getElementById(parentElmId);
}else{
vTab = document.getElementById('visTab');
}
var yOff = window.pageYOffset;
if(yOff+"" == 'undefined'){
yOff = document.body.scrollTop;
if( yOff+"" == 'undefined' ){
yOff = document.documentElement.scrollTop;
}
}
var visTabTop = findPos(vTab);
//alert(yOff+", "+visTabTop);
//var outerH = window.outerHeight;
//var innerH = window.innerHeight;
//var clientH = document.body.clientHeight;
//alert(clientH+", "+innerH+", "+outerH+", "+wp);
if( parseInt(yOff) > visTabTop ){
smenu.style.top = yOff + 'px';
smenu.style.visibility = 'visible';
smenu.style.display = 'block';
smenu.style.zIndex = "1111";
smenu.style.left = '0px';
}else{
smenu.style.visibility = 'hidden';
smenu.style.display = 'none';
smenu.style.zIndex = "-1";
}
//}catch(err){}
}
function scrollRight() {
var selectorDoc = document.getElementById('selection').contentDocument;
if(ie){
selectorDoc = selection.document;
}
var selector = document.getElementById('selection');
var selLeft = findLeftPos(selector);
var scrWidth;
if(ie){
scrWidth = document.body.clientWidth - 30;
}else{
scrWidth = window.innerWidth - 70;
}
var scrollDIV = selectorDoc.getElementById('scrollDIV');
var imgElms = selectorDoc.getElementsByTagName('img');
var divWidth = 0;
for(var i=0;i visTabTop ){
sobj.style.top = yOff + 'px';
sobj.style.visibility = 'visible';
sobj.style.display = 'block';
sobj.style.zIndex = "1111";
sobj.style.left = '0px';
}else{
sobj.style.visibility = 'hidden';
sobj.style.display = 'none';
sobj.style.zIndex = "-1";
}
}
var hideTabConf = false;
function hideTab(rElmId) {
// first half of the tab id is the tab number,
// the second half is the wsid....
var rid = rElmId.split('_');
//var rtID = rid[0];
var wsid = rid[1];
var rElm = document.getElementById(rElmId);
var confirmHide = true;
//if( !hideTabConf ){
// confirmHide = confirm("Are you sure you want to remove this results tab?");
//}
if(confirmHide){
//if( !hideTabConf ){
// confirm("Don't show this alert again?");
//}
// hide the selected tab
rElm.style.visibility = 'hidden';
rElm.style.display = 'none';
// modify the scroll object width
var scrollObj = document.getElementById('scrollObject');
var rWidth = parseInt( rElm.style.width );
scrollObj.style.width = parseInt( scrollObj.style.width ) - rWidth;
// after the elmement is hidden, add
// the id to the list of hidden values
//var hiddenMenu = document.getElementById('hiddenMenu');
//hiddenMenu.add( id, null );
//var iHtml = hiddenMenu.innerHTML;
//iHtml += rElm;
//hiddenMenu.innerHTML = iHtml;
// add the hidden id to the hidden values field
//var menuVals = document.getElementById('hiddenMenuValues');
//var idStr = menuVals.value;
//if(idStr != ""){
// idStr += ", " + wsid;
//}else{
// idStr = wsid;
//}
//menuVals.value = idStr;
// are we trying to hide the page we're currently on (and so, do
// we need to redirect?)?
var currentPage = false;
var queryString = window.location.search;
var queryNVPs = queryString.split("&");
var nvp = "";
var nvpElms = new Array();
var hValStr = "";
for(var i=0;i 1 ){
// pick a neighbor...
if( (curIdx+1) == rtabsLen ){
// it's the last in the list, pick the next to last
dispIdx = curIdx;
}else{
dispIdx = curIdx + 1;
}
dispId = "rtabLink" + dispIdx;
}else{
// redirect to the landing page
dispId = "homeTabLink";
}
// get the element to be displayed
var dispElm = document.getElementById(dispId);
// get it's url....it should be an anchor....
dispUrl = dispElm.href;
}
// add target id to the list of hidden values
if( hValStr != "" ){
hValStr = hValStr + "," + wsid;
}else{
hValStr = wsid;
}
// formulate the new url
var hvIdx = dispUrl.indexOf("&hiddenResults");
if( hvIdx > -1 ){
dispUrl = dispUrl.substring(0,hvIdx);
}
// redirect
window.location.href = dispUrl + "&hiddenResults=" + hValStr;
}
}
function storeHiddenMenuValuesOnForm() {
var queryString = window.location.search;
var queryNVPs = queryString.split("&");
var nvp = "";
var nvpElms = new Array();
var hValStr = "";
for(var i=0;i -1){
homeUrl = homeUrl.replace(/results/,"gui");
}else if(homeUrl.indexOf("executionError") > -1){
homeUrl = homeUrl.replace(/executionError/,"gui");
}else if(homeUrl.indexOf("download") > -1){
homeUrl = homeUrl.replace(/download/,"gui");
}else if(homeUrl.indexOf("productLineage") > -1){
homeUrl = homeUrl.replace(/productLineage/,"gui");
}
var hvIdx = homeUrl.indexOf("&hiddenResults");
if(hvIdx > -1){
homeUrl = homeUrl.substring(0, hvIdx);
}
var urlElmA = homeUrl.split("?");
homeUrl = urlElmA[0] + "?" + newQueryStr;
window.location.href = homeUrl;
//var tabs = document.getElementsByName('rtab');
//var wsid = "";
//var tid = "";
//var hiddenVals = "";
//for(var i=0;i -1 ){
// url = url.substring(0,hvIdx);
// }
//url.replace("results","gui");
//url = url + "&hiddenMenuValues=" + hiddenVals;
//window.location = url + "&removeAll=1";
}
}
function buildHiddenTabsMenu (){
var hiddenMenu = document.getElementById('hiddenMenu');
var menuVals = document.getElementById('hiddenMenuValues').value;
var idStr = menuVals.value;
var ids = idStr.split(',');
var iHtml = "";
for(var i=0;i