// Script: General JavaScript Functions
// Version: 2.0
// Last Updated: 11 March 2008
// Author: Paul Hunt
// -----------------------------------------------------------------------------
// Copyright 2006 CustomSUPPORT www.CustomSUPPORT.com
// Use is permitted only with permission of the author
// No part may be reproduced or distributed without permission of the author
// No modifications are permitted without permission of the author
// License is granted if and only if this entire copyright notice is included
// Email: webmaster@CustomSUPPORT.com
// -----------------------------------------------------------------------------
// functions:
//		_cookieDel(name)					Delete (expire) cookie
//		_cookieGet(name)					Get (retrieve) cookie
//		_cookieSetForm(form, element)		Set (save) a cookie from a parameter value
//		_cookieSetV(name, value, expires)	Set (save) a cookie from a form element value
//      _frameLoad()						Breakout of frames, frame if necessary, call _navStyle
//      _frameLoadI()						Breakout of frames, frame if necessary, call _imgSet
//      _frameUnload()						Call _navStyle
//      _frameUnloadI()						Call _imgSet
//		_isJSOn()  							Show JavaScript is Active			   
//		_sendMailTo(name, company, domain)	Send email (spam resistant)

function _cookieDel(name) {
    document.cookie = name + "=VOID; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
	}
	
function _cookieGet(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 _cookieSetForm(form, element) {
    document.cookie = document.forms[form].elements[element].value;
	}
	
function _cookieSetV(name, value, expires) {
    document.cookie = name + "=" + escape(value) + "; path=/" +
    ((expires == null) ? "" : "; expires=" + expires.toGMTString());
	}
	
function _frameLoad() {
	var framer = "indexF.html";
	var broke = 0;
	if ((document.referrer.toLowerCase().indexOf(document.domain.toLowerCase()) == -1) && (document.referrer != "")) {
		top.location.href = document.location.href;
		window.location.replace(framer + '?' + window.self.location.pathname);
		broke = 1;
		return;
		}
	if (top == self) {
		window.location.replace(framer + '?' + window.self.location.pathname);
		return;
		}
	if ((broke == 0) && (top.frames[0]) && (top.frames[0]._navStyle)) {
		top.frames[0]._navStyle(navID,'load');
		}
	}
	
function _frameUnload() {
	if ((document.referrer.toLowerCase().indexOf(document.domain.toLowerCase()) != -1) && (top.frames[0]) && (top.frames[0]._navStyle)) {
		top.frames[0]._navStyle(navID,'unload');
		}
	}

function _frameLoadI() {
	var framer = "indexF.html";
	var broke = 0;
	if ((document.referrer.toLowerCase().indexOf(document.domain.toLowerCase()) == -1) && (document.referrer != "")) {
		top.location.href = document.location.href;
		window.location.replace(framer + '?' + window.self.location.pathname);
		broke = 1;
		return;
		}
	if (top == self) {
		window.location.replace(framer + '?' + window.self.location.pathname);
		return;
		}
	if ((broke == 0) && (top.frames[0]) && (top.frames[0]._imgSet)) {
		top.frames[0]._imgSet('On',navID);
		}
	}
	
function _frameUnloadI() {
	if ((document.referrer.toLowerCase().indexOf(document.domain.toLowerCase()) != -1) && (top.frames[0]) && (top.frames[0]._imgSet)) {
		top.frames[0]._imgSet('Off',navID);
		}
	}

function _isJSOn() {
	return "YES";
	}
	
function _sendMailTo(name, company, domain) {
      locationstring = 'mai' + 'lto:' + name + '@' + company + '.' + domain;
      window.location.replace(locationstring);
	  }
