// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved. // // You may incorporate this Apple sample code into your own code // without restriction. This Apple sample code has been provided "AS IS" // and the responsibility for its operation is yours. You may redistribute // this code, but you are not permitted to redistribute it as // "Apple sample code" after having made changes. // // ************************ // layer utility routines * // ************************ function getStyleObject(objectId) { // cross-browser function to get an object's style object given its id if(document.getElementById && document.getElementById(objectId)) { // W3C DOM return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { // MSIE 4 DOM return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { // NN 4 DOM.. note: this won't find nested layers return document.layers[objectId]; } else { return false; } } // getStyleObject function changeObjectVisibility(objectId, newVisibility) { // get a reference to the cross-browser style object and make sure the object exists var styleObject = getStyleObject(objectId); if(styleObject) { styleObject.visibility = newVisibility; return true; } else { // we couldn't find the object, so we can't change its visibility return false; } } // changeObjectVisibility function moveObject(objectId, newXCoordinate, newYCoordinate) { // get a reference to the cross-browser style object and make sure the object exists var styleObject = getStyleObject(objectId); if(styleObject) { styleObject.left = newXCoordinate; styleObject.top = newYCoordinate; return true; } else { // we couldn't find the object, so we can't very well move it return false; } } // moveObject /** add param to queryString, not encode the value**/ function addToQuery(queryString,param,value) { if(param == null) return ; var sbQuery=""; var items=queryString.split("&"); for (var i = 0; i < items.length;i++) { var item = items[i]; //if the param has exist, skip if(item.substring(0,param.length+1)==(param+"=")||item==param) { continue; } else { sbQuery += "&"; sbQuery += item; } } // append the new param at the end sbQuery +="&"; sbQuery += param; sbQuery += "="; sbQuery += URLEncode(value); return sbQuery.substring(1,sbQuery.length); } function URLEncode(str) { str = escape(str); // JScript doesn't think '/' needs to be escaped... // I'm not sure it does either, but take it out to be // consistent with VBScript's built-in URLEncode() while (str.indexOf("/")!=-1) { str = str.replace("/","%2F"); } return str; }