﻿// JScript File


    function SubmitPNSearch() {
        var destination;
        destination='catalog/is.term.search.asp?qu='+document.pnsearch['qu'].value;
        window.location.href=destination;
        }
    	
    function RemoveLinks() {
        // Buttons on top-header are programmed to hierarchy links
        // If Javascript is enabled, we must remove these links and replace with #
        document.getElementById('LinkChooseLanguage').href = '#';
        document.getElementById('LinkSignIn').href = '#';
        document.getElementById('LinkHome').href = '#';
        document.getElementById('LinkSales').href = '#';
        document.getElementById('LinkService').href = '#';
        document.getElementById('LinkLitSoft').href = '#';
        }
    	
    function GetPosition(relPos) {
        //use fixed position (relative to body)
        var pageWidth, Xc,leftOffset;
        pageWidth=document.getElementById('dataforthLogo').offsetParent.offsetParent.offsetWidth;
        if (document.body.clientWidth>700){
	        leftOffset = parseInt((document.body.clientWidth-pageWidth)/2);}
        else {
	        leftOffset = 0;}
        Xc = relPos-leftOffset-2;
        return Xc;
        }
    	
    function GetVerticalPosition(eventObject) {
        var Yc;
        if(window.navigator.appName=='Netscape'){
            Yc = eventObject.pageY;}
        else {
            Yc = eventObject.y+document.body.scrollTop;}
        Yc = Yc-4;
        return Yc;
    }




    function doSectionWithFixedOffset(secNum, eventObject, offsetLeft, offsetTop) {

        // find location of event click
        var Xc, Yc
        if (window.navigator.appName == 'Netscape') {
	        Xc = eventObject.pageX;
	        Yc = eventObject.pageY;}
	    else {
	        Xc = eventObject.x;
	        Yc = eventObject.y+document.body.scrollTop+document.documentElement.scrollTop;}
	  

	    // apply desired offset
	    Xc = Xc + offsetLeft;
	    Yc = Yc + offsetTop;

	    // call doSection with fixed locations
	    doSection(secNum, eventObject, Xc, Yc);

    }


    	
    function doSection(secNum,eventObject,fixedLeft,fixedTop) {
        //set position of div to correspond to mouse position
        //unless fixedTop and fixedLeft are provided - then use that position
        var Xc,Yc,leftOffset,pageWidth
        
        if(fixedLeft==undefined){
	        //use mouse position
	        eventObject.offsetParent=document;
	        if (window.navigator.appName == 'Netscape') {
	            Xc = eventObject.pageX;
	            Yc = eventObject.pageY;}
	        else {
	            Xc = eventObject.x;
	            Yc = eventObject.y+document.body.scrollTop+document.documentElement.scrollTop;}
	        //offset div slightly to increase persistence
	        Xc = Xc-4;
	        Yc = Yc-4;}
        else{
	        //use fixed position (relative to body)
            //pageWidth = document.getElementById('dataforthLogo').offsetParent;
	        //if (document.body.clientWidth>700){
		    //    leftOffset = parseInt((document.body.clientWidth-pageWidth)/2);}
	        //else {
		    //    leftOffset = 0;}
            //Xc = fixedLeft+leftOffset;
            Xc = fixedLeft;
	        Yc = fixedTop-4;
	    }

	    
    		
       document.getElementById(secNum).style.cssText = 'top: '+Yc+'px; left: '+(Xc-2)+'px; ';
        
        //just display it!
       document.getElementById(secNum).style.display = "";


       // hide all other divs
       // functiondiv,servicediv,saleslocations,literaturediv,softwarediv

     
        
        }
        
        
            
    function noSection(secNum,eventObject,secChild,secParent) {
        //remove the section but only when mouse has left the boundaries of the object
        var divWidth,divHeight,Xc,Yc,rightBoundary,bottomBoundary,leftBoundary,topBoundary,outside=0;
        var childVisible=0,removeChild=0,toleranceValue;
        
        eventObject.offsetParent=document;
        divHeight = document.getElementById(secNum).offsetHeight;
        divWidth = document.getElementById(secNum).offsetWidth;
        if(window.navigator.appName=='Netscape'){
            Xc = parseInt(eventObject.pageX);
            Yc = parseInt(eventObject.pageY);
            divHeight = parseInt(divHeight) - 6;
            //divHeight = parseInt(divHeight);
            toleranceValue=0;
            }
        else {
            Xc = parseInt(eventObject.x);
            Yc = parseInt(eventObject.y+document.body.scrollTop);
            toleranceValue=0;
            }
            
        //add a little tolerance to leftBoundary for Mozilla
        leftBoundary = parseInt(document.getElementById(secNum).style.left)+2-toleranceValue;

        rightBoundary = leftBoundary + parseInt(divWidth)-5;
        topBoundary = parseInt(document.getElementById(secNum).style.top);
        bottomBoundary = topBoundary + parseInt(divHeight)-4;
        if (Xc>rightBoundary) {outside=1;}
        if (Xc<leftBoundary) {outside=1;removeChild=1;}
        if (Yc<topBoundary) {outside=1;removeChild=1;}
        if (Yc>bottomBoundary) {outside=1;removeChild=1;}
    	
    	
        //check that secChild (if it exists) should not still be visible
        if (secChild==undefined){
	        childVisible = 0;}
        else {
	        if(secChild=='none'){
		        childVisible = 0;}
	        else {
		        if (removeChild==1){
			        noSection(secChild,eventObject);}
		        if (document.getElementById(secChild).style.display==""){
			        childVisible = 1;}
		        else {
			        childVisible = 0;}}}
    	
        if (outside==1) {
	        if (childVisible==0){
		        if (document.getElementById(secNum).style.display==""){
			        document.getElementById(secNum).style.display="none";
			        if(secParent==undefined){
				        //do nothing
				        }
			        else {
				        //if (document.getElementById(secParent).style.display==""){
				        //	document.getElementById(secParent).style.display="none";}
				        noSection(secParent,eventObject);}}}}

				        // return results
				        if (outside == 1) {
				            if (childVisible == 0) {
				                return true;
				            }
				            else { return false; } 
				        }
				        else { return false; }		     


        }
        
    function SearchMouseOver() {
        document.getElementById('ImgSearch').src = 'g/mast.searchA.mo.gif';
        }
    	
    function SearchMouseOut() {
        document.getElementById('ImgSearch').src = 'g/mast.searchA.normal.gif';
        }


   function hideSection(secname) {
       document.getElementById(secname).style.display = "none";
        }


