/*
AjaxExplorer Copyright (C) 2007-2008 Syed Mohammad Sidque Tahir Al-Habshi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Head to
GNU site http://www.gnu.org/licenses/ for license copy.
*/

function get(name)
{
  return document.all? document.all(name):document.getElementById(name);
}

function colorIt(id, flag)
{
  get(id).style.color=flag? '#333':'#999';
}

function display(id, flag)
{
  get(id).style.display=flag? 'block':'none';
}

function getData(name)
{
  if(document.cookie)
  {
    if((pnt1=document.cookie.indexOf(name+'='))!=-1)
    {
      pnt1=pnt1+name.length+1;
      pnt2=document.cookie.indexOf(';', pnt1);
      return unescape(document.cookie.substring(pnt1, pnt2==-1? document.cookie.length:pnt2));
    }
  }

  return '';
}

function getDirc()
{
  return get('dirc').value=dirc.replace('*', '&');
}

function getSwap(name)
{
  return name.replace(/&/g, '*').replace(/\.\.\//g, '').replace(/\/\//g, '/');
}

function opacity(id, data)
{
  return mode? get(id).style.filter='alpha(opacity='+(data*100)+')':get(id).style.opacity=data;
}

function parseIt(data)
{
  return parseInt(data.replace('px', ''));
}

function setData(name, data)
{
  var date=new Date();
  date.setDate(date.getDate()+365);
  document.cookie=name+'='+escape(data)+'; expires='+date.toGMTString();

  return data;
}

function writeAt(id, text, flag)
{
  get(id).innerHTML=flag? get(id).innerHTML+text:text;
}