// 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 function SetCwinHeight(){ var cwin=document.getElementById("cwin"); if (document.getElementById){ if (cwin && !window.opera) { if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight) cwin.height = cwin.contentDocument.body.offsetHeight; else if(cwin.Document && cwin.Document.body.scrollHeight) cwin.height = cwin.Document.body.scrollHeight; } } } function GetObj(objName){ if(document.getElementById){ return eval('document.getElementById("' + objName + '")'); }else if(document.layers){ return eval("document.layers['" + objName +"']"); }else{ return eval('document.all.' + objName); } } function UserAgent() { var b=navigator.appName.toUpperCase(); if (b=="NETSCAPE") this.b="ns"; else if (b=="MICROSOFT INTERNET EXPLORER") this.b="ie"; else if (b=="OPERA") this.b="op"; else this.b=b; this.version=navigator.appVersion; this.v=parseInt(this.version); this.ns=(this.b=="ns" && this.v>=4); this.ns4=(this.b=="ns" && this.v==4); this.ns5=(this.b=="ns" && this.v==5); this.ie=(this.b=="ie" && this.v>=4); this.ie4=(this.version.indexOf('MSIE 4')>0); this.ie5=(this.version.indexOf('MSIE 5')>0); this.ie55=(this.version.indexOf('MSIE 5.5')>0); this.ie6=(this.version.indexOf('MSIE 6')>0); this.op = (this.b=="op"); this.op4 = (this.b=="op" && this.v==4); this.op5 = (this.b=="op" && this.v==5); } at=new UserAgent(); //if you want to create the frame or layer dynamically, do not //specify a name, do something like this, new exchanger(); function exchanger(name) { //hold the dynamically created iframe or layer this.lyr = null; //to remember if the iframe or layer is created dynamically. this.isDynamic = false; this.name=name||""; this.fakeid=0; if (name == null || name=="") { this.isDynamic = true; this.create(); } else { this.name=name; if (at.ns4) { this.lyr = window.document.layers[this.name]; } } } //this function should not be called directly exchanger.prototype.create=function() { if (at.ns4) { this.lyr=new Layer(0); this.visibility = "hide"; } else if (at.ie || at.ns5) { this.lyr=document.createElement("IFRAME"); this.lyr.width=0; this.lyr.height=0; this.lyr.marginWidth=0; this.lyr.marginHeight=0; this.lyr.frameBorder=0; this.lyr.style.visibility="hidden"; this.lyr.style.position="absolute"; this.lyr.src=""; this.name="tongIFrame"+window.frames.length; //this will make IE work. this.lyr.setAttribute("id",this.name); //this will make netscape work. this.lyr.setAttribute("name",this.name); document.body.appendChild(this.lyr); } } exchanger.prototype.sendData=function(url) { this.fakeid += 1; var newurl = ""; if (url.indexOf("?") >= 0) newurl = url + "&fakeId" + this.fakeid; else newurl = url + "?fakeId" + this.fakeid; if (this.isDynamic||at.ns4) this.lyr.src=newurl; else { if (at.ie || at.ns5 || at.op) { window.frames[this.name].document.location.replace(newurl); } } } exchanger.prototype.retrieveData=function(varName) { if (at.ns4) { return eval("this.lyr." + varName); } else if (at.ie || at.ns5 || at.op) { return eval("window.frames['" + this.name + "']." + varName); } }