
ns=window.navigator.appName == "Netscape"
ie=window.navigator.appName == "Microsoft Internet Explorer"

function openIt(x) {
     var items = 9      
     for (i=0; i<=items; i++) {
if(ns) {
      document.layers[i].visibility = "hide" 
      document.layers[x].visibility = "show"
      document.layers[x].top=135      
       }    
if(ie) {
      document.all.box[i].style.visibility = "hidden" 
      document.all.box[x].style.visibility = "visible" 
      document.all.box[x].style.top = 131
       }
    }
}

function closeIt() {
    var items = 10 
    for (i=0; i<items; i++) {
       if(ie){document.all.box[i].style.visibility = "hidden"}
       if(ns){ document.layers[i].visibility = "hide"}          
}
}

function subDrop(y) {
     var items = 10 
     for (i=4; i<items; i++) {
  if(ie){
      document.all.box[i].style.visibility = "hidden"
      document.all.box[y].style.top = "131"
      document.all.box[y].style.visibility = "visible"
       }
  if(ns){
      document.layers[i].visibility = "hide"
      document.layers[y].top = "135"
      document.layers[y].visibility = "show" 
        }
    }
}

function closeSub() {
     var items = 10 
     for (i=6; i<items; i++) {
  if(ie){
      document.all.box[i].style.visibility = "hidden"
        }
  if(ns){
       document.layers[i].visibility = "hide"
        }
     }
}

function chgSlide(direction) {
	if (document.images) {
		thisPic = thisPic + direction
		if (thisPic > imgCt) {
			thisPic = 0
		}
		if (thisPic < 0) {
			thisPic = imgCt
		}
		document.myPicture.src=myPix[thisPic]
	}
}

function chgSlide2(direction) {
	if (document.images) {
		thisPic2 = thisPic2 + direction
		if (thisPic2 > imgCt2) {
			thisPic2 = 0
		}
		if (thisPic2 < 0) {
			thisPic2 = imgCt2
			}
		document.myPicture2.src=myPix2[thisPic2]
        }
}

function setgal() {
      
	if (size != 0) {
		myPix = new Array(size);
		myPix[0] = "../STRUCTURAL/" + branch  + ".jpg";
        	for ( i = 1; i<size+1; i++) {
        		myPix[i] = "../STRUCTURAL/" + branch + i + ".jpg";
	        }
        	thisPic = 0;
	        imgCt = myPix.length - 1;
	}
}

function saveMenu(limb,branch,size) {
	// alert ("limb" + limb + branch + size);
	
	theCookieName = "sipcookie=";
	theCookieValue = "limb:" + limb + "|branch:" + branch + "|size:" + size;
   	document.cookie = theCookieName + theCookieValue + ";";
	if (size != 0) {
		if (branch == "drawings") {
			ftype = ".gif";
			}
		else {
			ftype = ".jpg";
		}
		// alert (ftype);
		myPix = new Array(size);
		myPix[0] = "../STRUCTURAL/" + branch  + ftype;
        	for ( i = 1; i<size+1; i++) {
        		myPix[i] = "../STRUCTURAL/" + branch + i + ftype;
			// alert ("in the loop" + i + " " + myPix[i])
	        }
        	thisPic = 0;
	        imgCt = myPix.length - 1;
	} 
}

function getMenu() {
    var myCookieName = "sipcookie";
    var theCookie = document.cookie;
    // Remember, there can be multiple name=value pairs!
    // So, break the cookie up along the semi-colons
    var allCookies = theCookie.split( ";");
    // Now, take each of those name=value pairs and split them
    for (a=0; a<allCookies.length; a++) {
        var thisCookie = allCookies[a].split( "=");
	// Does the name in this cookie match?
        if (thisCookie[0] == myCookieName) {
            // break out the products in the cart
            if (thisCookie.length > 1) {
                var products = thisCookie[1].split( "|");
		if (products.length > 0) {
                    // Split out the part numbers and quantities for each product
                    var detailInfo = products[0].split( ":");
		    limb=detailInfo[1];
                    var detailInfo = products[1].split( ":");
		    branch=detailInfo[1];
                    var detailInfo = products[2].split( ":");
		    size=detailInfo[1];
                    }
                else {
                    // If there is nothing in the cookie, do nothing
		    limb="none";
		    branch="none";
		    size=0;
                    break;
                    }
                }
            }
        }
    }
