
// This file contains java common script for this web site.

var allCookies = null;
function djs_getCookie( cookieName)
{
  if( allCookies==null && document.cookie!="")
  {
    allCookies = document.cookie.split("; ");
  }

  if( allCookies!=null)
  {
    for (i=0; i<allCookies.length; i++)
    {
      thisCookie=allCookies[i].split("=");
      if( cookieName == thisCookie[0])
      {
        return thisCookie[1];
      }
    }
  }
  return null;
}

function djs_setCookie( cookieName, cookieVal)
{
  var args=djs_setCookie.arguments;
  var expireDate = new Date;
  if( args.length>2)
  {
    expireDate.setMonth( expireDate.getMonth()+args[2]);
  }
  else
  {
    expireDate.setHours( expireDate.getHours()+24);
  }
  document.cookie = cookieName+"="+cookieVal+";expires=" + expireDate.toGMTString();
}

function djs_statusMsg( msgStr)
{
  window.status=msgStr;
  return true;
}

function djs_clearStatus()
{
  window.status='';
  return true;
}

function djs_swapImage( image, newname)
{
  if( document.images)
  {
    var imgext=".gif";
    var args=djs_swapImage.arguments;
    if( args.length>2) imgext=args[2];
    image.src=navimgdir + "/" + newname + imgext;
  }
  return true;
}

function djs_swapImageMsg( image, newname, msg)
{
  if( document.images)
  {
    var imgext=".gif";
    var args=djs_swapImageMsg.arguments;
    if( args.length>3) imgext=args[3];
    image.src=navimgdir + "/" + newname + imgext;
  }
  return djs_statusMsg( msg);
}

function djs_LinkImage( iname, alttxt, dest)
{
  document.write( '<a href="' + dest + '"><img src="' + iname + '" alt="' + alttxt + '" border=0></a>');
  return true;
}

function djs_PadIntStr( num)
{
  var tmpint=num+100;
  return tmpint.toString().substring(1,3);
}

var djs_bigPictureDataName="djs_bpdata";
var djs_bigPictureTitle="djs_bptitle";

function djs_ShowBigPicture( index)
{
  var args=djs_ShowBigPicture.arguments,
      subdir="",
      sectname=skch_pageName.split('/')[1];
  if( args.length>1)
  {
    subdir=args[1];
  }
  djs_setCookie( djs_bigPictureDataName, sectname+'_bpd['+index+']');
  djs_setCookie( djs_bigPictureTitle, sectname+'_pageTitle');
  window.location="./" + subdir + "showbigpicture.html";
}

djs_monthDays=new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
function djs_DaysInMonth( monthnum, yearnum)
{
  var daysinmonth=djs_monthDays[monthnum];
  if( daysinmonth==28 && (yearnum%4)==0)
  {
    daysinmonth=29;
  }
  return daysinmonth;
}

var djs_GotoNoteDataName="djs_notedata";

function djs_ClearNote()
{
  djs_setCookie( djs_GotoNoteDataName, "");
}

function djs_GotoNote( noteloc, returnpoint)
{
  djs_setCookie( djs_GotoNoteDataName, noteloc.split('#')[1] + "," + returnpoint);
  window.location=noteloc;
}

var djs_notelocation="";

function djs_GetNoteData()
{
  djs_notelocation=djs_getCookie( djs_GotoNoteDataName);
//alert( djs_notelocation);
}

function djs_NoteReturn( notelab, notetxt, noteclass)
{
  if( djs_notelocation==null || djs_notelocation=='')
  {
    if( notelab=='**')
    {
      document.write( '<div class="' + noteclass + '"><a href="javascript:history.back(1);">' + notetxt + '</a></div>');
    }
  }
  else if( djs_notelocation.split(',')[0]==notelab)
  {
    document.write( '<div class="' + noteclass + '"><a href="javascript:history.back(1);">' + notetxt + '</a></div>');
//    document.write( '<div class="' + noteclass + '"><a href="./' + djs_notelocation.split(',')[1] + '">' + notetxt + '</a></div>');
  }
} 

