/*
 * @/js/common.js
 * @version 1.0.2, 2007/05/22
 * Copyright (c) 2006, Goodnews Powered By Joshua Lu
 * All rights reserved.
 */

function gothispage(newURL){
  if (newURL!=""){
    location.href = newURL;
  }
}

function goMenu(menu_idx){
  var goURL = "";
  switch (menu_idx){
    case "join" :
      top.location.href = "goodnews.php";
      return;
    case "loss" :
      top.location.href = "goodnews.php";
      return;
    default :
      alert('URL Error!!');
      return;
  }
  if (goURL!=""){
    location.href = goURL;
  }
}

function openpopup(popurl, w, h, t, l, sizable){
  str = 'width='+w+',height='+h+',top='+t+',left='+l;
  if ( sizable != true ){
    str = str + ',scrollbars=no,resizable=no,status=no';
  }else{
    str = str + ',scrollbars=yes,resizable=yes,status=yes';
  }
  window.open(popurl,'',str);
}

function ServiceShowHide(serNum){
  if (serNum.className=="off"){
    serNum.className = "on";
  }else{
    serNum.className = "off";
  }
}

function SecShowHide(secNum){
  if (secNum.className=="off"){
    secNum.className = "on";
  }else{
    secNum.className = "off";
  }
}

//eBook & Catalog

NSV4 = (document.layers) ? 1 : 0;

function exch(s){
  clicksearch(1);
  document.epublish_form["scrn"].value = s;
  document.epublish_form["scrndisp"].value = 1;
  clicksearch(1);
}

function clicksearch(a){
  var screen = document.epublish_form["scrn"].value;
  var screen_disp = parseInt(document.epublish_form["scrndisp"].value);

  if (sbible==0){
    if (NSV4){
      document.layers["searchbible"].visibility = "hidden";
      sbible = 1;
    }else{
      with (document.all("searchbible")){
        filters[0].Apply();
        style.visibility = "hidden";
        filters[0].Play();
      }
      sbible = 1;
    }
  }

  if (a==0) screen_disp = 0;

  if (NSV4){
    if (screen_disp==1){
      document.layers[screen].visibility = "visible";
      document.epublish_form["scrndisp"].value = 0;
    }else{
      document.layers[screen].visibility = "hidden";
      document.epublish_form["scrndisp"].value = 1;
    }
  }else{
    if (screen_disp==1){
      with (document.all(screen)){
        filters[0].Apply();
        style.visibility = "visible";
        filters[0].Play();
      }
      document.epublish_form["scrndisp"].value = 0;
    }else{
      with (document.all(screen)){
        filters[0].Apply();
        style.visibility = "hidden";
        filters[0].Play();
      }
      document.epublish_form["scrndisp"].value = 1;
    }
  }
}

var sbible = 1;

function ToggleDisplay(oButton,oItems,oTx){
  if ((oItems.style.display=="") || (oItems.style.display=="none")){
    oItems.style.display = "block";
    oButton.src = "images/node_closed.gif";
    oTx.value = "Y";
  }else{
    oItems.style.display = "none";
    oButton.src = "images/node_opened.gif";
    oTx.value = "N";
  }
  return false;
}

function ToggleDisplay1(oButton,oItems){
  if ((oItems.style.display=="") || (oItems.style.display=="none")){
    oItems.style.display = "block";
    oButton.src = "images/node_closed.gif";
  }else{
    oItems.style.display = "none";
    oButton.src = "images/node_opened.gif";
  }
  return false;
}

function fsubmit(path){
  epublish_form.action = path;
  epublish_form.target = "_top";
  epublish_form.submit();
}

//Article

ToggleImageGlb = null;

function ToggleItem(ImageName,ItemName){
  var oHideableItems = document.all.item(ItemName);
  var oToggleImages = document.all.item(ImageName);

  if ((oHideableItems!=null) && (oToggleImages!=null)){
    ToggleImageGlb = oToggleImages;
    if (oHideableItems.style.display!="none"){
      oHideableItems.style.display = "none";
      setTimeout("ToggleImageGlb.src = 'images/share_icon_article_expand.gif'", 10);
    }else{
      oHideableItems.style.display = "";
      setTimeout("ToggleImageGlb.src = 'images/share_icon_article_collapse.gif'", 10);
    }
  }
}