home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 January / Chip_2004-01_cd1.bin / chplus / fyzikam / scripts.js < prev    next >
Text File  |  2003-11-25  |  3KB  |  113 lines

  1. function go(){
  2.   if (document.jumpto.pids.options[document.jumpto.pids.selectedIndex].value != "none") {
  3.     location = document.jumpto.pids.options[document.jumpto.pids.selectedIndex].value;
  4.   }
  5. }
  6.  
  7. function confirmAlbum(stuffid)
  8. {
  9.     var is_confirmed = confirm("Are you sure you want to DELETE this album? (id: " + stuffid + ") \n\nWARNING: All the pictures and comments in this album will \nalso be deleted!");
  10.     if (is_confirmed) {
  11.         // Do nothing...
  12.     }
  13.     return is_confirmed;
  14. }
  15.  
  16. function confirmPicture(stuffid)
  17. {
  18.     var is_confirmed = confirm("Are you sure you want to DELETE this picture? (id: " + stuffid + ") \nComments will also be deleted.");
  19.     if (is_confirmed) {
  20.         // Do nothing...
  21.     }
  22.     return is_confirmed;
  23. }
  24.  
  25. function confirmComment(stuffid)
  26. {
  27.     var is_confirmed = confirm("Are you sure you want to DELETE this comment? (id: " + stuffid + ")");
  28.     if (is_confirmed) {
  29.         // Do nothing...
  30.     }
  31.  
  32.     return is_confirmed;
  33. }
  34.  
  35. function MM_openBrWindow(theURL,winName,features) { //v2.0
  36.   window.open(theURL,winName,features);
  37. }
  38.  
  39. function writeCookie(name, data, noDays){
  40.   var cookieStr = name + "="+ data
  41.   if (writeCookie.arguments.length > 2){
  42.     cookieStr += "; expires=" + getCookieExpireDate(noDays)
  43.     }
  44.   document.cookie = cookieStr
  45. }
  46.  
  47. function readCookie(cookieName){
  48.    var searchName = cookieName + "="
  49.    var cookies = document.cookie
  50.    var start = cookies.indexOf(cookieName)
  51.    if (start == -1){ // cookie not found
  52.      return ""
  53.      }
  54.    start += searchName.length //start of the cookie data
  55.    var end = cookies.indexOf(";", start)
  56.    if (end == -1){
  57.      end = cookies.length
  58.      }
  59.    return cookies.substring(start, end)
  60. }
  61.  
  62. function blocking(nr, cookie, vis_state)
  63. {
  64.     if (document.layers)
  65.     {
  66.         current = (document.layers[nr].display == 'none') ? vis_state : 'none';
  67.         if (cookie != '')
  68.             writeCookie(nr, current);
  69.         document.layers[nr].display = current;
  70.     }
  71.     else if (document.all)
  72.     {
  73.         current = (document.all[nr].style.display == 'none') ? vis_state : 'none';
  74.         if (cookie != '')
  75.             writeCookie(nr, current);
  76.         document.all[nr].style.display = current;
  77.     }
  78.     else if (document.getElementById)
  79.     {
  80.         display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';
  81.         if (cookie != '')
  82.             writeCookie(nr, display);
  83.         document.getElementById(nr).style.display = display;
  84.     }
  85. }
  86.  
  87.  
  88. function adjust_popup()
  89. {
  90.     var w, h, fixedW, fixedH, diffW, diffH;
  91.     
  92.     if (document.all) {
  93.         fixedW = document.body.clientWidth;
  94.         fixedH = document.body.clientHeight;
  95.         window.resizeTo(fixedW, fixedH);
  96.         diffW = fixedW - document.body.clientWidth;
  97.         diffH = fixedH - document.body.clientHeight;
  98.     } else {
  99.         fixedW = window.innerWidth;
  100.         fixedH = window.innerHeight;
  101.         window.resizeTo(fixedW, fixedH);
  102.         diffW = fixedW - window.innerWidth;
  103.         diffH = fixedH - window.innerHeight;
  104.     }
  105.     w = fixedW + diffW;
  106.     h = fixedH + diffH;
  107.     if (h >= screen.availHeight) w += 16;
  108.     if (w >= screen.availWidth)  h += 16;
  109.     w = Math.min(w,screen.availWidth);
  110.     h = Math.min(h,screen.availHeight);
  111.     window.resizeTo(w,h);
  112.     window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
  113. }