//	North Stars Options Class - Copyright (C) 2009-2010 Charles A Upsdell, All Rights Reserved; www.upsdell.com

cOptions.prototype.$name = 'cOptions';

function cOptions( cookieName, aOptions, aValues )
{
var isValues = arguments.length >= 3;
if ( arguments.length < 2 )
	{ this.$name.alert( '', 'has %0 arguments, needs 2 or 3', arguments.length ); return; }
if ( !(aOptions instanceof Array) )
	{ this.$name.alert( '', 'aOptions is %0, must be array', typeof(aOptions) ); return; }
if ( isValues && !(aValues instanceof Array) )
	{ this.$name.alert( '', 'aValues is %0, must be array', typeof(aValues) ); return; }
this.cookieName = cookieName;
if ( document.URL.indexOf('http://') != 0 )
	this.cookieName += '_local';
this.aOptions = new Array();
for ( var i = 0; i < aOptions.length; ++i )
	this.aOptions[i] = aOptions[i];
this.aCookie = new cCookie( this.cookieName );
for ( var i = 0; i < aOptions.length; ++i )
  {
	if ( typeof(this.aCookie[aOptions[i]]) == 'undefined' )
	  {
		if ( isValues && (i < aValues.length) )
			this.aCookie[aOptions[i]] = aValues[i];
		else
			this.aCookie[aOptions[i]] = 1;
	  }
  }
return;
}

cOptions.prototype.save = function ()
{
var $name = 'save';
this.aCookie.storeCookie( 366, '/', '', false )
}

cOptions.prototype.set = function ( property, value )
{
var $name = 'set';
if ( arguments.length == 2 )
  {
	if ( this.aOptions.indexOf(property) != -1 )
		this.aCookie[property] = value;
  }
else
  {
	this.$name.alert( '$name', 'has %0 arguments, but 2 are needed', arguments.length );
  }
this.save();
}

