/* ### BEGIN Kill Frames ### */
//if (window.self!=window.top) window.top.location=window.self.location;
/* ### END Kill Frames ### */

/* ### BEGIN Standard Cookie Code ### */
var exp = new Date();
exp.setTime(exp.getTime() + (7220 * 24 * 60 * 60 * 1000));

function setCookie(name, value, expires) {
  document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}

function getCookie(name) {
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
      return unescape(dc.substring(begin, end));
    }
  }
  return null;
}

function delCookie(name) {
  document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}
/* ### END Standard Cookie Code ### */


/* ### BEGIN Make exterior links open in a new window. ### */
function extwins() {
/* 2004.02.25: no more... links open in the same window...
	people need to learn how to use their browser...
	shift for IE, or tabs in Mozilla/Firefox/Safari...
  for (i=0; i<document.links.length; i++) {
    extlink=false;
    nhttp = document.links[i].href.indexOf('http\:\/\/');
    njoek = document.links[i].href.indexOf('joek.com');
    if (nhttp>=0) extlink=true;
    if (njoek>=0 && njoek<20) extlink=false;
    if (extlink) document.links[i].target='\_blank';
  }
*/
}
/* ### END Make exterior links open in a new window. ### */


/* ### BEGIN Import Style Sheets ### */
styleStart = '<style type="text\/css" media="screen"> \@import url(';
styleEnd = '\)\; <\/style>';

if (getCookie('siteStyle') != null) {
  styleURL = '/style/designs/' + getCookie('siteStyle') + '.css';
  document.write(styleStart + styleURL + styleEnd);
}
else document.write(styleStart + '/style/designs/default.css' + styleEnd);
//document.write(styleStart + '/style/designs/christmas.css' + styleEnd);

if (getCookie('siteFont') != null) {
  sizeURL = '/style/fonts/' + getCookie('siteFont') + '.css';
  document.write(styleStart + sizeURL + styleEnd);
}
else document.write(styleStart + '/style/fonts/vg.css' + styleEnd);


if (getCookie('siteLayout') != null) {
  layoutURL = '/style/layouts/' + getCookie('siteLayout') + '.css';
  document.write(styleStart + layoutURL + styleEnd);
}
else document.write(styleStart + '/style/layouts/rightmenu.css' + styleEnd);

/* ### END Import Style Sheets ### */


/* ### BEGIN Pop-up Window Code ### */
function oWin(Purl, Pname, Pw, Ph) {
	pWin = window.open(Purl, Pname, 'width=' + Pw + ',height=' + Ph + ',toolbar=no,menubar=no,scrollbars=no,status=no,location=no,resizable=no');
	pWin.focus();
}
/* ### END Pop-up Window Code ##3 */


/* ### BEGIN JavaScript Email Trick ### */
// Will it hide my email address from spammers?
varOne = 'joek';
varTwo = 'web';
varThree = 'com';
function emailTrick() {
	document.location.href = 'mailto:' + varTwo + '@' + varOne + '.' + varThree;
}
/* ### END JavaScript Email Trick ### */


/* ### BEGIN Random Number Generator ### */
var now = new Date();
var seed = now.getTime() % 0xffffffff;
function getRandom(n) {
	seed = (0x15a4e35 * seed) % 0x7fffffff;
	return (seed >> 16) % n;
}
/* ### END Random Number Generator ### */


/* ### BEGIN Ajax Scripts ### */
// Build an Ajax object
function makeAjax() {
	try {
		ajaxObj = new XMLHttpRequest();
	} catch(errorOne) {
		try {
			ajaxObj = new ActiveXObject('Msxml2.XMLHTTP');
		} catch(errorTwo) {
			try {
				ajaxObj = new ActiveXObject('Microsoft.XMLHTTP');
			} catch(errorThree) {
				ajaxObj = false;
			}
		}
	}
	return ajaxObj;
}

// Send an Ajax request
function sendAjax(ajaxObj, returnFunction, queryString) {
	// URL to our Ajax tool & a datetime stamp to prevent caching
	ajaxToolsURL = '/tools.ajax.php?';
	ajaxNoCache = '&nocache=' + new Date().getTime();
	// Build our URL to send
	sendURL = ajaxToolsURL + queryString + ajaxNoCache;
	// Build the Ajax object
	ajaxObj = makeAjax();
	// Send the Ajax request
	ajaxObj.open('GET', sendURL, true);
	ajaxObj.onreadystatechange = returnFunction;
	ajaxObj.send(null);
}
/* ### END Ajax Scripts ### */




