home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2007 July / PCgo_0707_DVDC.iso / html / pcgo.js < prev    next >
Encoding:
Text File  |  2006-10-17  |  5.7 KB  |  155 lines

  1. function changeColor(theRow,theColor1,theColor2) {
  2.     var theCells = theRow.cells;
  3.     var rowCellsCnt  = theCells.length;
  4.     for (c = 0; c < rowCellsCnt; c++) {
  5.         theCells[c].style.color = theColor2;
  6.         theCells[c].style.backgroundColor = theColor1;
  7.     }
  8.     return true;
  9. }                                   
  10.  
  11. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  12.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  13.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  14.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  15. }
  16. MM_reloadPage(true);
  17.  
  18. function MM_findObj(n, d) { //v4.01
  19.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  20.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  21.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  22.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  23.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  24. }
  25.  
  26. function MM_showHideLayers() { //v3.0
  27.   var i,p,v,obj,args=MM_showHideLayers.arguments;
  28.   for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
  29.     if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
  30.     obj.visibility=v; }
  31. }
  32.  
  33. /**********************************************************************************   
  34. ScrollText 
  35. *   Copyright (C) 2001 Thomas Brattli
  36. *   This script was released at DHTMLCentral.com
  37. *   Visit for more great scripts!
  38. *   This may be used and changed freely as long as this msg is intact!
  39. *   We will also appreciate any links you could give us.
  40. *
  41. *   Made by Thomas Brattli
  42. *
  43. *   Script date: 09/23/2001 (keep this date to check versions) 
  44. *********************************************************************************/
  45. function lib_bwcheck(){ //Browsercheck (needed)
  46.     this.ver=navigator.appVersion
  47.     this.agent=navigator.userAgent
  48.     this.dom=document.getElementById?1:0
  49.     this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
  50.     this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
  51.     this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
  52.     this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  53.     this.ie=this.ie4||this.ie5||this.ie6
  54.     this.mac=this.agent.indexOf("Mac")>-1
  55.     this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
  56.     this.ns4=(document.layers && !this.dom)?1:0;
  57.     this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
  58.     return this
  59. }
  60. var bw=lib_bwcheck()
  61. /*****************
  62.  
  63. You set the width and height of the divs inside the style tag, you only have to
  64. change the divScrollTextCont, Remember to set the clip the same as the width and height.
  65. You can remove the divUp and divDown layers if you want. 
  66. This script should also work if you make the divScrollTextCont position:relative.
  67. Then you should be able to place this inside a table or something. Just remember
  68. that Netscape crash very easily with relative positioned divs and tables.
  69.  
  70. Updated with a fix for error if moving over layer before pageload.
  71.  
  72. ****************/
  73.  
  74.  
  75. //If you want it to move faster you can set this lower, it's the timeout:
  76. var speed = 30
  77.  
  78. //Sets variables to keep track of what's happening
  79. var loop, timer
  80.  
  81. //Object constructor
  82. function makeObj(obj,nest){
  83.     nest=(!nest) ? "":'document.'+nest+'.'
  84.     this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  85.       this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
  86.     this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
  87.     this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
  88.     this.up=goUp;this.down=goDown;
  89.     this.moveIt=moveIt; this.x=0; this.y=0;
  90.     this.obj = obj + "Object"
  91.     eval(this.obj + "=this")
  92.     return this
  93.  
  94. }
  95.  
  96. // A unit of measure that will be added when setting the position of a layer.
  97. var px = bw.ns4||window.opera?"":"px";
  98.  
  99. function moveIt(x,y){
  100.     this.x = x
  101.     this.y = y
  102.     this.css.left = this.x+px
  103.     this.css.top = this.y+px
  104. }
  105.  
  106. //Makes the object go up
  107. function goDown(move){
  108.     if (this.y>-this.scrollHeight+oCont.clipHeight){
  109.         this.moveIt(0,this.y-move)
  110.             if (loop) setTimeout(this.obj+".down("+move+")",speed)
  111.     }
  112. }
  113. //Makes the object go down
  114. function goUp(move){
  115.     if (this.y<0){
  116.         this.moveIt(0,this.y-move)
  117.         if (loop) setTimeout(this.obj+".up("+move+")",speed)
  118.     }
  119. }
  120.  
  121. //Calls the scrolling functions. Also checks whether the page is loaded or not.
  122. function scroll(speed){
  123.     if (scrolltextLoaded){
  124.         loop = true;
  125.         if (speed>0) oScroll.down(speed)
  126.         else oScroll.up(speed)
  127.     }
  128. }
  129.  
  130. //Stops the scrolling (called on mouseout)
  131. function noScroll(){
  132.     loop = false
  133.     if (timer) clearTimeout(timer)
  134. }
  135. //Makes the object
  136. var scrolltextLoaded = false
  137. function scrolltextInit(){
  138.     oCont = new makeObj('divScrollTextCont')
  139.     oScroll = new makeObj('divText','divScrollTextCont')
  140.     oScroll.moveIt(0,0)
  141.     oCont.css.visibility = "visible"
  142.     scrolltextLoaded = true
  143. }
  144. //Call the init on page load if the browser is ok...
  145. if (bw.bw) onload = scrolltextInit
  146.  
  147. /***************
  148. Multiple Scripts
  149. If you have two or more scripts that use the onload event, probably only one will run (the last one).
  150. Here is a solution for starting multiple scripts onload:
  151.    1. Delete or comment out all the onload assignments, onload=initScroll and things like that.
  152.    2. Put the onload assignments in the body tag like in this example, note that they must have braces ().
  153.    Example: <body onload="initScroll(); initTooltips(); initMenu();">
  154. **************/
  155.