// constants

var cmto = "mailto";
var cat = "@";

// var docrefer = document.referrer;
// var docdomain = document.domain;

// alert(docdomain);

// Cookie functions

function maximize() {
  top.moveTo(0,0);
  top.resizeTo(screen.availWidth,screen.availHeight);
}

function setCookie(pName, pValue) {
  setCookieD(pName,pValue,365);
}

function setCookieD(pName, pValue, pDays) {
  var today = new Date();
  var expires = new Date();
  expires.setTime(today.getTime() + 1000*60*60*24*pDays)
  document.cookie = pName + "=" + escape(pValue) +
                    "; expires=" + expires.toGMTString();
}

function getCookie(pName,pReset) {
  var search = pName + "=";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
        end = document.cookie.length;
      if(pReset == true)
        setCookie(pName,unescape(document.cookie.substring(offset,end)));
      return unescape(document.cookie.substring(offset,end));
      }
    }
  return "";
}

function mto(ptext,pmail,phost) {
  if (ptext == "") ptext = pmail + cat + phost;
  return("<a href='" + cmto + ":" + pmail + cat + phost + "'>" + ptext + "</a>");
}

function getSearchValueF(pName,pFrom) {
  var search = pName + "=";
  if (pFrom.length > 0) {
    offset = pFrom.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      end = pFrom.indexOf("&", offset);
      if (end == -1)
        end = pFrom.length;
      return unescape(pFrom.substring(offset,end));
      }
    }
  return "";
}

function getSearchValue(pName) {
  return getSearchValueF(pName,document.location.search);
}

function checkframe(pName,pUrl) {
  if (window.name != pName) {
    window.location.href = "index.html?url=" + pUrl;
    }
}
