//  Author:  Mitch Allen (c) 2003
// Program:  popup.js

function getScrollY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return ( scrOfY );
}

function hideSelects(action) { 
//documentation for this script at http://www.shawnolson.net/a/1198/
//possible values for action are 'hidden' and 'visible'
if (action!='visible'){action='hidden';}

if (navigator.appName.indexOf("MSIE")) {
    for (var S = 0; S < document.forms.length; S++){
        for (var R = 0; R < document.forms[S].length; R++) {
            if ('iiR' != document.forms[S].id) // don't hide the selects in the related popup
            if (document.forms[S].elements[R].options) {
                document.forms[S].elements[R].style.visibility = action;
            }
        }
    }
}
}

function popup( obj, L, T ) { 
    
    hideSelects('hidden'); // the selects of the main product were showing thru the popup
    
	with( document.getElementById(obj).style ) {
		display = "block";
		position = "absolute";
		left = Number(L) + 'px';
		var y = getScrollY();
		//alert(Number(T) + y);
		top = (Number(T) + y) + 'px'; 
	}
}

function unpop( obj ) { 
    hideSelects('visible');
    //document.getElementById(obj).innerHTML = " "; 
    with( document.getElementById(obj).style ) {
        display = "none"; 
    //left = '-9000px'; 
    }
}
