// File: /okcontent/js/Oryx/Cookies.js
AUTOCORE_SELF_CHECK.push("Oryx/Cookies.js");
// 

function setOkCookie(name,value,expires) {
    setCookie(name,value,expires);
}

function deleteOkCookie(name) {
    deleteCookie(name);
}

// -----------------------------------------------------------------------------------

function getPageTopDomain() {
 var host = window.location.host;
 var parts = host.split('.');
 var res = parts[parts.length-2] + "." + parts[parts.length-1];
 if (res.indexOf(':') != -1) {
	 res = res.substr(0,res.indexOf(':'));
 }
 return res;
}

function secondsFromNow (sec) {
   res = new Date();
   res.setTime(new Date().getTime() + sec * 1000);
   return res;
}

// -----------------------------------------------------------------------------------

function setCookie(name,value,expires) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      "; path=/"+
      "; domain=" + getPageTopDomain();
  document.cookie = curCookie;
}
function deleteCookie(name) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    "; domain=" + getPageTopDomain() + 
    "; path=/"+
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function getCookie(name) {
	var dc = document.cookie;
  	var prefix = name + "=";
  	var begin = dc.indexOf("; " + prefix);
  	if (begin == -1) {
    	begin = dc.indexOf(prefix);
    	if (begin != 0) return null;
  	} 
	else
    	begin += 2;
  	var end = document.cookie.indexOf(";", begin);
  	if (end == -1)
    	end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

 /* 
 */

function addNewCoresToCookie(file_nums, hash) {
	 var old_cookie = getCookie("core");
	 var old_cookie_parts = [];
	 var new_cookie = old_cookie;
	 if (old_cookie)
		old_cookie_parts = old_cookie.split(":");
	 if (old_cookie_parts.length == 0 || old_cookie_parts[0] != hash)
		old_cookie
	 if (! old_cookie || old_cookie.split(":")[0] != hash)
		new_cookie = hash;
	 var new_addition = file_nums.join(",");
	 for (var i = 1; i < old_cookie_parts.length && old_cookie_parts[0] == hash; i++) {
		 if (old_cookie_parts[i] == new_addition) {
			 return;
		 }
	 }
	 new_cookie += ":" + new_addition;
	 setCookie("core", new_cookie, secondsFromNow(86400 * 30));
}

// Backwards compatibility, but limit miniCookies to 3600 seconds.
 
function setMiniCookie(name,value) {
	NanoCookie.set(name,value,{ms:3600*1000});
}

function deleteMiniCookie(name) {
	NanoCookie.remove(name);
}

function getMiniCookie(name) {
	return NanoCookie.get(name);
}

// 
NanoCookie = {
	
	// 
	set : function(key,value,expires,test) {
		var cookies = this.deserialize();
		var d = new Date();
		var obj = new Object();
		obj["k"] = key;
		obj["v"] = value;
		if (expires.ms)
			obj["e"] = d.getTime() + parseInt(expires.ms);
		else if (expires.gmt)
			obj["e"] = expires.gmt;
		else
			obj["e"] = expires.date.getTime();
		if (isNaN(obj["e"]))
			obj["e"] = 0;
		var found = false;

		for (var i = 0; i < cookies.length; i++) {
			if (cookies[i]["k"] == key) {
				cookies[i] = obj;
				found = true;
			}
		}
		if (! found)
			cookies.push(obj);
		this.serializeAndStore(cookies);
	},
	get : function(key) {
		var cookies = this.deserialize();
		for (var i = 0; i < cookies.length; i++) {
			if (cookies[i]["k"] == key) {
				return cookies[i]["v"];
			}
		}
		return null;
	},	
	// 
	getAll : function(nano_cookie_str) {
		var cookies = this.deserialize(nano_cookie_str);
		var res = [];
		for (var i = 0; i < cookies.length; i++) {
			var obj = new Object();
			obj["key"] = cookies[i]["k"];
			obj["value"] = cookies[i]["v"];
			obj["expires"] = new Date(cookies[i]["e"]);
			res.push(obj);
		}
		return res;		
	},
	// 
	findRegExp : function(regexp) {
		var cookies = this.deserialize();
		var res = [];
		for (var i = 0; i < cookies.length; i++) {
			if (regexp.test(cookies[i]["k"])) {
				var obj = new Object();
				obj["key"] = cookies[i]["k"];
				obj["value"] = cookies[i]["v"];
				obj["expires"] = new Date(cookies[i]["e"]);
				res.push(obj);
			}
		}
		return res;
	},
	remove : function(key) {
		this.set(key,"",{ms:-1},true);		
	},
	removeAll : function() {
		deleteCookie("nano");
	},
	//
	// gets from cookie called "nano" ; alternatively you 
	// can pass it your own cookie and it'll deserialize that
	deserialize : function(nano_cookie_str) {

		var x = nano_cookie_str ? nano_cookie_str : getCookie("nano");
		
		var result = [];
		if (! x)
			return result;
		else {
			var individuals = x.split("|");
			for (var i = 0; i < individuals.length; i++) {
				var obj = new Object();
				var pairs = individuals[i].split(",");
				for (var j = 0; j < pairs.length; j++) {
					var pair = pairs[j].split("=");
					var val = unescape(pair[1]);
					var pval = parseInt(val);
					if (pval == val && ! isNaN(pval))
						val = pval;
					obj[pair[0]] = val;
				}
				result.push(obj);				
			}
			result.sort(this.compareDates);
			// 
			var d = new Date();
			var any_stripped = false;
			while(result.length > 0 && new Date(result[result.length - 1]["e"]) < d) {
				result.length--;
				any_stripped = true;
			}
			return result;
		}
	},
	// 
	serializeAndStore : function(cookies) {
		var res = "";
		for (var i = 0; i < cookies.length; i++) {
			res += (i == 0) ? "" : "|";
			res += "k=" + escape(cookies[i]["k"]);
			res += ",e=" + escape(cookies[i]["e"]);
			res += ",v=" + escape(cookies[i]["v"]);
		}
		setCookie("nano", res, secondsFromNow(3600*24*365));
	},
	compareDates : function(a,b) {
		if (a["e"] && b["e"])
			return ((a["e"] < b["e"]) ? 1 : ((a["e"] > b["e"]) ? -1 : 0));
	}
};
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/browser_detect.js
AUTOCORE_SELF_CHECK.push("browser_detect.js");
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/prototype-1.6.0.3.js
AUTOCORE_SELF_CHECK.push("prototype-1.6.0.3.js");
/*  Prototype JavaScript framework, version 1.6.0.3
 *  (c) 2005-2008 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/

var Prototype = {
  Version: '1.6.0.3',

  Browser: {
    IE:     !!(window.attachEvent &&
      navigator.userAgent.indexOf('Opera') === -1),
    Opera:  navigator.userAgent.indexOf('Opera') > -1,
    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 &&
      navigator.userAgent.indexOf('KHTML') === -1,
    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
  },

  BrowserFeatures: {
    XPath: !!document.evaluate,
    SelectorsAPI: !!document.querySelector,
    ElementExtensions: !!window.HTMLElement,
    SpecificElementExtensions:
      document.createElement('div')['__proto__'] &&
      document.createElement('div')['__proto__'] !==
        document.createElement('form')['__proto__']
  },

  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,

  emptyFunction: function() { },
  K: function(x) { return x }
};

if (Prototype.Browser.MobileSafari)
  Prototype.BrowserFeatures.SpecificElementExtensions = false;


/* Based on Alex Arnell's inheritance implementation. */
var Class = {
  create: function() {
    var parent = null, properties = $A(arguments);
    if (Object.isFunction(properties[0]))
      parent = properties.shift();

    function klass() {
      this.initialize.apply(this, arguments);
    }

    Object.extend(klass, Class.Methods);
    klass.superclass = parent;
    klass.subclasses = [];

    if (parent) {
      var subclass = function() { };
      subclass.prototype = parent.prototype;
      klass.prototype = new subclass;
      parent.subclasses.push(klass);
    }

    for (var i = 0; i < properties.length; i++)
      klass.addMethods(properties[i]);

    if (!klass.prototype.initialize)
      klass.prototype.initialize = Prototype.emptyFunction;

    klass.prototype.constructor = klass;

    return klass;
  }
};

Class.Methods = {
  addMethods: function(source) {
    var ancestor   = this.superclass && this.superclass.prototype;
    var properties = Object.keys(source);

    if (!Object.keys({ toString: true }).length)
      properties.push("toString", "valueOf");

    for (var i = 0, length = properties.length; i < length; i++) {
      var property = properties[i], value = source[property];
      if (ancestor && Object.isFunction(value) &&
          value.argumentNames().first() == "$super") {
        var method = value;
        value = (function(m) {
          return function() { return ancestor[m].apply(this, arguments) };
        })(property).wrap(method);

        value.valueOf = method.valueOf.bind(method);
        value.toString = method.toString.bind(method);
      }
      this.prototype[property] = value;
    }

    return this;
  }
};

var Abstract = { };

Object.extend = function(destination, source) {
  for (var property in source)
    destination[property] = source[property];
  return destination;
};

Object.extend(Object, {
  inspect: function(object) {
    try {
      if (Object.isUndefined(object)) return 'undefined';
      if (object === null) return 'null';
      return object.inspect ? object.inspect() : String(object);
    } catch (e) {
      if (e instanceof RangeError) return '...';
      throw e;
    }
  },

  toJSON: function(object) {
    var type = typeof object;
    switch (type) {
      case 'undefined':
      case 'function':
      case 'unknown': return;
      case 'boolean': return object.toString();
    }

    if (object === null) return 'null';
    if (object.toJSON) return object.toJSON();
    if (Object.isElement(object)) return;

    var results = [];
    for (var property in object) {
      var value = Object.toJSON(object[property]);
      if (!Object.isUndefined(value))
        results.push(property.toJSON() + ': ' + value);
    }

    return '{' + results.join(', ') + '}';
  },

  toQueryString: function(object) {
    return $H(object).toQueryString();
  },

  toHTML: function(object) {
    return object && object.toHTML ? object.toHTML() : String.interpret(object);
  },

  keys: function(object) {
    var keys = [];
    for (var property in object)
      keys.push(property);
    return keys;
  },

  values: function(object) {
    var values = [];
    for (var property in object)
      values.push(object[property]);
    return values;
  },

  clone: function(object) {
    return Object.extend({ }, object);
  },

  isElement: function(object) {
    return !!(object && object.nodeType == 1);
  },

  isArray: function(object) {
    return object != null && typeof object == "object" &&
      'splice' in object && 'join' in object;
  },

  isHash: function(object) {
    return object instanceof Hash;
  },

  isFunction: function(object) {
    return typeof object == "function";
  },

  isString: function(object) {
    return typeof object == "string";
  },

  isNumber: function(object) {
    return typeof object == "number";
  },

  isUndefined: function(object) {
    return typeof object == "undefined";
  }
});

Object.extend(Function.prototype, {
  argumentNames: function() {
    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
      .replace(/\s+/g, '').split(',');
    return names.length == 1 && !names[0] ? [] : names;
  },

  bind: function() {
    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
    var __method = this, args = $A(arguments), object = args.shift();
    return function() {
      return __method.apply(object, args.concat($A(arguments)));
    }
  },

  bindAsEventListener: function() {
    var __method = this, args = $A(arguments), object = args.shift();
    return function(event) {
      return __method.apply(object, [event || window.event].concat(args));
    }
  },

  curry: function() {
    if (!arguments.length) return this;
    var __method = this, args = $A(arguments);
    return function() {
      return __method.apply(this, args.concat($A(arguments)));
    }
  },

  delay: function() {
    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
    return window.setTimeout(function() {
      return __method.apply(__method, args);
    }, timeout);
  },

  defer: function() {
    var args = [0.01].concat($A(arguments));
    return this.delay.apply(this, args);
  },

  wrap: function(wrapper) {
    var __method = this;
    return function() {
      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
    }
  },

  methodize: function() {
    if (this._methodized) return this._methodized;
    var __method = this;
    return this._methodized = function() {
      return __method.apply(null, [this].concat($A(arguments)));
    };
  }
});

Date.prototype.toJSON = function() {
  return '"' + this.getUTCFullYear() + '-' +
    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
    this.getUTCDate().toPaddedString(2) + 'T' +
    this.getUTCHours().toPaddedString(2) + ':' +
    this.getUTCMinutes().toPaddedString(2) + ':' +
    this.getUTCSeconds().toPaddedString(2) + 'Z"';
};

var Try = {
  these: function() {
    var returnValue;

    for (var i = 0, length = arguments.length; i < length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) { }
    }

    return returnValue;
  }
};

RegExp.prototype.match = RegExp.prototype.test;

RegExp.escape = function(str) {
  return String(str).replace(/([.*+?^=!:{}$()|[\]\/\\])/g, '\\$1');
};

/*--------------------------------------------------------------------------*/

var PeriodicalExecuter = Class.create({
  initialize: function(callback, frequency) {
    this.callback = callback;
    this.frequency = frequency;
    this.currentlyExecuting = false;

    this.registerCallback();
  },

  registerCallback: function() {
    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  execute: function() {
    this.callback(this);
  },

  stop: function() {
    if (!this.timer) return;
    clearInterval(this.timer);
    this.timer = null;
  },

  onTimerEvent: function() {
    if (!this.currentlyExecuting) {
      try {
        this.currentlyExecuting = true;
        this.execute();
      } finally {
        this.currentlyExecuting = false;
      }
    }
  }
});
Object.extend(String, {
  interpret: function(value) {
    return value == null ? '' : String(value);
  },
  specialChar: {
    '\b': '\\b',
    '\t': '\\t',
    '\n': '\\n',
    '\f': '\\f',
    '\r': '\\r',
    '\\': '\\\\'
  }
});

Object.extend(String.prototype, {
  gsub: function(pattern, replacement) {
    var result = '', source = this, match;
    replacement = arguments.callee.prepareReplacement(replacement);

    while (source.length > 0) {
      if (match = source.match(pattern)) {
        result += source.slice(0, match.index);
        result += String.interpret(replacement(match));
        source  = source.slice(match.index + match[0].length);
      } else {
        result += source, source = '';
      }
    }
    return result;
  },

  sub: function(pattern, replacement, count) {
    replacement = this.gsub.prepareReplacement(replacement);
    count = Object.isUndefined(count) ? 1 : count;

    return this.gsub(pattern, function(match) {
      if (--count < 0) return match[0];
      return replacement(match);
    });
  },

  scan: function(pattern, iterator) {
    this.gsub(pattern, iterator);
    return String(this);
  },

  truncate: function(length, truncation) {
    length = length || 30;
    truncation = Object.isUndefined(truncation) ? '...' : truncation;
    return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : String(this);
  },

  strip: function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  },

  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  stripScripts: function() {
    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  },

  evalScripts: function() {
    return this.extractScripts().map(function(script) { return eval(script) });
  },

  escapeHTML: function() {
    var self = arguments.callee;
    self.text.data = this;
    return self.div.innerHTML;
  },

  unescapeHTML: function() {
    var div = new Element('div');
    div.innerHTML = this.stripTags();
    return div.childNodes[0] ? (div.childNodes.length > 1 ?
      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
      div.childNodes[0].nodeValue) : '';
  },

  toQueryParams: function(separator) {
    var match = this.strip().match(/([^?#]*)(#.*)?$/);
    if (!match) return { };

    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
      if ((pair = pair.split('='))[0]) {
        var key = decodeURIComponent(pair.shift());
        var value = pair.length > 1 ? pair.join('=') : pair[0];
        if (value != undefined) value = decodeURIComponent(value);

        if (key in hash) {
          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
          hash[key].push(value);
        }
        else hash[key] = value;
      }
      return hash;
    });
  },

  toArray: function() {
    return this.split('');
  },

  succ: function() {
    return this.slice(0, this.length - 1) +
      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
  },

  times: function(count) {
    return count < 1 ? '' : new Array(count + 1).join(this);
  },

  camelize: function() {
    var parts = this.split('-'), len = parts.length;
    if (len == 1) return parts[0];

    var camelized = this.charAt(0) == '-'
      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
      : parts[0];

    for (var i = 1; i < len; i++)
      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);

    return camelized;
  },

  capitalize: function() {
    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
  },

  underscore: function() {
    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
  },

  dasherize: function() {
    return this.gsub(/_/,'-');
  },

  inspect: function(useDoubleQuotes) {
    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
      var character = String.specialChar[match[0]];
      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
    });
    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
  },

  toJSON: function() {
    return this.inspect(true);
  },

  unfilterJSON: function(filter) {
    return this.sub(filter || Prototype.JSONFilter, '#{1}');
  },

  isJSON: function() {
    var str = this;
    if (str.blank()) return false;
    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
  },

  evalJSON: function(sanitize) {
    var json = this.unfilterJSON();
    try {
      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
    } catch (e) { }
    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
  },

  include: function(pattern) {
    return this.indexOf(pattern) > -1;
  },

  startsWith: function(pattern) {
    return this.indexOf(pattern) === 0;
  },

  endsWith: function(pattern) {
    var d = this.length - pattern.length;
    return d >= 0 && this.lastIndexOf(pattern) === d;
  },

  empty: function() {
    return this == '';
  },

  blank: function() {
    return /^\s*$/.test(this);
  },

  interpolate: function(object, pattern) {
    return new Template(this, pattern).evaluate(object);
  }
});

if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
  escapeHTML: function() {
    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  },
  unescapeHTML: function() {
    return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
  }
});

String.prototype.gsub.prepareReplacement = function(replacement) {
  if (Object.isFunction(replacement)) return replacement;
  var template = new Template(replacement);
  return function(match) { return template.evaluate(match) };
};

String.prototype.parseQuery = String.prototype.toQueryParams;

Object.extend(String.prototype.escapeHTML, {
  div:  document.createElement('div'),
  text: document.createTextNode('')
});

String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);

var Template = Class.create({
  initialize: function(template, pattern) {
    this.template = template.toString();
    this.pattern = pattern || Template.Pattern;
  },

  evaluate: function(object) {
    if (Object.isFunction(object.toTemplateReplacements))
      object = object.toTemplateReplacements();

    return this.template.gsub(this.pattern, function(match) {
      if (object == null) return '';

      var before = match[1] || '';
      if (before == '\\') return match[2];

      var ctx = object, expr = match[3];
      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
      match = pattern.exec(expr);
      if (match == null) return before;

      while (match != null) {
        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
        ctx = ctx[comp];
        if (null == ctx || '' == match[3]) break;
        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
        match = pattern.exec(expr);
      }

      return before + String.interpret(ctx);
    });
  }
});
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;

var $break = { };

var Enumerable = {
  each: function(iterator, context) {
    var index = 0;
    try {
      this._each(function(value) {
        iterator.call(context, value, index++);
      });
    } catch (e) {
      if (e != $break) throw e;
    }
    return this;
  },

  eachSlice: function(number, iterator, context) {
    var index = -number, slices = [], array = this.toArray();
    if (number < 1) return array;
    while ((index += number) < array.length)
      slices.push(array.slice(index, index+number));
    return slices.collect(iterator, context);
  },

  all: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result = true;
    this.each(function(value, index) {
      result = result && !!iterator.call(context, value, index);
      if (!result) throw $break;
    });
    return result;
  },

  any: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result = false;
    this.each(function(value, index) {
      if (result = !!iterator.call(context, value, index))
        throw $break;
    });
    return result;
  },

  collect: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var results = [];
    this.each(function(value, index) {
      results.push(iterator.call(context, value, index));
    });
    return results;
  },

  detect: function(iterator, context) {
    var result;
    this.each(function(value, index) {
      if (iterator.call(context, value, index)) {
        result = value;
        throw $break;
      }
    });
    return result;
  },

  findAll: function(iterator, context) {
    var results = [];
    this.each(function(value, index) {
      if (iterator.call(context, value, index))
        results.push(value);
    });
    return results;
  },

  grep: function(filter, iterator, context) {
    iterator = iterator || Prototype.K;
    var results = [];

    if (Object.isString(filter))
      filter = new RegExp(filter);

    this.each(function(value, index) {
      if (filter.match(value))
        results.push(iterator.call(context, value, index));
    });
    return results;
  },

  include: function(object) {
    if (Object.isFunction(this.indexOf))
      if (this.indexOf(object) != -1) return true;

    var found = false;
    this.each(function(value) {
      if (value == object) {
        found = true;
        throw $break;
      }
    });
    return found;
  },

  inGroupsOf: function(number, fillWith) {
    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
    return this.eachSlice(number, function(slice) {
      while(slice.length < number) slice.push(fillWith);
      return slice;
    });
  },

  inject: function(memo, iterator, context) {
    this.each(function(value, index) {
      memo = iterator.call(context, memo, value, index);
    });
    return memo;
  },

  invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.map(function(value) {
      return value[method].apply(value, args);
    });
  },

  max: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result;
    this.each(function(value, index) {
      value = iterator.call(context, value, index);
      if (result == null || value >= result)
        result = value;
    });
    return result;
  },

  min: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result;
    this.each(function(value, index) {
      value = iterator.call(context, value, index);
      if (result == null || value < result)
        result = value;
    });
    return result;
  },

  partition: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var trues = [], falses = [];
    this.each(function(value, index) {
      (iterator.call(context, value, index) ?
        trues : falses).push(value);
    });
    return [trues, falses];
  },

  pluck: function(property) {
    var results = [];
    this.each(function(value) {
      results.push(value[property]);
    });
    return results;
  },

  reject: function(iterator, context) {
    var results = [];
    this.each(function(value, index) {
      if (!iterator.call(context, value, index))
        results.push(value);
    });
    return results;
  },

  sortBy: function(iterator, context) {
    return this.map(function(value, index) {
      return {
        value: value,
        criteria: iterator.call(context, value, index)
      };
    }).sort(function(left, right) {
      var a = left.criteria, b = right.criteria;
      return a < b ? -1 : a > b ? 1 : 0;
    }).pluck('value');
  },

  toArray: function() {
    return this.map();
  },

  zip: function() {
    var iterator = Prototype.K, args = $A(arguments);
    if (Object.isFunction(args.last()))
      iterator = args.pop();

    var collections = [this].concat(args).map($A);
    return this.map(function(value, index) {
      return iterator(collections.pluck(index));
    });
  },

  size: function() {
    return this.toArray().length;
  },

  inspect: function() {
    return '#<Enumerable:' + this.toArray().inspect() + '>';
  }
};

Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  filter:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray,
  every:   Enumerable.all,
  some:    Enumerable.any
});
function $A(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) return iterable.toArray();
  var length = iterable.length || 0, results = new Array(length);
  while (length--) results[length] = iterable[length];
  return results;
}

if (Prototype.Browser.WebKit) {
  $A = function(iterable) {
    if (!iterable) return [];
    // In Safari, only use the `toArray` method if it's not a NodeList.
    // A NodeList is a function, has an function `item` property, and a numeric
    // `length` property. Adapted from Google Doctype.
    if (!(typeof iterable === 'function' && typeof iterable.length ===
        'number' && typeof iterable.item === 'function') && iterable.toArray)
      return iterable.toArray();
    var length = iterable.length || 0, results = new Array(length);
    while (length--) results[length] = iterable[length];
    return results;
  };
}

Array.from = $A;

Object.extend(Array.prototype, Enumerable);

if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;

Object.extend(Array.prototype, {
  _each: function(iterator) {
    for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(Object.isArray(value) ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },

  reduce: function() {
    return this.length > 1 ? this : this[0];
  },

  uniq: function(sorted) {
    return this.inject([], function(array, value, index) {
      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
        array.push(value);
      return array;
    });
  },

  intersect: function(array) {
    return this.uniq().findAll(function(item) {
      return array.detect(function(value) { return item === value });
    });
  },

  clone: function() {
    return [].concat(this);
  },

  size: function() {
    return this.length;
  },

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  },

  toJSON: function() {
    var results = [];
    this.each(function(object) {
      var value = Object.toJSON(object);
      if (!Object.isUndefined(value)) results.push(value);
    });
    return '[' + results.join(', ') + ']';
  }
});

// use native browser JS 1.6 implementation if available
if (Object.isFunction(Array.prototype.forEach))
  Array.prototype._each = Array.prototype.forEach;

if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
  i || (i = 0);
  var length = this.length;
  if (i < 0) i = length + i;
  for (; i < length; i++)
    if (this[i] === item) return i;
  return -1;
};

if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
  var n = this.slice(0, i).reverse().indexOf(item);
  return (n < 0) ? n : i - n - 1;
};

Array.prototype.toArray = Array.prototype.clone;

function $w(string) {
  if (!Object.isString(string)) return [];
  string = string.strip();
  return string ? string.split(/\s+/) : [];
}

if (Prototype.Browser.Opera){
  Array.prototype.concat = function() {
    var array = [];
    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
    for (var i = 0, length = arguments.length; i < length; i++) {
      if (Object.isArray(arguments[i])) {
        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
          array.push(arguments[i][j]);
      } else {
        array.push(arguments[i]);
      }
    }
    return array;
  };
}
Object.extend(Number.prototype, {
  toColorPart: function() {
    return this.toPaddedString(2, 16);
  },

  succ: function() {
    return this + 1;
  },

  times: function(iterator, context) {
    $R(0, this, true).each(iterator, context);
    return this;
  },

  toPaddedString: function(length, radix) {
    var string = this.toString(radix || 10);
    return '0'.times(length - string.length) + string;
  },

  toJSON: function() {
    return isFinite(this) ? this.toString() : 'null';
  }
});

$w('abs round ceil floor').each(function(method){
  Number.prototype[method] = Math[method].methodize();
});
function $H(object) {
  return new Hash(object);
};

var Hash = Class.create(Enumerable, (function() {

  function toQueryPair(key, value) {
    if (Object.isUndefined(value)) return key;
    return key + '=' + encodeURIComponent(String.interpret(value));
  }

  return {
    initialize: function(object) {
      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
    },

    _each: function(iterator) {
      for (var key in this._object) {
        var value = this._object[key], pair = [key, value];
        pair.key = key;
        pair.value = value;
        iterator(pair);
      }
    },

    set: function(key, value) {
      return this._object[key] = value;
    },

    get: function(key) {
      // simulating poorly supported hasOwnProperty
      if (this._object[key] !== Object.prototype[key])
        return this._object[key];
    },

    unset: function(key) {
      var value = this._object[key];
      delete this._object[key];
      return value;
    },

    toObject: function() {
      return Object.clone(this._object);
    },

    keys: function() {
      return this.pluck('key');
    },

    values: function() {
      return this.pluck('value');
    },

    index: function(value) {
      var match = this.detect(function(pair) {
        return pair.value === value;
      });
      return match && match.key;
    },

    merge: function(object) {
      return this.clone().update(object);
    },

    update: function(object) {
      return new Hash(object).inject(this, function(result, pair) {
        result.set(pair.key, pair.value);
        return result;
      });
    },

    toQueryString: function() {
      return this.inject([], function(results, pair) {
        var key = encodeURIComponent(pair.key), values = pair.value;

        if (values && typeof values == 'object') {
          if (Object.isArray(values))
            return results.concat(values.map(toQueryPair.curry(key)));
        } else results.push(toQueryPair(key, values));
        return results;
      }).join('&');
    },

    inspect: function() {
      return '#<Hash:{' + this.map(function(pair) {
        return pair.map(Object.inspect).join(': ');
      }).join(', ') + '}>';
    },

    toJSON: function() {
      return Object.toJSON(this.toObject());
    },

    clone: function() {
      return new Hash(this);
    }
  }
})());

Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
Hash.from = $H;
var ObjectRange = Class.create(Enumerable, {
  initialize: function(start, end, exclusive) {
    this.start = start;
    this.end = end;
    this.exclusive = exclusive;
  },

  _each: function(iterator) {
    var value = this.start;
    while (this.include(value)) {
      iterator(value);
      value = value.succ();
    }
  },

  include: function(value) {
    if (value < this.start)
      return false;
    if (this.exclusive)
      return value < this.end;
    return value <= this.end;
  }
});

var $R = function(start, end, exclusive) {
  return new ObjectRange(start, end, exclusive);
};

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ) || false;
  },

  activeRequestCount: 0
};

Ajax.Responders = {
  responders: [],

  _each: function(iterator) {
    this.responders._each(iterator);
  },

  register: function(responder) {
    if (!this.include(responder))
      this.responders.push(responder);
  },

  unregister: function(responder) {
    this.responders = this.responders.without(responder);
  },

  dispatch: function(callback, request, transport, json) {
    this.each(function(responder) {
      if (Object.isFunction(responder[callback])) {
        try {
          responder[callback].apply(responder, [request, transport, json]);
        } catch (e) { }
      }
    });
  }
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
  onCreate:   function() { Ajax.activeRequestCount++ },
  onComplete: function() { Ajax.activeRequestCount-- }
});

Ajax.Base = Class.create({
  initialize: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      encoding:     'UTF-8',
      parameters:   '',
      evalJSON:     true,
      evalJS:       true
    };
    Object.extend(this.options, options || { });

    this.options.method = this.options.method.toLowerCase();

    if (Object.isString(this.options.parameters))
      this.options.parameters = this.options.parameters.toQueryParams();
    else if (Object.isHash(this.options.parameters))
      this.options.parameters = this.options.parameters.toObject();
  }
});

Ajax.Request = Class.create(Ajax.Base, {
  _complete: false,

  initialize: function($super, url, options) {
    $super(options);
    this.transport = Ajax.getTransport();
    this.request(url);
  },

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = Object.clone(this.options.parameters);

    if (!['get', 'post'].include(this.method)) {
      // simulate other verbs over post
      params['_method'] = this.method;
      this.method = 'post';
    }

    this.parameters = params;

    if (params = Object.toQueryString(params)) {
      // when GET, append parameters to URL
      if (this.method == 'get')
        this.url += (this.url.include('?') ? '&' : '?') + params;
      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
        params += '&_=';
    }

    try {
      var response = new Ajax.Response(this);
      if (this.options.onCreate) this.options.onCreate(response);
      Ajax.Responders.dispatch('onCreate', this, response);

      this.transport.open(this.method.toUpperCase(), this.url,
        this.options.asynchronous);

      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);

      this.transport.onreadystatechange = this.onStateChange.bind(this);
      this.setRequestHeaders();

      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
      this.transport.send(this.body);

      /* Force Firefox to handle ready state 4 for synchronous requests */
      if (!this.options.asynchronous && this.transport.overrideMimeType)
        this.onStateChange();

    }
    catch (e) {
      this.dispatchException(e);
    }
  },

  onStateChange: function() {
    var readyState = this.transport.readyState;
    if (readyState > 1 && !((readyState == 4) && this._complete))
      this.respondToReadyState(this.transport.readyState);
  },

  setRequestHeaders: function() {
    var headers = {
      'X-Requested-With': 'XMLHttpRequest',
      'X-Prototype-Version': Prototype.Version,
      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    };

    if (this.method == 'post') {
      headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

      /* Force "Connection: close" for older Mozilla browsers to work
       * around a bug where XMLHttpRequest sends an incorrect
       * Content-length header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
            headers['Connection'] = 'close';
    }

    // user-defined headers
    if (typeof this.options.requestHeaders == 'object') {
      var extras = this.options.requestHeaders;

      if (Object.isFunction(extras.push))
        for (var i = 0, length = extras.length; i < length; i += 2)
          headers[extras[i]] = extras[i+1];
      else
        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
    }

    for (var name in headers)
      this.transport.setRequestHeader(name, headers[name]);
  },

  success: function() {
    var status = this.getStatus();
    return !status || (status >= 200 && status < 300);
  },

  getStatus: function() {
    try {
      return this.transport.status || 0;
    } catch (e) { return 0 }
  },

  respondToReadyState: function(readyState) {
    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);

    if (state == 'Complete') {
      try {
        this._complete = true;
        (this.options['on' + response.status]
         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(response, response.headerJSON);
      } catch (e) {
        this.dispatchException(e);
      }

      var contentType = response.getHeader('Content-type');
      if (this.options.evalJS == 'force'
          || (this.options.evalJS && this.isSameOrigin() && contentType
          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
        this.evalResponse();
    }

    try {
      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
    } catch (e) {
      this.dispatchException(e);
    }

    if (state == 'Complete') {
      // avoid memory leak in MSIE: clean up
      this.transport.onreadystatechange = Prototype.emptyFunction;
    }
  },

  isSameOrigin: function() {
    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
      protocol: location.protocol,
      domain: document.domain,
      port: location.port ? ':' + location.port : ''
    }));
  },

  getHeader: function(name) {
    try {
      return this.transport.getResponseHeader(name) || null;
    } catch (e) { return null }
  },

  evalResponse: function() {
    try {
      return eval((this.transport.responseText || '').unfilterJSON());
    } catch (e) {
      this.dispatchException(e);
    }
  },

  dispatchException: function(exception) {
    (this.options.onException || Prototype.emptyFunction)(this, exception);
    Ajax.Responders.dispatch('onException', this, exception);
  }
});

Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];

Ajax.Response = Class.create({
  initialize: function(request){
    this.request = request;
    var transport  = this.transport  = request.transport,
        readyState = this.readyState = transport.readyState;

    if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
      this.status       = this.getStatus();
      this.statusText   = this.getStatusText();
      this.responseText = String.interpret(transport.responseText);
      this.headerJSON   = this._getHeaderJSON();
    }

    if(readyState == 4) {
      var xml = transport.responseXML;
      this.responseXML  = Object.isUndefined(xml) ? null : xml;
      this.responseJSON = this._getResponseJSON();
    }
  },

  status:      0,
  statusText: '',

  getStatus: Ajax.Request.prototype.getStatus,

  getStatusText: function() {
    try {
      return this.transport.statusText || '';
    } catch (e) { return '' }
  },

  getHeader: Ajax.Request.prototype.getHeader,

  getAllHeaders: function() {
    try {
      return this.getAllResponseHeaders();
    } catch (e) { return null }
  },

  getResponseHeader: function(name) {
    return this.transport.getResponseHeader(name);
  },

  getAllResponseHeaders: function() {
    return this.transport.getAllResponseHeaders();
  },

  _getHeaderJSON: function() {
    var json = this.getHeader('X-JSON');
    if (!json) return null;
    json = decodeURIComponent(escape(json));
    try {
      return json.evalJSON(this.request.options.sanitizeJSON ||
        !this.request.isSameOrigin());
    } catch (e) {
      this.request.dispatchException(e);
    }
  },

  _getResponseJSON: function() {
    var options = this.request.options;
    if (!options.evalJSON || (options.evalJSON != 'force' &&
      !(this.getHeader('Content-type') || '').include('application/json')) ||
        this.responseText.blank())
          return null;
    try {
      return this.responseText.evalJSON(options.sanitizeJSON ||
        !this.request.isSameOrigin());
    } catch (e) {
      this.request.dispatchException(e);
    }
  }
});

Ajax.Updater = Class.create(Ajax.Request, {
  initialize: function($super, container, url, options) {
    this.container = {
      success: (container.success || container),
      failure: (container.failure || (container.success ? null : container))
    };

    options = Object.clone(options);
    var onComplete = options.onComplete;
    options.onComplete = (function(response, json) {
      this.updateContent(response.responseText);
      if (Object.isFunction(onComplete)) onComplete(response, json);
    }).bind(this);

    $super(url, options);
  },

  updateContent: function(responseText) {
    var receiver = this.container[this.success() ? 'success' : 'failure'],
        options = this.options;

    if (!options.evalScripts) responseText = responseText.stripScripts();

    if (receiver = $(receiver)) {
      if (options.insertion) {
        if (Object.isString(options.insertion)) {
          var insertion = { }; insertion[options.insertion] = responseText;
          receiver.insert(insertion);
        }
        else options.insertion(receiver, responseText);
      }
      else receiver.update(responseText);
    }
  }
});

Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
  initialize: function($super, container, url, options) {
    $super(options);
    this.onComplete = this.options.onComplete;

    this.frequency = (this.options.frequency || 2);
    this.decay = (this.options.decay || 1);

    this.updater = { };
    this.container = container;
    this.url = url;

    this.start();
  },

  start: function() {
    this.options.onComplete = this.updateComplete.bind(this);
    this.onTimerEvent();
  },

  stop: function() {
    this.updater.options.onComplete = undefined;
    clearTimeout(this.timer);
    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
  },

  updateComplete: function(response) {
    if (this.options.decay) {
      this.decay = (response.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

      this.lastText = response.responseText;
    }
    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
  },

  onTimerEvent: function() {
    this.updater = new Ajax.Updater(this.container, this.url, this.options);
  }
});
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (Object.isString(element))
    element = document.getElementById(element);
  return Element.extend(element);
}

if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(Element.extend(query.snapshotItem(i)));
    return results;
  };
}

/*--------------------------------------------------------------------------*/

if (!window.Node) var Node = { };

if (!Node.ELEMENT_NODE) {
  // DOM level 2 ECMAScript Language Binding
  Object.extend(Node, {
    ELEMENT_NODE: 1,
    ATTRIBUTE_NODE: 2,
    TEXT_NODE: 3,
    CDATA_SECTION_NODE: 4,
    ENTITY_REFERENCE_NODE: 5,
    ENTITY_NODE: 6,
    PROCESSING_INSTRUCTION_NODE: 7,
    COMMENT_NODE: 8,
    DOCUMENT_NODE: 9,
    DOCUMENT_TYPE_NODE: 10,
    DOCUMENT_FRAGMENT_NODE: 11,
    NOTATION_NODE: 12
  });
}

(function() {
  var element = this.Element;
  this.Element = function(tagName, attributes) {
    attributes = attributes || { };
    tagName = tagName.toLowerCase();
    var cache = Element.cache;
    if (Prototype.Browser.IE && attributes.name) {
      tagName = '<' + tagName + ' name="' + attributes.name + '">';
      delete attributes.name;
      return Element.writeAttribute(document.createElement(tagName), attributes);
    }
    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
  };
  Object.extend(this.Element, element || { });
  if (element) this.Element.prototype = element.prototype;
}).call(window);

Element.cache = { };

Element.Methods = {
  visible: function(element) {
    return $(element).style.display != 'none';
  },

  toggle: function(element) {
    element = $(element);
    Element[Element.visible(element) ? 'hide' : 'show'](element);
    return element;
  },

  hide: function(element) {
    element = $(element);
    element.style.display = 'none';
    return element;
  },

  show: function(element) {
    element = $(element);
    element.style.display = '';
    return element;
  },

  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
    return element;
  },

  update: function(element, content) {
    element = $(element);
    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) return element.update().insert(content);
    content = Object.toHTML(content);
    element.innerHTML = content.stripScripts();
    content.evalScripts.bind(content).defer();
    return element;
  },

  replace: function(element, content) {
    element = $(element);
    if (content && content.toElement) content = content.toElement();
    else if (!Object.isElement(content)) {
      content = Object.toHTML(content);
      var range = element.ownerDocument.createRange();
      range.selectNode(element);
      content.evalScripts.bind(content).defer();
      content = range.createContextualFragment(content.stripScripts());
    }
    element.parentNode.replaceChild(content, element);
    return element;
  },

  insert: function(element, insertions) {
    element = $(element);

    if (Object.isString(insertions) || Object.isNumber(insertions) ||
        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
          insertions = {bottom:insertions};

    var content, insert, tagName, childNodes;

    for (var position in insertions) {
      content  = insertions[position];
      position = position.toLowerCase();
      insert = Element._insertionTranslations[position];

      if (content && content.toElement) content = content.toElement();
      if (Object.isElement(content)) {
        insert(element, content);
        continue;
      }

      content = Object.toHTML(content);

      tagName = ((position == 'before' || position == 'after')
        ? element.parentNode : element).tagName.toUpperCase();

      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());

      if (position == 'top' || position == 'after') childNodes.reverse();
      childNodes.each(insert.curry(element));

      content.evalScripts.bind(content).defer();
    }

    return element;
  },

  wrap: function(element, wrapper, attributes) {
    element = $(element);
    if (Object.isElement(wrapper))
      $(wrapper).writeAttribute(attributes || { });
    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
    else wrapper = new Element('div', wrapper);
    if (element.parentNode)
      element.parentNode.replaceChild(wrapper, element);
    wrapper.appendChild(element);
    return wrapper;
  },

  inspect: function(element) {
    element = $(element);
    var result = '<' + element.tagName.toLowerCase();
    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
      var property = pair.first(), attribute = pair.last();
      var value = (element[property] || '').toString();
      if (value) result += ' ' + attribute + '=' + value.inspect(true);
    });
    return result + '>';
  },

  recursivelyCollect: function(element, property) {
    element = $(element);
    var elements = [];
    while (element = element[property])
      if (element.nodeType == 1)
        elements.push(Element.extend(element));
    return elements;
  },

  ancestors: function(element) {
    return $(element).recursivelyCollect('parentNode');
  },

  descendants: function(element) {
    return $(element).select("*");
  },

  firstDescendant: function(element) {
    element = $(element).firstChild;
    while (element && element.nodeType != 1) element = element.nextSibling;
    return $(element);
  },

  immediateDescendants: function(element) {
    if (!(element = $(element).firstChild)) return [];
    while (element && element.nodeType != 1) element = element.nextSibling;
    if (element) return [element].concat($(element).nextSiblings());
    return [];
  },

  previousSiblings: function(element) {
    return $(element).recursivelyCollect('previousSibling');
  },

  nextSiblings: function(element) {
    return $(element).recursivelyCollect('nextSibling');
  },

  siblings: function(element) {
    element = $(element);
    return element.previousSiblings().reverse().concat(element.nextSiblings());
  },

  match: function(element, selector) {
    if (Object.isString(selector))
      selector = new Selector(selector);
    return selector.match($(element));
  },

  up: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(element.parentNode);
    var ancestors = element.ancestors();
    return Object.isNumber(expression) ? ancestors[expression] :
      Selector.findElement(ancestors, expression, index);
  },

  down: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return element.firstDescendant();
    return Object.isNumber(expression) ? element.descendants()[expression] :
      Element.select(element, expression)[index || 0];
  },

  previous: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
    var previousSiblings = element.previousSiblings();
    return Object.isNumber(expression) ? previousSiblings[expression] :
      Selector.findElement(previousSiblings, expression, index);
  },

  next: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
    var nextSiblings = element.nextSiblings();
    return Object.isNumber(expression) ? nextSiblings[expression] :
      Selector.findElement(nextSiblings, expression, index);
  },

  select: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element, args);
  },

  adjacent: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element.parentNode, args).without(element);
  },

  identify: function(element) {
    element = $(element);
    var id = element.readAttribute('id'), self = arguments.callee;
    if (id) return id;
    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
    element.writeAttribute('id', id);
    return id;
  },

  readAttribute: function(element, name) {
    element = $(element);
    if (Prototype.Browser.IE) {
      var t = Element._attributeTranslations.read;
      if (t.values[name]) return t.values[name](element, name);
      if (t.names[name]) name = t.names[name];
      if (name.include(':')) {
        return (!element.attributes || !element.attributes[name]) ? null :
         element.attributes[name].value;
      }
    }
    return element.getAttribute(name);
  },

  writeAttribute: function(element, name, value) {
    element = $(element);
    var attributes = { }, t = Element._attributeTranslations.write;

    if (typeof name == 'object') attributes = name;
    else attributes[name] = Object.isUndefined(value) ? true : value;

    for (var attr in attributes) {
      name = t.names[attr] || attr;
      value = attributes[attr];
      if (t.values[attr]) name = t.values[attr](element, value);
      if (value === false || value === null)
        element.removeAttribute(name);
      else if (value === true)
        element.setAttribute(name, name);
      else element.setAttribute(name, value);
    }
    return element;
  },

  getHeight: function(element) {
    return $(element).getDimensions().height;
  },

  getWidth: function(element) {
    return $(element).getDimensions().width;
  },

  classNames: function(element) {
    return new Element.ClassNames(element);
  },

  hasClassName: function(element, className) {
    if (!(element = $(element))) return;
    var elementClassName = element.className;
    return (elementClassName.length > 0 && (elementClassName == className ||
      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
  },

  addClassName: function(element, className) {
    if (!(element = $(element))) return;
    if (!element.hasClassName(className))
      element.className += (element.className ? ' ' : '') + className;
    return element;
  },

  removeClassName: function(element, className) {
    if (!(element = $(element))) return;
    element.className = element.className.replace(
      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
    return element;
  },

  toggleClassName: function(element, className) {
    if (!(element = $(element))) return;
    return element[element.hasClassName(className) ?
      'removeClassName' : 'addClassName'](className);
  },

  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  },

  empty: function(element) {
    return $(element).innerHTML.blank();
  },

  descendantOf: function(element, ancestor) {
    element = $(element), ancestor = $(ancestor);

    if (element.compareDocumentPosition)
      return (element.compareDocumentPosition(ancestor) & 8) === 8;

    if (ancestor.contains)
      return ancestor.contains(element) && ancestor !== element;

    while (element = element.parentNode)
      if (element == ancestor) return true;

    return false;
  },

  scrollTo: function(element) {
    element = $(element);
    var pos = element.cumulativeOffset();
    window.scrollTo(pos[0], pos[1]);
    return element;
  },

  getStyle: function(element, style) {
    element = $(element);
    style = style == 'float' ? 'cssFloat' : style.camelize();
    var value = element.style[style];
    if (!value || value == 'auto') {
      var css = document.defaultView.getComputedStyle(element, null);
      value = css ? css[style] : null;
    }
    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
    return value == 'auto' ? null : value;
  },

  getOpacity: function(element) {
    return $(element).getStyle('opacity');
  },

  setStyle: function(element, styles) {
    element = $(element);
    var elementStyle = element.style, match;
    if (Object.isString(styles)) {
      element.style.cssText += ';' + styles;
      return styles.include('opacity') ?
        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
    }
    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property]);
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ?
          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
            property] = styles[property];

    return element;
  },

  setOpacity: function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;
    return element;
  },

  getDimensions: function(element) {
    element = $(element);
    var display = element.getStyle('display');
    if (display != 'none' && display != null) // Safari bug
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
  },

  makePositioned: function(element) {
    element = $(element);
    var pos = Element.getStyle(element, 'position');
    if (pos == 'static' || !pos) {
      element._madePositioned = true;
      element.style.position = 'relative';
      // Opera returns the offset relative to the positioning context, when an
      // element is position relative but top and left have not been defined
      if (Prototype.Browser.Opera) {
        element.style.top = 0;
        element.style.left = 0;
      }
    }
    return element;
  },

  undoPositioned: function(element) {
    element = $(element);
    if (element._madePositioned) {
      element._madePositioned = undefined;
      element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
    }
    return element;
  },

  makeClipping: function(element) {
    element = $(element);
    if (element._overflow) return element;
    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
    if (element._overflow !== 'hidden')
      element.style.overflow = 'hidden';
    return element;
  },

  undoClipping: function(element) {
    element = $(element);
    if (!element._overflow) return element;
    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
    element._overflow = null;
    return element;
  },

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        if (element.tagName.toUpperCase() == 'BODY') break;
        var p = Element.getStyle(element, 'position');
        if (p !== 'static') break;
      }
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  absolutize: function(element) {
    element = $(element);
    if (element.getStyle('position') == 'absolute') return element;
    // Position.prepare(); // To be done manually by Scripty when it needs it.

    var offsets = element.positionedOffset();
    var top     = offsets[1];
    var left    = offsets[0];
    var width   = element.clientWidth;
    var height  = element.clientHeight;

    element._originalLeft   = left - parseFloat(element.style.left  || 0);
    element._originalTop    = top  - parseFloat(element.style.top || 0);
    element._originalWidth  = element.style.width;
    element._originalHeight = element.style.height;

    element.style.position = 'absolute';
    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.width  = width + 'px';
    element.style.height = height + 'px';
    return element;
  },

  relativize: function(element) {
    element = $(element);
    if (element.getStyle('position') == 'relative') return element;
    // Position.prepare(); // To be done manually by Scripty when it needs it.

    element.style.position = 'relative';
    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.height = element._originalHeight;
    element.style.width  = element._originalWidth;
    return element;
  },

  cumulativeScrollOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  getOffsetParent: function(element) {
    if (element.offsetParent) return $(element.offsetParent);
    if (element == document.body) return $(element);

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return $(element);

    return $(document.body);
  },

  viewportOffset: function(forElement) {
    var valueT = 0, valueL = 0;

    var element = forElement;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;

      // Safari fix
      if (element.offsetParent == document.body &&
        Element.getStyle(element, 'position') == 'absolute') break;

    } while (element = element.offsetParent);

    element = forElement;
    do {
      if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
        valueT -= element.scrollTop  || 0;
        valueL -= element.scrollLeft || 0;
      }
    } while (element = element.parentNode);

    return Element._returnOffset(valueL, valueT);
  },

  clonePosition: function(element, source) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
      setHeight:  true,
      offsetTop:  0,
      offsetLeft: 0
    }, arguments[2] || { });

    // find page position of source
    source = $(source);
    var p = source.viewportOffset();

    // find coordinate system to use
    element = $(element);
    var delta = [0, 0];
    var parent = null;
    // delta [0,0] will do fine with position: fixed elements,
    // position:absolute needs offsetParent deltas
    if (Element.getStyle(element, 'position') == 'absolute') {
      parent = element.getOffsetParent();
      delta = parent.viewportOffset();
    }

    // correct by body offsets (fixes Safari)
    if (parent == document.body) {
      delta[0] -= document.body.offsetLeft;
      delta[1] -= document.body.offsetTop;
    }

    // set position
    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
    return element;
  }
};

Element.Methods.identify.counter = 1;

Object.extend(Element.Methods, {
  getElementsBySelector: Element.Methods.select,
  childElements: Element.Methods.immediateDescendants
});

Element._attributeTranslations = {
  write: {
    names: {
      className: 'class',
      htmlFor:   'for'
    },
    values: { }
  }
};

if (Prototype.Browser.Opera) {
  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
    function(proceed, element, style) {
      switch (style) {
        case 'left': case 'top': case 'right': case 'bottom':
          if (proceed(element, 'position') === 'static') return null;
        case 'height': case 'width':
          // returns '0px' for hidden elements; we want it to return null
          if (!Element.visible(element)) return null;

          // returns the border-box dimensions rather than the content-box
          // dimensions, so we subtract padding and borders from the value
          var dim = parseInt(proceed(element, style), 10);

          if (dim !== element['offset' + style.capitalize()])
            return dim + 'px';

          var properties;
          if (style === 'height') {
            properties = ['border-top-width', 'padding-top',
             'padding-bottom', 'border-bottom-width'];
          }
          else {
            properties = ['border-left-width', 'padding-left',
             'padding-right', 'border-right-width'];
          }
          return properties.inject(dim, function(memo, property) {
            var val = proceed(element, property);
            return val === null ? memo : memo - parseInt(val, 10);
          }) + 'px';
        default: return proceed(element, style);
      }
    }
  );

  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
    function(proceed, element, attribute) {
      if (attribute === 'title') return element.title;
      return proceed(element, attribute);
    }
  );
}

else if (Prototype.Browser.IE) {
  // IE doesn't report offsets correctly for static elements, so we change them
  // to "relative" to get the values, then change them back.
  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
    function(proceed, element) {
      element = $(element);
      // IE throws an error if element is not in document
      try { element.offsetParent }
      catch(e) { return $(document.body) }
      var position = element.getStyle('position');
      if (position !== 'static') return proceed(element);
      element.setStyle({ position: 'relative' });
      var value = proceed(element);
      element.setStyle({ position: position });
      return value;
    }
  );

  $w('positionedOffset viewportOffset').each(function(method) {
    Element.Methods[method] = Element.Methods[method].wrap(
      function(proceed, element) {
        element = $(element);
        try { element.offsetParent }
        catch(e) { return Element._returnOffset(0,0) }
        var position = element.getStyle('position');
        if (position !== 'static') return proceed(element);
        // Trigger hasLayout on the offset parent so that IE6 reports
        // accurate offsetTop and offsetLeft values for position: fixed.
        var offsetParent = element.getOffsetParent();
        if (offsetParent && offsetParent.getStyle('position') === 'fixed')
          offsetParent.setStyle({ zoom: 1 });
        element.setStyle({ position: 'relative' });
        var value = proceed(element);
        element.setStyle({ position: position });
        return value;
      }
    );
  });

  Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
    function(proceed, element) {
      try { element.offsetParent }
      catch(e) { return Element._returnOffset(0,0) }
      return proceed(element);
    }
  );

  Element.Methods.getStyle = function(element, style) {
    element = $(element);
    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
    var value = element.style[style];
    if (!value && element.currentStyle) value = element.currentStyle[style];

    if (style == 'opacity') {
      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
        if (value[1]) return parseFloat(value[1]) / 100;
      return 1.0;
    }

    if (value == 'auto') {
      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
        return element['offset' + style.capitalize()] + 'px';
      return null;
    }
    return value;
  };

  Element.Methods.setOpacity = function(element, value) {
    function stripAlpha(filter){
      return filter.replace(/alpha\([^\)]*\)/gi,'');
    }
    element = $(element);
    var currentStyle = element.currentStyle;
    if ((currentStyle && !currentStyle.hasLayout) ||
      (!currentStyle && element.style.zoom == 'normal'))
        element.style.zoom = 1;

    var filter = element.getStyle('filter'), style = element.style;
    if (value == 1 || value === '') {
      (filter = stripAlpha(filter)) ?
        style.filter = filter : style.removeAttribute('filter');
      return element;
    } else if (value < 0.00001) value = 0;
    style.filter = stripAlpha(filter) +
      'alpha(opacity=' + (value * 100) + ')';
    return element;
  };

  Element._attributeTranslations = {
    read: {
      names: {
        'class': 'className',
        'for':   'htmlFor'
      },
      values: {
        _getAttr: function(element, attribute) {
          return element.getAttribute(attribute, 2);
        },
        _getAttrNode: function(element, attribute) {
          var node = element.getAttributeNode(attribute);
          return node ? node.value : "";
        },
        _getEv: function(element, attribute) {
          attribute = element.getAttribute(attribute);
          return attribute ? attribute.toString().slice(23, -2) : null;
        },
        _flag: function(element, attribute) {
          return $(element).hasAttribute(attribute) ? attribute : null;
        },
        style: function(element) {
          return element.style.cssText.toLowerCase();
        },
        title: function(element) {
          return element.title;
        }
      }
    }
  };

  Element._attributeTranslations.write = {
    names: Object.extend({
      cellpadding: 'cellPadding',
      cellspacing: 'cellSpacing'
    }, Element._attributeTranslations.read.names),
    values: {
      checked: function(element, value) {
        element.checked = !!value;
      },

      style: function(element, value) {
        element.style.cssText = value ? value : '';
      }
    }
  };

  Element._attributeTranslations.has = {};

  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
  });

  (function(v) {
    Object.extend(v, {
      href:        v._getAttr,
      src:         v._getAttr,
      type:        v._getAttr,
      action:      v._getAttrNode,
      disabled:    v._flag,
      checked:     v._flag,
      readonly:    v._flag,
      multiple:    v._flag,
      onload:      v._getEv,
      onunload:    v._getEv,
      onclick:     v._getEv,
      ondblclick:  v._getEv,
      onmousedown: v._getEv,
      onmouseup:   v._getEv,
      onmouseover: v._getEv,
      onmousemove: v._getEv,
      onmouseout:  v._getEv,
      onfocus:     v._getEv,
      onblur:      v._getEv,
      onkeypress:  v._getEv,
      onkeydown:   v._getEv,
      onkeyup:     v._getEv,
      onsubmit:    v._getEv,
      onreset:     v._getEv,
      onselect:    v._getEv,
      onchange:    v._getEv
    });
  })(Element._attributeTranslations.read.values);
}

else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1) ? 0.999999 :
      (value === '') ? '' : (value < 0.00001) ? 0 : value;
    return element;
  };
}

else if (Prototype.Browser.WebKit) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;

    if (value == 1)
      if(element.tagName.toUpperCase() == 'IMG' && element.width) {
        element.width++; element.width--;
      } else try {
        var n = document.createTextNode(' ');
        element.appendChild(n);
        element.removeChild(n);
      } catch (e) { }

    return element;
  };

  // Safari returns margins on body which is incorrect if the child is absolutely
  // positioned.  For performance reasons, redefine Element#cumulativeOffset for
  // KHTML/WebKit only.
  Element.Methods.cumulativeOffset = function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      if (element.offsetParent == document.body)
        if (Element.getStyle(element, 'position') == 'absolute') break;

      element = element.offsetParent;
    } while (element);

    return Element._returnOffset(valueL, valueT);
  };
}

if (Prototype.Browser.IE || Prototype.Browser.Opera) {
  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
  Element.Methods.update = function(element, content) {
    element = $(element);

    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) return element.update().insert(content);

    content = Object.toHTML(content);
    var tagName = element.tagName.toUpperCase();

    if (tagName in Element._insertionTranslations.tags) {
      $A(element.childNodes).each(function(node) { element.removeChild(node) });
      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
        .each(function(node) { element.appendChild(node) });
    }
    else element.innerHTML = content.stripScripts();

    content.evalScripts.bind(content).defer();
    return element;
  };
}

if ('outerHTML' in document.createElement('div')) {
  Element.Methods.replace = function(element, content) {
    element = $(element);

    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) {
      element.parentNode.replaceChild(content, element);
      return element;
    }

    content = Object.toHTML(content);
    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();

    if (Element._insertionTranslations.tags[tagName]) {
      var nextSibling = element.next();
      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
      parent.removeChild(element);
      if (nextSibling)
        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
      else
        fragments.each(function(node) { parent.appendChild(node) });
    }
    else element.outerHTML = content.stripScripts();

    content.evalScripts.bind(content).defer();
    return element;
  };
}

Element._returnOffset = function(l, t) {
  var result = [l, t];
  result.left = l;
  result.top = t;
  return result;
};

Element._getContentFromAnonymousElement = function(tagName, html) {
  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
  if (t) {
    div.innerHTML = t[0] + html + t[1];
    t[2].times(function() { div = div.firstChild });
  } else div.innerHTML = html;
  return $A(div.childNodes);
};

Element._insertionTranslations = {
  before: function(element, node) {
    element.parentNode.insertBefore(node, element);
  },
  top: function(element, node) {
    element.insertBefore(node, element.firstChild);
  },
  bottom: function(element, node) {
    element.appendChild(node);
  },
  after: function(element, node) {
    element.parentNode.insertBefore(node, element.nextSibling);
  },
  tags: {
    TABLE:  ['<table>',                '</table>',                   1],
    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
    SELECT: ['<select>',               '</select>',                  1]
  }
};

(function() {
  Object.extend(this.tags, {
    THEAD: this.tags.TBODY,
    TFOOT: this.tags.TBODY,
    TH:    this.tags.TD
  });
}).call(Element._insertionTranslations);

Element.Methods.Simulated = {
  hasAttribute: function(element, attribute) {
    attribute = Element._attributeTranslations.has[attribute] || attribute;
    var node = $(element).getAttributeNode(attribute);
    return !!(node && node.specified);
  }
};

Element.Methods.ByTag = { };

Object.extend(Element, Element.Methods);

if (!Prototype.BrowserFeatures.ElementExtensions &&
    document.createElement('div')['__proto__']) {
  window.HTMLElement = { };
  window.HTMLElement.prototype = document.createElement('div')['__proto__'];
  Prototype.BrowserFeatures.ElementExtensions = true;
}

Element.extend = (function() {
  if (Prototype.BrowserFeatures.SpecificElementExtensions)
    return Prototype.K;

  var Methods = { }, ByTag = Element.Methods.ByTag;

  var extend = Object.extend(function(element) {
    if (!element || element._extendedByPrototype ||
        element.nodeType != 1 || element == window) return element;

    var methods = Object.clone(Methods),
      tagName = element.tagName.toUpperCase(), property, value;

    // extend methods for specific tags
    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);

    for (property in methods) {
      value = methods[property];
      if (Object.isFunction(value) && !(property in element))
        element[property] = value.methodize();
    }

    element._extendedByPrototype = Prototype.emptyFunction;
    return element;

  }, {
    refresh: function() {
      // extend methods for all tags (Safari doesn't need this)
      if (!Prototype.BrowserFeatures.ElementExtensions) {
        Object.extend(Methods, Element.Methods);
        Object.extend(Methods, Element.Methods.Simulated);
      }
    }
  });

  extend.refresh();
  return extend;
})();

Element.hasAttribute = function(element, attribute) {
  if (element.hasAttribute) return element.hasAttribute(attribute);
  return Element.Methods.Simulated.hasAttribute(element, attribute);
};

Element.addMethods = function(methods) {
  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;

  if (!methods) {
    Object.extend(Form, Form.Methods);
    Object.extend(Form.Element, Form.Element.Methods);
    Object.extend(Element.Methods.ByTag, {
      "FORM":     Object.clone(Form.Methods),
      "INPUT":    Object.clone(Form.Element.Methods),
      "SELECT":   Object.clone(Form.Element.Methods),
      "TEXTAREA": Object.clone(Form.Element.Methods)
    });
  }

  if (arguments.length == 2) {
    var tagName = methods;
    methods = arguments[1];
  }

  if (!tagName) Object.extend(Element.Methods, methods || { });
  else {
    if (Object.isArray(tagName)) tagName.each(extend);
    else extend(tagName);
  }

  function extend(tagName) {
    tagName = tagName.toUpperCase();
    if (!Element.Methods.ByTag[tagName])
      Element.Methods.ByTag[tagName] = { };
    Object.extend(Element.Methods.ByTag[tagName], methods);
  }

  function copy(methods, destination, onlyIfAbsent) {
    onlyIfAbsent = onlyIfAbsent || false;
    for (var property in methods) {
      var value = methods[property];
      if (!Object.isFunction(value)) continue;
      if (!onlyIfAbsent || !(property in destination))
        destination[property] = value.methodize();
    }
  }

  function findDOMClass(tagName) {
    var klass;
    var trans = {
      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
      "FrameSet", "IFRAME": "IFrame"
    };
    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName.capitalize() + 'Element';
    if (window[klass]) return window[klass];

    window[klass] = { };
    window[klass].prototype = document.createElement(tagName)['__proto__'];
    return window[klass];
  }

  if (F.ElementExtensions) {
    copy(Element.Methods, HTMLElement.prototype);
    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
  }

  if (F.SpecificElementExtensions) {
    for (var tag in Element.Methods.ByTag) {
      var klass = findDOMClass(tag);
      if (Object.isUndefined(klass)) continue;
      copy(T[tag], klass.prototype);
    }
  }

  Object.extend(Element, Element.Methods);
  delete Element.ByTag;

  if (Element.extend.refresh) Element.extend.refresh();
  Element.cache = { };
};

document.viewport = {
  getDimensions: function() {
    var dimensions = { }, B = Prototype.Browser;
    $w('width height').each(function(d) {
      var D = d.capitalize();
      if (B.WebKit && !document.evaluate) {
        // Safari <3.0 needs self.innerWidth/Height
        dimensions[d] = self['inner' + D];
      } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
        // Opera <9.5 needs document.body.clientWidth/Height
        dimensions[d] = document.body['client' + D]
      } else {
        dimensions[d] = document.documentElement['client' + D];
      }
    });
    return dimensions;
  },

  getWidth: function() {
    return this.getDimensions().width;
  },

  getHeight: function() {
    return this.getDimensions().height;
  },

  getScrollOffsets: function() {
    return Element._returnOffset(
      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
  }
};
/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
 * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
 * license.  Please see http://www.yui-ext.com/ for more information. */

var Selector = Class.create({
  initialize: function(expression) {
    this.expression = expression.strip();

    if (this.shouldUseSelectorsAPI()) {
      this.mode = 'selectorsAPI';
    } else if (this.shouldUseXPath()) {
      this.mode = 'xpath';
      this.compileXPathMatcher();
    } else {
      this.mode = "normal";
      this.compileMatcher();
    }

  },

  shouldUseXPath: function() {
    if (!Prototype.BrowserFeatures.XPath) return false;

    var e = this.expression;

    // Safari 3 chokes on :*-of-type and :empty
    if (Prototype.Browser.WebKit &&
     (e.include("-of-type") || e.include(":empty")))
      return false;

    // XPath can't do namespaced attributes, nor can it read
    // the "checked" property from DOM nodes
    // PW - tweaked for local load
    if ((/(\\[\[\w-]*?:|:checked)/).test(e))
      return false;

    return true;
  },

  shouldUseSelectorsAPI: function() {
    if (!Prototype.BrowserFeatures.SelectorsAPI) return false;

    if (!Selector._div) Selector._div = new Element('div');

    // Make sure the browser treats the selector as valid. Test on an
    // isolated element to minimize cost of this check.
    try {
      Selector._div.querySelector(this.expression);
    } catch(e) {
      return false;
    }

    return true;
  },

  compileMatcher: function() {
    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
        c = Selector.criteria, le, p, m;

    if (Selector._cache[e]) {
      this.matcher = Selector._cache[e];
      return;
    }

    this.matcher = ["this.matcher = function(root) {",
                    "var r = root, h = Selector.handlers, c = false, n;"];

    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        p = ps[i];
        if (m = e.match(p)) {
          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
            new Template(c[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.matcher.push("return h.unique(n);\n}");
    eval(this.matcher.join('\n'));
    Selector._cache[this.expression] = this.matcher;
  },

  compileXPathMatcher: function() {
    var e = this.expression, ps = Selector.patterns,
        x = Selector.xpath, le, m;

    if (Selector._cache[e]) {
      this.xpath = Selector._cache[e]; return;
    }

    this.matcher = ['.//*'];
    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        if (m = e.match(ps[i])) {
          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
            new Template(x[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.xpath = this.matcher.join('');
    Selector._cache[this.expression] = this.xpath;
  },

  findElements: function(root) {
    root = root || document;
    var e = this.expression, results;

    switch (this.mode) {
      case 'selectorsAPI':
        // querySelectorAll queries document-wide, then filters to descendants
        // of the context element. That's not what we want.
        // Add an explicit context to the selector if necessary.
        if (root !== document) {
          var oldId = root.id, id = $(root).identify();
          e = "#" + id + " " + e;
        }

        results = $A(root.querySelectorAll(e)).map(Element.extend);
        root.id = oldId;

        return results;
      case 'xpath':
        return document._getElementsByXPath(this.xpath, root);
      default:
       return this.matcher(root);
    }
  },

  match: function(element) {
    this.tokens = [];

    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
    var le, p, m;

    while (e && le !== e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        p = ps[i];
        if (m = e.match(p)) {
          // use the Selector.assertions methods unless the selector
          // is too complex.
          if (as[i]) {
            this.tokens.push([i, Object.clone(m)]);
            e = e.replace(m[0], '');
          } else {
            // reluctantly do a document-wide search
            // and look for a match in the array
            return this.findElements(document).include(element);
          }
        }
      }
    }

    var match = true, name, matches;
    for (var i = 0, token; token = this.tokens[i]; i++) {
      name = token[0], matches = token[1];
      if (!Selector.assertions[name](element, matches)) {
        match = false; break;
      }
    }

    return match;
  },

  toString: function() {
    return this.expression;
  },

  inspect: function() {
    return "#<Selector:" + this.expression.inspect() + ">";
  }
});

Object.extend(Selector, {
  _cache: { },

  xpath: {
    descendant:   "//*",
    child:        "/*",
    adjacent:     "/following-sibling::*[1]",
    laterSibling: '/following-sibling::*',
    tagName:      function(m) {
      if (m[1] == '*') return '';
      return "[local-name()='" + m[1].toLowerCase() +
             "' or local-name()='" + m[1].toUpperCase() + "']";
    },
    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
    id:           "[@id='#{1}']",
    attrPresence: function(m) {
      m[1] = m[1].toLowerCase();
      return new Template("[@#{1}]").evaluate(m);
    },
    attr: function(m) {
      m[1] = m[1].toLowerCase();
      m[3] = m[5] || m[6];
      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
    },
    pseudo: function(m) {
      var h = Selector.xpath.pseudos[m[1]];
      if (!h) return '';
      if (Object.isFunction(h)) return h(m);
      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
    },
    operators: {
      '=':  "[@#{1}='#{3}']",
      '!=': "[@#{1}!='#{3}']",
      '^=': "[starts-with(@#{1}, '#{3}')]",
      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
      '*=': "[contains(@#{1}, '#{3}')]",
      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
    },
    pseudos: {
      'first-child': '[not(preceding-sibling::*)]',
      'last-child':  '[not(following-sibling::*)]',
      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
      'empty':       "[count(*) = 0 and (count(text()) = 0)]",
      'checked':     "[@checked]",
      'disabled':    "[(@disabled) and (@type!='hidden')]",
      'enabled':     "[not(@disabled) and (@type!='hidden')]",
      'not': function(m) {
        var e = m[6], p = Selector.patterns,
            x = Selector.xpath, le, v;

        var exclusion = [];
        while (e && le != e && (/\S/).test(e)) {
          le = e;
          for (var i in p) {
            if (m = e.match(p[i])) {
              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
              e = e.replace(m[0], '');
              break;
            }
          }
        }
        return "[not(" + exclusion.join(" and ") + ")]";
      },
      'nth-child':      function(m) {
        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
      },
      'nth-last-child': function(m) {
        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
      },
      'nth-of-type':    function(m) {
        return Selector.xpath.pseudos.nth("position() ", m);
      },
      'nth-last-of-type': function(m) {
        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
      },
      'first-of-type':  function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
      },
      'last-of-type':   function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
      },
      'only-of-type':   function(m) {
        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
      },
      nth: function(fragment, m) {
        var mm, formula = m[6], predicate;
        if (formula == 'even') formula = '2n+0';
        if (formula == 'odd')  formula = '2n+1';
        if (mm = formula.match(/^(\d+)$/)) // digit only
          return '[' + fragment + "= " + mm[1] + ']';
        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
          if (mm[1] == "-") mm[1] = -1;
          var a = mm[1] ? Number(mm[1]) : 1;
          var b = mm[2] ? Number(mm[2]) : 0;
          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
          "((#{fragment} - #{b}) div #{a} >= 0)]";
          return new Template(predicate).evaluate({
            fragment: fragment, a: a, b: b });
        }
      }
    }
  },

  criteria: {
    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',
    className:    'n = h.className(n, r, "#{1}", c);    c = false;',
    id:           'n = h.id(n, r, "#{1}", c);           c = false;',
    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
    attr: function(m) {
      m[3] = (m[5] || m[6]);
      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
    },
    pseudo: function(m) {
      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
    },
    descendant:   'c = "descendant";',
    child:        'c = "child";',
    adjacent:     'c = "adjacent";',
    laterSibling: 'c = "laterSibling";'
  },

  patterns: {
    // combinators must be listed first
    // (and descendant needs to be last combinator)
    laterSibling: /^\s*~\s*/,
    child:        /^\s*>\s*/,
    adjacent:     /^\s*\+\s*/,
    descendant:   /^\s/,

    // selectors follow
    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
    id:           /^#([\w\-\*]+)(\b|$)/,
    className:    /^\.([\w\-\*]+)(\b|$)/,
    pseudo:
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
    attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^]]*?)))?\]/
  },

  // for Selector.match and Element#match
  assertions: {
    tagName: function(element, matches) {
      return matches[1].toUpperCase() == element.tagName.toUpperCase();
    },

    className: function(element, matches) {
      return Element.hasClassName(element, matches[1]);
    },

    id: function(element, matches) {
      return element.id === matches[1];
    },

    attrPresence: function(element, matches) {
      return Element.hasAttribute(element, matches[1]);
    },

    attr: function(element, matches) {
      var nodeValue = Element.readAttribute(element, matches[1]);
      return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
    }
  },

  handlers: {
    // UTILITY FUNCTIONS
    // joins two collections
    concat: function(a, b) {
      for (var i = 0, node; node = b[i]; i++)
        a.push(node);
      return a;
    },

    // marks an array of nodes for counting
    mark: function(nodes) {
      var _true = Prototype.emptyFunction;
      for (var i = 0, node; node = nodes[i]; i++)
        node._countedByPrototype = _true;
      return nodes;
    },

    unmark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node._countedByPrototype = undefined;
      return nodes;
    },

    // mark each child node with its position (for nth calls)
    // "ofType" flag indicates whether we're indexing for nth-of-type
    // rather than nth-child
    index: function(parentNode, reverse, ofType) {
      parentNode._countedByPrototype = Prototype.emptyFunction;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          var node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
      }
    },

    // filters out duplicates and extends all nodes
    unique: function(nodes) {
      if (nodes.length == 0) return nodes;
      var results = [], n;
      for (var i = 0, l = nodes.length; i < l; i++)
        if (!(n = nodes[i])._countedByPrototype) {
          n._countedByPrototype = Prototype.emptyFunction;
          results.push(Element.extend(n));
        }
      return Selector.handlers.unmark(results);
    },

    // COMBINATOR FUNCTIONS
    descendant: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, node.getElementsByTagName('*'));
      return results;
    },

    child: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        for (var j = 0, child; child = node.childNodes[j]; j++)
          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
      }
      return results;
    },

    adjacent: function(nodes) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        var next = this.nextElementSibling(node);
        if (next) results.push(next);
      }
      return results;
    },

    laterSibling: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, Element.nextSiblings(node));
      return results;
    },

    nextElementSibling: function(node) {
      while (node = node.nextSibling)
        if (node.nodeType == 1) return node;
      return null;
    },

    previousElementSibling: function(node) {
      while (node = node.previousSibling)
        if (node.nodeType == 1) return node;
      return null;
    },

    // TOKEN FUNCTIONS
    tagName: function(nodes, root, tagName, combinator) {
      var uTagName = tagName.toUpperCase();
      var results = [], h = Selector.handlers;
      if (nodes) {
        if (combinator) {
          // fastlane for ordinary descendant combinators
          if (combinator == "descendant") {
            for (var i = 0, node; node = nodes[i]; i++)
              h.concat(results, node.getElementsByTagName(tagName));
            return results;
          } else nodes = this[combinator](nodes);
          if (tagName == "*") return nodes;
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.tagName.toUpperCase() === uTagName) results.push(node);
        return results;
      } else return root.getElementsByTagName(tagName);
    },

    id: function(nodes, root, id, combinator) {
      var targetNode = $(id), h = Selector.handlers;
      if (!targetNode) return [];
      if (!nodes && root == document) return [targetNode];
      if (nodes) {
        if (combinator) {
          if (combinator == 'child') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (targetNode.parentNode == node) return [targetNode];
          } else if (combinator == 'descendant') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Element.descendantOf(targetNode, node)) return [targetNode];
          } else if (combinator == 'adjacent') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Selector.handlers.previousElementSibling(targetNode) == node)
                return [targetNode];
          } else nodes = h[combinator](nodes);
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node == targetNode) return [targetNode];
        return [];
      }
      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
    },

    className: function(nodes, root, className, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      return Selector.handlers.byClassName(nodes, root, className);
    },

    byClassName: function(nodes, root, className) {
      if (!nodes) nodes = Selector.handlers.descendant([root]);
      var needle = ' ' + className + ' ';
      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
        nodeClassName = node.className;
        if (nodeClassName.length == 0) continue;
        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
          results.push(node);
      }
      return results;
    },

    attrPresence: function(nodes, root, attr, combinator) {
      if (!nodes) nodes = root.getElementsByTagName("*");
      if (nodes && combinator) nodes = this[combinator](nodes);
      var results = [];
      for (var i = 0, node; node = nodes[i]; i++)
        if (Element.hasAttribute(node, attr)) results.push(node);
      return results;
    },

    attr: function(nodes, root, attr, value, operator, combinator) {
      if (!nodes) nodes = root.getElementsByTagName("*");
      if (nodes && combinator) nodes = this[combinator](nodes);
      var handler = Selector.operators[operator], results = [];
      for (var i = 0, node; node = nodes[i]; i++) {
        var nodeValue = Element.readAttribute(node, attr);
        if (nodeValue === null) continue;
        if (handler(nodeValue, value)) results.push(node);
      }
      return results;
    },

    pseudo: function(nodes, name, value, root, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      if (!nodes) nodes = root.getElementsByTagName("*");
      return Selector.pseudos[name](nodes, value, root);
    }
  },

  pseudos: {
    'first-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.previousElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'last-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.nextElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'only-child': function(nodes, value, root) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
          results.push(node);
      return results;
    },
    'nth-child':        function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root);
    },
    'nth-last-child':   function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true);
    },
    'nth-of-type':      function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, false, true);
    },
    'nth-last-of-type': function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true, true);
    },
    'first-of-type':    function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, false, true);
    },
    'last-of-type':     function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, true, true);
    },
    'only-of-type':     function(nodes, formula, root) {
      var p = Selector.pseudos;
      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
    },

    // handles the an+b logic
    getIndices: function(a, b, total) {
      if (a == 0) return b > 0 ? [b] : [];
      return $R(1, total).inject([], function(memo, i) {
        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
        return memo;
      });
    },

    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
    nth: function(nodes, formula, root, reverse, ofType) {
      if (nodes.length == 0) return [];
      if (formula == 'even') formula = '2n+0';
      if (formula == 'odd')  formula = '2n+1';
      var h = Selector.handlers, results = [], indexed = [], m;
      h.mark(nodes);
      for (var i = 0, node; node = nodes[i]; i++) {
        if (!node.parentNode._countedByPrototype) {
          h.index(node.parentNode, reverse, ofType);
          indexed.push(node.parentNode);
        }
      }
      if (formula.match(/^\d+$/)) { // just a number
        formula = Number(formula);
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.nodeIndex == formula) results.push(node);
      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
        if (m[1] == "-") m[1] = -1;
        var a = m[1] ? Number(m[1]) : 1;
        var b = m[2] ? Number(m[2]) : 0;
        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
          for (var j = 0; j < l; j++)
            if (node.nodeIndex == indices[j]) results.push(node);
        }
      }
      h.unmark(nodes);
      h.unmark(indexed);
      return results;
    },

    'empty': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        // IE treats comments as element nodes
        if (node.tagName == '!' || node.firstChild) continue;
        results.push(node);
      }
      return results;
    },

    'not': function(nodes, selector, root) {
      var h = Selector.handlers, selectorType, m;
      var exclusions = new Selector(selector).findElements(root);
      h.mark(exclusions);
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node._countedByPrototype) results.push(node);
      h.unmark(exclusions);
      return results;
    },

    'enabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node.disabled && (!node.type || node.type !== 'hidden'))
          results.push(node);
      return results;
    },

    'disabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.disabled) results.push(node);
      return results;
    },

    'checked': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.checked) results.push(node);
      return results;
    }
  },

  operators: {
    '=':  function(nv, v) { return nv == v; },
    '!=': function(nv, v) { return nv != v; },
    '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
    '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
    '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
    '$=': function(nv, v) { return nv.endsWith(v); },
    '*=': function(nv, v) { return nv.include(v); },
    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
    '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
     '-').include('-' + (v || "").toUpperCase() + '-'); }
  },

  split: function(expression) {
    var expressions = [];
    expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
      expressions.push(m[1].strip());
    });
    return expressions;
  },

  matchElements: function(elements, expression) {
    var matches = $$(expression), h = Selector.handlers;
    h.mark(matches);
    for (var i = 0, results = [], element; element = elements[i]; i++)
      if (element._countedByPrototype) results.push(element);
    h.unmark(matches);
    return results;
  },

  findElement: function(elements, expression, index) {
    if (Object.isNumber(expression)) {
      index = expression; expression = false;
    }
    return Selector.matchElements(elements, expression || '*')[index || 0];
  },

  findChildElements: function(element, expressions) {
    expressions = Selector.split(expressions.join(','));
    var results = [], h = Selector.handlers;
    for (var i = 0, l = expressions.length, selector; i < l; i++) {
      selector = new Selector(expressions[i].strip());
      h.concat(results, selector.findElements(element));
    }
    return (l > 1) ? h.unique(results) : results;
  }
});

if (Prototype.Browser.IE) {
  Object.extend(Selector.handlers, {
    // IE returns comment nodes on getElementsByTagName("*").
    // Filter them out.
    concat: function(a, b) {
      for (var i = 0, node; node = b[i]; i++)
        if (node.tagName !== "!") a.push(node);
      return a;
    },

    // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
    unmark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node.removeAttribute('_countedByPrototype');
      return nodes;
    }
  });
}

function $$() {
  return Selector.findChildElements(document, $A(arguments));
}
var Form = {
  reset: function(form) {
    $(form).reset();
    return form;
  },

  serializeElements: function(elements, options) {
    if (typeof options != 'object') options = { hash: !!options };
    else if (Object.isUndefined(options.hash)) options.hash = true;
    var key, value, submitted = false, submit = options.submit;

    var data = elements.inject({ }, function(result, element) {
      if (!element.disabled && element.name) {
        key = element.name; value = $(element).getValue();
        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
            submit !== false && (!submit || key == submit) && (submitted = true)))) {
          if (key in result) {
            // a key is already present; construct an array of values
            if (!Object.isArray(result[key])) result[key] = [result[key]];
            result[key].push(value);
          }
          else result[key] = value;
        }
      }
      return result;
    });

    return options.hash ? data : Object.toQueryString(data);
  }
};

Form.Methods = {
  serialize: function(form, options) {
    return Form.serializeElements(Form.getElements(form), options);
  },

  getElements: function(form) {
    return $A($(form).getElementsByTagName('*')).inject([],
      function(elements, child) {
        if (Form.Element.Serializers[child.tagName.toLowerCase()])
          elements.push(Element.extend(child));
        return elements;
      }
    );
  },

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name) return $A(inputs).map(Element.extend);

    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
      var input = inputs[i];
      if ((typeName && input.type != typeName) || (name && input.name != name))
        continue;
      matchingInputs.push(Element.extend(input));
    }

    return matchingInputs;
  },

  disable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('disable');
    return form;
  },

  enable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('enable');
    return form;
  },

  findFirstElement: function(form) {
    var elements = $(form).getElements().findAll(function(element) {
      return 'hidden' != element.type && !element.disabled;
    });
    var firstByIndex = elements.findAll(function(element) {
      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
    }).sortBy(function(element) { return element.tabIndex }).first();

    return firstByIndex ? firstByIndex : elements.find(function(element) {
      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
    });
  },

  focusFirstElement: function(form) {
    form = $(form);
    form.findFirstElement().activate();
    return form;
  },

  request: function(form, options) {
    form = $(form), options = Object.clone(options || { });

    var params = options.parameters, action = form.readAttribute('action') || '';
    if (action.blank()) action = window.location.href;
    options.parameters = form.serialize(true);

    if (params) {
      if (Object.isString(params)) params = params.toQueryParams();
      Object.extend(options.parameters, params);
    }

    if (form.hasAttribute('method') && !options.method)
      options.method = form.method;

    return new Ajax.Request(action, options);
  }
};

/*--------------------------------------------------------------------------*/

Form.Element = {
  focus: function(element) {
    $(element).focus();
    return element;
  },

  select: function(element) {
    $(element).select();
    return element;
  }
};

Form.Element.Methods = {
  serialize: function(element) {
    element = $(element);
    if (!element.disabled && element.name) {
      var value = element.getValue();
      if (value != undefined) {
        var pair = { };
        pair[element.name] = value;
        return Object.toQueryString(pair);
      }
    }
    return '';
  },

  getValue: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    return Form.Element.Serializers[method](element);
  },

  setValue: function(element, value) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    Form.Element.Serializers[method](element, value);
    return element;
  },

  clear: function(element) {
    $(element).value = '';
    return element;
  },

  present: function(element) {
    return $(element).value != '';
  },

  activate: function(element) {
    element = $(element);
    try {
      element.focus();
      if (element.select && (element.tagName.toLowerCase() != 'input' ||
          !['button', 'reset', 'submit'].include(element.type)))
        element.select();
    } catch (e) { }
    return element;
  },

  disable: function(element) {
    element = $(element);
    element.disabled = true;
    return element;
  },

  enable: function(element) {
    element = $(element);
    element.disabled = false;
    return element;
  }
};

/*--------------------------------------------------------------------------*/

var Field = Form.Element;
var $F = Form.Element.Methods.getValue;

/*--------------------------------------------------------------------------*/

Form.Element.Serializers = {
  input: function(element, value) {
    switch (element.type.toLowerCase()) {
      case 'checkbox':
      case 'radio':
        return Form.Element.Serializers.inputSelector(element, value);
      default:
        return Form.Element.Serializers.textarea(element, value);
    }
  },

  inputSelector: function(element, value) {
    if (Object.isUndefined(value)) return element.checked ? element.value : null;
    else element.checked = !!value;
  },

  textarea: function(element, value) {
    if (Object.isUndefined(value)) return element.value;
    else element.value = value;
  },

  select: function(element, value) {
    if (Object.isUndefined(value))
      return this[element.type == 'select-one' ?
        'selectOne' : 'selectMany'](element);
    else {
      var opt, currentValue, single = !Object.isArray(value);
      for (var i = 0, length = element.length; i < length; i++) {
        opt = element.options[i];
        currentValue = this.optionValue(opt);
        if (single) {
          if (currentValue == value) {
            opt.selected = true;
            return;
          }
        }
        else opt.selected = value.include(currentValue);
      }
    }
  },

  selectOne: function(element) {
    var index = element.selectedIndex;
    return index >= 0 ? this.optionValue(element.options[index]) : null;
  },

  selectMany: function(element) {
    var values, length = element.length;
    if (!length) return null;

    for (var i = 0, values = []; i < length; i++) {
      var opt = element.options[i];
      if (opt.selected) values.push(this.optionValue(opt));
    }
    return values;
  },

  optionValue: function(opt) {
    // extend element because hasAttribute may not be native
    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
  }
};

/*--------------------------------------------------------------------------*/

Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
  initialize: function($super, element, frequency, callback) {
    $super(callback, frequency);
    this.element   = $(element);
    this.lastValue = this.getValue();
  },

  execute: function() {
    var value = this.getValue();
    if (Object.isString(this.lastValue) && Object.isString(value) ?
        this.lastValue != value : String(this.lastValue) != String(value)) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  }
});

Form.Element.Observer = Class.create(Abstract.TimedObserver, {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.Observer = Class.create(Abstract.TimedObserver, {
  getValue: function() {
    return Form.serialize(this.element);
  }
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = Class.create({
  initialize: function(element, callback) {
    this.element  = $(element);
    this.callback = callback;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
    Form.getElements(this.element).each(this.registerCallback, this);
  },

  registerCallback: function(element) {
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          break;
        default:
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
});

Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.EventObserver = Class.create(Abstract.EventObserver, {
  getValue: function() {
    return Form.serialize(this.element);
  }
});
if (!window.Event) var Event = { };

Object.extend(Event, {
  KEY_BACKSPACE: 8,
  KEY_TAB:       9,
  KEY_RETURN:   13,
  KEY_ESC:      27,
  KEY_LEFT:     37,
  KEY_UP:       38,
  KEY_RIGHT:    39,
  KEY_DOWN:     40,
  KEY_DELETE:   46,
  KEY_HOME:     36,
  KEY_END:      35,
  KEY_PAGEUP:   33,
  KEY_PAGEDOWN: 34,
  KEY_INSERT:   45,

  cache: { },

  relatedTarget: function(event) {
    var element;
    switch(event.type) {
      case 'mouseover': element = event.fromElement; break;
      case 'mouseout':  element = event.toElement;   break;
      default: return null;
    }
    return Element.extend(element);
  }
});

Event.Methods = (function() {
  var isButton;

  if (Prototype.Browser.IE) {
    var buttonMap = { 0: 1, 1: 4, 2: 2 };
    isButton = function(event, code) {
      return event.button == buttonMap[code];
    };

  } else if (Prototype.Browser.WebKit) {
    isButton = function(event, code) {
      switch (code) {
        case 0: return event.which == 1 && !event.metaKey;
        case 1: return event.which == 1 && event.metaKey;
        default: return false;
      }
    };

  } else {
    isButton = function(event, code) {
      return event.which ? (event.which === code + 1) : (event.button === code);
    };
  }

  return {
    isLeftClick:   function(event) { return isButton(event, 0) },
    isMiddleClick: function(event) { return isButton(event, 1) },
    isRightClick:  function(event) { return isButton(event, 2) },

    element: function(event) {
      event = Event.extend(event);

      var node          = event.target,
          type          = event.type,
          currentTarget = event.currentTarget;

      if (currentTarget && currentTarget.tagName) {
        // Firefox screws up the "click" event when moving between radio buttons
        // via arrow keys. It also screws up the "load" and "error" events on images,
        // reporting the document as the target instead of the original image.
        if (type === 'load' || type === 'error' ||
          (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
            && currentTarget.type === 'radio'))
              node = currentTarget;
      }
      if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
      return Element.extend(node);
    },

    findElement: function(event, expression) {
      var element = Event.element(event);
      if (!expression) return element;
      var elements = [element].concat(element.ancestors());
      return Selector.findElement(elements, expression, 0);
    },

    pointer: function(event) {
      var docElement = document.documentElement,
      body = document.body || { scrollLeft: 0, scrollTop: 0 };
      return {
        x: event.pageX || (event.clientX +
          (docElement.scrollLeft || body.scrollLeft) -
          (docElement.clientLeft || 0)),
        y: event.pageY || (event.clientY +
          (docElement.scrollTop || body.scrollTop) -
          (docElement.clientTop || 0))
      };
    },

    pointerX: function(event) { return Event.pointer(event).x },
    pointerY: function(event) { return Event.pointer(event).y },

    stop: function(event) {
      Event.extend(event);
      event.preventDefault();
      event.stopPropagation();
      event.stopped = true;
    }
  };
})();

Event.extend = (function() {
  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
    m[name] = Event.Methods[name].methodize();
    return m;
  });

  if (Prototype.Browser.IE) {
    Object.extend(methods, {
      stopPropagation: function() { this.cancelBubble = true },
      preventDefault:  function() { this.returnValue = false },
      inspect: function() { return "[object Event]" }
    });

    return function(event) {
      if (!event) return false;
      if (event._extendedByPrototype) return event;

      event._extendedByPrototype = Prototype.emptyFunction;
      var pointer = Event.pointer(event);
      Object.extend(event, {
        target: event.srcElement,
        relatedTarget: Event.relatedTarget(event),
        pageX:  pointer.x,
        pageY:  pointer.y
      });
      return Object.extend(event, methods);
    };

  } else {
    Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
    Object.extend(Event.prototype, methods);
    return Prototype.K;
  }
})();

Object.extend(Event, (function() {
  var cache = Event.cache;

  function getEventID(element) {
    if (element._prototypeEventID) return element._prototypeEventID[0];
    arguments.callee.id = arguments.callee.id || 1;
    return element._prototypeEventID = [++arguments.callee.id];
  }

  function getDOMEventName(eventName) {
    if (eventName && eventName.include(':')) return "dataavailable";
    return eventName;
  }

  function getCacheForID(id) {
    return cache[id] = cache[id] || { };
  }

  function getWrappersForEventName(id, eventName) {
    var c = getCacheForID(id);
    return c[eventName] = c[eventName] || [];
  }

  function createWrapper(element, eventName, handler) {
    var id = getEventID(element);
    var c = getWrappersForEventName(id, eventName);
    if (c.pluck("handler").include(handler)) return false;

    var wrapper = function(event) {
      if (!Event || !Event.extend ||
        (event.eventName && event.eventName != eventName))
          return false;

      Event.extend(event);
      handler.call(element, event);
    };

    wrapper.handler = handler;
    c.push(wrapper);
    return wrapper;
  }

  function findWrapper(id, eventName, handler) {
    var c = getWrappersForEventName(id, eventName);
    return c.find(function(wrapper) { return wrapper.handler == handler });
  }

  function destroyWrapper(id, eventName, handler) {
    var c = getCacheForID(id);
    if (!c[eventName]) return false;
    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
  }

  function destroyCache() {
    for (var id in cache)
      for (var eventName in cache[id])
        cache[id][eventName] = null;
  }


  // Internet Explorer needs to remove event handlers on page unload
  // in order to avoid memory leaks.
  if (window.attachEvent) {
    window.attachEvent("onunload", destroyCache);
  }

  // Safari has a dummy event handler on page unload so that it won't
  // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
  // object when page is returned to via the back button using its bfcache.
  if (Prototype.Browser.WebKit) {
    window.addEventListener('unload', Prototype.emptyFunction, false);
  }

  return {
    observe: function(element, eventName, handler) {
      element = $(element);
      var name = getDOMEventName(eventName);

      var wrapper = createWrapper(element, eventName, handler);
      if (!wrapper) return element;

      if (element.addEventListener) {
        element.addEventListener(name, wrapper, false);
      } else {
        element.attachEvent("on" + name, wrapper);
      }

      return element;
    },

    stopObserving: function(element, eventName, handler) {
      element = $(element);
      var id = getEventID(element), name = getDOMEventName(eventName);

      if (!handler && eventName) {
        getWrappersForEventName(id, eventName).each(function(wrapper) {
          element.stopObserving(eventName, wrapper.handler);
        });
        return element;

      } else if (!eventName) {
        Object.keys(getCacheForID(id)).each(function(eventName) {
          element.stopObserving(eventName);
        });
        return element;
      }

      var wrapper = findWrapper(id, eventName, handler);
      if (!wrapper) return element;

      if (element.removeEventListener) {
        element.removeEventListener(name, wrapper, false);
      } else {
        element.detachEvent("on" + name, wrapper);
      }

      destroyWrapper(id, eventName, handler);

      return element;
    },

    fire: function(element, eventName, memo) {
      element = $(element);
      if (element == document && document.createEvent && !element.dispatchEvent)
        element = document.documentElement;

      var event;
      if (document.createEvent) {
        event = document.createEvent("HTMLEvents");
        event.initEvent("dataavailable", true, true);
      } else {
        event = document.createEventObject();
        event.eventType = "ondataavailable";
      }

      event.eventName = eventName;
      event.memo = memo || { };

      if (document.createEvent) {
        element.dispatchEvent(event);
      } else {
        element.fireEvent(event.eventType, event);
      }

      return Event.extend(event);
    }
  };
})());

Object.extend(Event, Event.Methods);

Element.addMethods({
  fire:          Event.fire,
  observe:       Event.observe,
  stopObserving: Event.stopObserving
});

Object.extend(document, {
  fire:          Element.Methods.fire.methodize(),
  observe:       Element.Methods.observe.methodize(),
  stopObserving: Element.Methods.stopObserving.methodize(),
  loaded:        false
});

(function() {
  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
     Matthias Miller, Dean Edwards and John Resig. */

  var timer;

  function fireContentLoadedEvent() {
    if (document.loaded) return;
    if (timer) window.clearInterval(timer);
    document.fire("dom:loaded");
    document.loaded = true;
  }

  if (document.addEventListener) {
    if (Prototype.Browser.WebKit) {
      timer = window.setInterval(function() {
        if (/loaded|complete/.test(document.readyState))
          fireContentLoadedEvent();
      }, 0);

      Event.observe(window, "load", fireContentLoadedEvent);

    } else {
      document.addEventListener("DOMContentLoaded",
        fireContentLoadedEvent, false);
    }

  } else {
    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
    $("__onDOMContentLoaded").onreadystatechange = function() {
      if (this.readyState == "complete") {
        this.onreadystatechange = null;
        fireContentLoadedEvent();
      }
    };
  }
})();
/*------------------------------- DEPRECATED -------------------------------*/

Hash.toQueryString = Object.toQueryString;

var Toggle = { display: Element.toggle };

Element.Methods.childOf = Element.Methods.descendantOf;

var Insertion = {
  Before: function(element, content) {
    return Element.insert(element, {before:content});
  },

  Top: function(element, content) {
    return Element.insert(element, {top:content});
  },

  Bottom: function(element, content) {
    return Element.insert(element, {bottom:content});
  },

  After: function(element, content) {
    return Element.insert(element, {after:content});
  }
};

var $continue = new Error('"throw $continue" is deprecated, use "return" instead');

// This should be moved to script.aculo.us; notice the deprecated methods
// further below, that map to the newer Element methods.
var Position = {
  // set to true if needed, warning: firefox performance problems
  // NOT neeeded for page scrolling, only if draggable contained in
  // scrollable elements
  includeScrollOffsets: false,

  // must be called before calling withinIncludingScrolloffset, every time the
  // page is scrolled
  prepare: function() {
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  // caches x/y coordinate pair to use with overlap
  within: function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = Element.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  },

  withinIncludingScrolloffsets: function(element, x, y) {
    var offsetcache = Element.cumulativeScrollOffset(element);

    this.xcomp = x + offsetcache[0] - this.deltaX;
    this.ycomp = y + offsetcache[1] - this.deltaY;
    this.offset = Element.cumulativeOffset(element);

    return (this.ycomp >= this.offset[1] &&
            this.ycomp <  this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp <  this.offset[0] + element.offsetWidth);
  },

  // within must be called directly before
  overlap: function(mode, element) {
    if (!mode) return 0;
    if (mode == 'vertical')
      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
    if (mode == 'horizontal')
      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
  },

  // Deprecation layer -- use newer Element methods now (1.5.2).

  cumulativeOffset: Element.Methods.cumulativeOffset,

  positionedOffset: Element.Methods.positionedOffset,

  absolutize: function(element) {
    Position.prepare();
    return Element.absolutize(element);
  },

  relativize: function(element) {
    Position.prepare();
    return Element.relativize(element);
  },

  realOffset: Element.Methods.cumulativeScrollOffset,

  offsetParent: Element.Methods.getOffsetParent,

  page: Element.Methods.viewportOffset,

  clone: function(source, target, options) {
    options = options || { };
    return Element.clonePosition(target, source, options);
  }
};

/*--------------------------------------------------------------------------*/

if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
  function iter(name) {
    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
  }

  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
  function(element, className) {
    className = className.toString().strip();
    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
  } : function(element, className) {
    className = className.toString().strip();
    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
    if (!classNames && !className) return elements;

    var nodes = $(element).getElementsByTagName('*');
    className = ' ' + className + ' ';

    for (var i = 0, child, cn; child = nodes[i]; i++) {
      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
          (classNames && classNames.all(function(name) {
            return !name.toString().blank() && cn.include(' ' + name + ' ');
          }))))
        elements.push(Element.extend(child));
    }
    return elements;
  };

  return function(className, parentElement) {
    return $(parentElement || document.body).getElementsByClassName(className);
  };
}(Element.Methods);

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },

  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },

  set: function(className) {
    this.element.className = className;
  },

  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
    this.set($A(this).concat(classNameToAdd).join(' '));
  },

  remove: function(classNameToRemove) {
    if (!this.include(classNameToRemove)) return;
    this.set($A(this).without(classNameToRemove).join(' '));
  },

  toString: function() {
    return $A(this).join(' ');
  }
};

Object.extend(Element.ClassNames.prototype, Enumerable);

/*--------------------------------------------------------------------------*/

Element.addMethods(); 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Utilities.js
AUTOCORE_SELF_CHECK.push("Oryx/Utilities.js");
//
/* ----------------------------------------------------------------

OkCupid Utilities file

	- usefulish stuff
	
This file contains general utilities used through the site

---------------------------------------------------------------- */

var Utilities = {
	
	/* Browser Functioning ------------------------------------------------------------------------ */
	
	handleEnter:function(e,f) //Needs testing
	{
		/* 
		Important: f cannot return ANYTHING.  No returns can be 
		made except the negated keyCode
		*/
		f = f || function (){};
		var Ucode=e.keyCode? e.keyCode : e.charCode;
		if (Ucode == 13){f();}
		e = (e) ? e : ((window.event) ? window.event : "");
		if (e) {return !( e.keyCode==13 || e.which==13 );}
	},
	preloadImages:function() 
	{
		var preload_arr = new Array();
		for(var i = 0; i < arguments.length; i++) {
			var preload_img = new Image();
			preload_img.src = arguments[i];
			preload_arr.push(preload_img);
		}
	},
	
	/* String functions --------------------------------------------------------------------------- */
	
	quickTrim:function(str) 
	{
        return str.replace(/(^\s+)([^\s]*)(\s+$)/, '$2');
    },
	stripBreaks:function(str) 
	{
		var res = str.replace(/\n/g," ");  	// ??
		res = res.replace(/\n/g," ");		// ??
		return res;
	},
	stripComments:function(str) 
	{
	    str = str.replace(/<!--[\w\s\/\-,]*-->/g, " ");
	    return str;
	},
    jogf:function(string,key)
    {
		// IE needs the var
        for(var item in key)
            string = string.replace("%" + item,key[item]);
        return string;
    },
    
	/* Math functions ----------------------------------------------------------------------------- */
	
	leadZero:function(n) {
		if (n < 10) n = "0" + n;
		return n;
	},
	formatBigInteger:function(integer) // Can this be simplified?
	{
	    var result = '',
	    	pattern = "###,###,###,###";

	    // cast that to a string.
	    integer = "" + integer + "";

	    integerIndex = integer.length - 1;
	    patternIndex = pattern.length - 1;

	    while ( (integerIndex >= 0) && (patternIndex >= 0) )
	    {
	        var digit = integer.charAt( integerIndex );
	        integerIndex--;

	        // Skip non-digits from the source integer (eradicate current formatting).
	        if ( (digit < '0') || (digit > '9') )  continue;

	        // Got a digit from the integer, now plug it into the pattern.
	        while ( patternIndex >= 0 )
	        {
	            var patternChar = pattern.charAt( patternIndex );
	            patternIndex--;

	            // Substitute digits for '#' chars, treat other chars literally.
	            if ( patternChar == '#' )
	            {
	                result = digit + result;
	                break;
	            }
	            else
	            {
	                result = patternChar + result;
	            }
	        }
	    }
	    return result;
	},
	
	/* Array Functions ---------------------------------------------------------------------------- */
	
	// note: currently doubled up below for backwards compatibility
	
	pushFront:function(A, x, maxsize) 
	{
	 	var i=A.length;
	 	if (maxsize && i>maxsize - 1)
	  	i=maxsize - 1;
	 	while (i>0) {
	  		A[i] = A[i-1];
	  		i--;
	 	}
	 	A[0] = x;
	},

	popMiddle:function(A,i) 
	{
	  	var x;
	  	if (i>A.length-1) return (false);
	  	for (x=i; x<A.length-1; x++) A[x]=A[x+1];
	  	A.length=A.length-1;
	  	return (true);
	},

	popFront:function(A) 
	{
	  	return (popMiddle(A,0));
	},

	moveToFront:function(A,i) 
	{
	 	var temp=A[i];
	 	while (i>0) {
	  		A[i]=A[i-1];
	  		i--;
	 	}
	 	A[0]=temp;
	},
	
	
	/* Interface ---------------------------------------------------------------------------------- */

	// Takes a form and wings it to a service.  Dependencies underway.  Localize needs a little more thought
	jackForm:function(form, url, success, dependent, localize)
	{
	    
		this.parameters = $(form).serialize();
		this.success = success;
		
		var pass = this;
				
		new Ajax.Request(url,
			{
				parameters:pass.parameters,
				method:"post",
				onSuccess:pass.success
			}
		);
	},

	setDefaultText:function(objt,text) //browse usage, may be more automated, drop dual calls, maybe action bind
	{
		var obj = objt,
			txt = text;
			
		util.doOnDomLoad(
				function() {
					if ($(obj)) {
						obj = $(obj);
						if (obj.value == '') 
							obj.value = txt;
						obj.observe("focus", function(){
							if (obj.value == txt) 
								obj.value = '';
							obj.addClassName('focus');
						});
						obj.observe("blur", function(){
							if (obj.value == '') 
								obj.value = txt;
							obj.removeClassName('focus');
						});
					}
				}
		);
	},
	
	/*
	Toggle has become fairly complex, so I'm stopping the feat creep here.  
	If you need to expand on it, or it's not doing what it should, let me
	know.  If it gets any bulkier its going to need to be broken down into
	more functions. Check the documentation.
	*/
	toggle_set:new Array(),
	triggers:new Array(),
	toggle:function(obj,bit,destiny,set,trig_obj)
	{
		var element = $(obj),
			display = element.getStyle("display"),
			trigger;
		
		/* 
		The below code is a bit ugly, but not wrong.  
		Dislike nested ifs, but that's sort of the 
		way these animated funcs work themsleves out.

		Will tackle it another time - PW 
		*/
		
		if(trig_obj) 
			trigger = $(trig_obj);
		else 
			trigger = false;
		
		if(set || set == 0) {
			if(typeof(this.toggle_set[set])=="undefined") this.toggle_set[set] = new Array();
			this.toggle_set[set][this.toggle_set[set].length] = element;
		}

		destiny = (destiny ? destiny : "block");
		if (bit) $bit.toggle(bit);
		
		if (display == "none") {
			if(set || set == 0) for(iter=0;iter<this.toggle_set[set].length;++iter) this.toggle_set[set][iter].style.display = "none";
			element.style.display = destiny;
		}
		else element.style.display = "none";
		
		if(trigger && (set || set == 0)) {
			if(typeof(this.triggers[set]) == "undefined") this.triggers[set] = new Array();
			this.triggers[set][this.triggers[set].length] = trigger;
		}
		
		if((set || set == 0) && typeof(this.triggers[set]) != "undefined") {
			for(iter=0;iter<this.triggers[set].length;++iter) this.triggers[set][iter].removeClassName("active");

			if (display == "none" && trigger != false) 
				trigger.addClassName("active");
			else if(trigger != false)
				trigger.removeClassName("active");
		}
	},

	randomQuip:function(lines,returnit)
	{
	    pickquip = Math.round(Math.random()*(lines.length-1));
	    if(!returnit)
	        document.write(lines[pickquip]);
        else
            return lines[pickquip];
	},
	

	/*
	This function needs some work.
	*/
	buddyCallWrapper:function(params,addRemove,notify,optmessage) {
		params.ajax = 1;
		new Ajax.Request("/profile", {
			parameters:params,
			onSuccess:function(response) {
				var text = "";
				switch(parseInt(response.responseText)){
					case 0:
						text = "User has been removed from your favorites.";
						if(addRemove == 1) text = (notify ? "User saved! They've been sent a message to let them know they're one of your favorites." : "User Saved!");
						break;
					case 12: text = "User saved! They've been sent a message to let them know they're one of your favorites."; break;
					default: text = "Couldn't save for some reason. Sorry. Try later."; break;
				}
				var target = (optmessage ? optmessage : 'save_buttons');
				if($(target)) $(target).innerHTML = '<a class="buddy_removed" href="#nogo">'+text+'</a>';
				if (Mailbox && Mailbox.m_current_thread) Mailbox.addSystemMessage ('buddy', text);
			}
		});
	},
	
	/* Site specific ------------------------------------------------------------------------------ */


    // 
    
    updateStats: function(name, value, type, hash, optional_params) {
         new Ajax.Request("/poststat",{
             method : "get",
             parameters : {"name" : name, "value" : value, "type" : type, "hash" : hash, "rnd" : Math.random()},
             onSuccess  : util.updateStats_cb.bindAsEventListener(util, optional_params)
             });
    },
    
    updateStats_cb : function(transport, optional_params) {
               
         var res = transport.responseText.evalJSON();
         if (res.error) {
             alert("Stat posting error" + res.error);
         }
 	 if (optional_params && optional_params["cb"]) {
	     optional_params.cb();
         }
         if (optional_params && optional_params["redirect_to"]) {
             window.location.href = optional_params["redirect_to"];
         }
    },

    
	checkNonbotAjax:function(url) // may move this to profile if it has no other use
	{
		jax = new Ajax.Request(
			url,
			{
				method: "get",
				parameters: {"nonbot": 1},
				onSuccess: function(){},
				onFailure: function(){}
			}
		);
		return true;//jax;  // why pass object?
	},

    printOptimateAd: function() {
         var optimates = ["business","green","technology","entertainment","relationships","astrology"];
         var i = Math.floor(Math.random() * optimates.length);
         var choice = optimates[i];
         $("optimate-ad").innerHTML = '<a target="new" href="/ads3?adClicked='+(i+10)+'&sourcePage=unavailable&sourceViewer=unavailable&redirect=/adcode/optimate_' + choice + '.html">Here\'s something random: <strong>'
         + choice + ' movie</strong></a>';
    },
    
	displayAdvert:function(position,keywords,isloggedin,slot_name)
	{

	    slot_name = slot_name || "Other";
	
		switch(position)
		{
			case "sky" 	: slot_addon = "Sky"; break;
			case "LB" 	: slot_addon = "Ldr"; break;
			case "rect" : slot_addon = "Box"; break;
		}
	
	    if (position != "transitional") { slot_name = slot_name + "_" +  slot_addon;}

	    if (position == "Left" || position == "sky") {
	        width = 160; height = 600;
	    } else if (position == "Top" || position == "LB") {
	        width = 728; height = 90;
	    } else if (position == "Middle" || position == "rect") {
	        width = 300; height = 250;
	    } else if (position == "Right3") {
	        width = 200; height = 500;
	    } else if (position == "Transitional" || position == "transitional") {
	        width = 500; height = 500;
		} else {
	        width = 40; height = 40;
	    }
	    
	    // Width and height added to url to pass cgi to ZEDO
	    var url = "http://ads.okcimg.com/google/ad_manager?ad_slot="+slot_name+"&keywords="+keywords+"&pass_height="+height+"&pass_width="+width;

	    document.write("<iframe id=\"ad_frame_"+position+"\"  width=" + width + " height=" + height + 
	            " marginwidth=0 marginheight=0 hspace=0 vspace=0" + 
	            " frameborder=0 scrolling=no bordercolor=\"#000000\"" +
	            " src=\"" + url + "\"></iframe>");
	},

    ads3_call:function(id, params) {
        
        if(GOOGLE_PUNCH == true) {
            return;
        }

        var get_src = window.location.toString();
        var parseit = get_src.substring(get_src.indexOf("/",7));
        if(parseit.indexOf("?") != -1) parseit = parseit.substring(0,parseit.indexOf("?"));

        params += "&sourcePage=" + parseit;
        params += "&section=" + id;



        new Ajax.Request(
            "/ads3",
            {
                method:'get',
                parameters: params,
                evalScripts: true,
                onSuccess:function(response)
                {
                    if(id=='ad_set_top_profile' && response.responseText.indexOf("good_to_show") != -1)
                    {
                        $('topset').style.background = "#CDD9E6";
                        $('top_cycle').style.display = "block";
                        $('ad_set_top_profile').innerHTML = response.responseText;
                    } else {
                        $('topset').style.display = "none";
                    }   
                }
            }
        );
     },
     
     // Moved back here because we'll have to flip for non-admin accounts
     flipDesign:function() {
         var c = getCookie("redesign");
         if (c && c == "1") {
	     util.updateStats("ui - flip from redesign", 1, "counter", "usxK7602Ep+KxarPcj+Cs4vm3YA=");
                setCookie("redesign","0",secondsFromNow(86400*30));
         }
         else {
	     util.updateStats("ui - flip to redesign", 1, "counter", "N+mQqECk84TokAOpPNLkOJ0glcs=");
                setCookie("redesign","1",secondsFromNow(86400*30));
         }
	 setTimeout("document.location.reload();",500);
     },

	
	/* Fixes the left_bar/main_content height problem ------------------------ */

	adjustMCHeight:function() {
		// none of this matters if the left_bar isn't present
		//
		if ($('left_bar')) {
			var lb_height = $('left_bar').getHeight() + 10; // 10px for margin
			var mc_height = $('main_content').getHeight();
		
			if (!$('hold_mc_height')) {
				// create the hidden input to hold previous size
				var hold_mc_height = '<p class="hidden"><input type="hidden" name="hold_mc_height" value="'+ mc_height +'" id="hold_mc_height" /><\/p>';
			
				// insert it into the bottom of the footer
				$('footer').insert(hold_mc_height, { position: "bottom" });
			}
			else if (lb_height < $F('hold_mc_height')) {					
			  if(BrowserDetect.browser =="Explorer" && BrowserDetect.version == 6)
				    $('main_content').style.height = $F('hold_mc_height') + "px";
				else 
				    $('main_content').style.minHeight = $F('hold_mc_height') + "px";
			}
		
			if (lb_height > mc_height) {
			    if(BrowserDetect.browser =="Explorer" && BrowserDetect.version == 6)
				    $('main_content').style.height = lb_height + "px";
				else 
				    $('main_content').style.minHeight = lb_height + "px";
				
			}
		}
	},

	update_buzz_topic:function(topic)
	{
		$('set_topic_btn').style.display = "none";
		$('set_topic_spinner').style.display = "inline";
		
		$('lb_set_chat_input').style.background = "#1E3F66";
		$('lb_set_chat_input').style.color = "#325279";
		
		new Ajax.Request(
			"/instantevents",
			{
				method:"get",
				parameters:{
					buzz_topic:topic,
					"im.add_topic_ajax":1
				},
				onSuccess:function(response)
				{
					$('lb_set_chat_input').disabled = true;
					$('set_topic_success').style.display = "inline";
					$('set_topic_spinner').style.display = "none";
					
					if($("topic_name"))
						$("topic_name").value = $('lb_set_chat_input').value;
				}
			}
		);
	},
    
	/* IE fixes ----------------------------------------------------------------------------------- */

	// because IE seems to only like document.getElementsByClassName() and
	// not element.getElementsByClassName()
	//
	getElementsByClassName:function(parent, class_name)
	{
		var o = parent.getElementsByTagName('*'); // get all elements under parent
		var a = new Array();
	
		for (var i = 0; i < o.length; i++) {
			// does the element have the class attribute and does class_name exist 
			if (o[i].attributes["class"] && o[i].attributes["class"].value.toString().indexOf(class_name) != -1) {
				a.push(o[i]); // push elements onto array
			}
		}
	
		return a;
	},
	
	clearRecentlyViewed : function() {
		new Ajax.Request("/sookie/clear_recently_viewed.html?" + Math.random());	
		if($("lsRecent")) $("lsRecent").hide();
		else if($("recently_viewed")) $("recently_viewed").hide();
		if($("lsRecentContent")) $("lsRecentContent").hide();	
	},
	
	toggleSavedProfiles:function(id)
	{
		var saved_display = NanoCookie.get('saved_display');
		
		// toggle the section
		this.toggle(id, 32);
		
		// set the cookie for 2 hours if it isn't set
		if (!saved_display) NanoCookie.set('saved_display', '1', {ms: 7200*1000});
	},
    
    // 
    uidBit: function(uid_str, which_bit) {
        if (which_bit < 1 || which_bit > 8) alert ("Whoa; UID bit function works 1..8");
        var tail = uid_str.substr(uid_str.length - 9);
        while(tail.charAt(0) == "0") {
            tail = tail.substr(1);
        }
        var num = parseInt(tail);
        if (num & Math.pow(2,(which_bit-1))) {
            return 1;
        }
        else {
            return 0;
        }
    },

    // simple profiling

	startTimer: function(label) {
		if (! this.timerStats) {
			this.timerStats = {};
		}
		if (! this.timerStats[label]) {
			this.timerStats[label] = {"starts" : [], "stops" : []};
		}
		this.timerStats[label].starts.push(new Date());		
	},

	stopTimer : function(label) {
		if (! this.timerStats 
			|| ! this.timerStats[label] 
			|| this.timerStats[label].stops.length >= this.timerStats[label].starts.length) {
			alert("prematurely called stopTimer. Make sure you call startTimer first for label " + label);
		}
		else {
			this.timerStats[label].stops.push(new Date());
		}
	},
	
	summarizeTimers : function() {
		var res = "";
		for (var key in this.timerStats) {
			var label_time = 0;
			var samples = this.timerStats[key].stops.length;
			for (var i = 0; i < samples; i++) {
				label_time += this.timerStats[key].stops[i].getTime() - this.timerStats[key].starts[i].getTime();		
			}
			res+="<br /> " + key + ": " + (label_time / samples) + "ms avg. -- " + samples + " sample(s) -- " + label_time + "ms total";
		}
		return res;
	},
	
	doOnDomLoad : function(func) {
		if (! this.m_dom_load_funcs) {
			this.m_dom_load_funcs = [];	
		}
		this.m_dom_load_funcs.push(func);
	},
	
	executeDomLoad : function() {
		if (this.m_dom_load_funcs) {
			for (var i = 0; i < this.m_dom_load_funcs.length; i++) {
				setTimeout(this.m_dom_load_funcs[i], 500);
			}
		}		
     },


	fillInTheP:function() {
		var temp=window.location.href;

		if (temp.indexOf("login?p=") != -1) {
			$('page_url_p').value = temp.substring(temp.indexOf("login?p=")+8);
		}
		else if (temp.indexOf("signup") != -1 && $('page_url_p').value == "") {
			$('page_url_p').value ="/home";
		}
		else if (temp.indexOf("login") == -1 && temp.indexOf(".com") != -1) {
			temp=temp.substring(temp.indexOf(".com"));
			if (temp.indexOf("/") != -1) {
				temp=temp.substring(temp.indexOf("/"));
			}
			if (temp.length > 3) {
				$('page_url_p').value = temp;
			}
		}
	},
	
	hideBottomBar:function() {
		if ($('footer_signup_wrapper'))
			$('footer_signup_wrapper').hide();
	},
	
	toggleClass:function(b, c) {
		// get class the old school way because Prototype's hasClass() doesn't work well in IE
		var hasClass = b.attributes['class'].value.search(c);
		
		// using this method because add/removeClass() doesn't work well in IEs either
		if (hasClass != -1)
			b.className = b.className.replace(new RegExp(' '+c+'\\b'), '');
		else
			b.className += ' '+c;
	},
	// 
	constrainImageWidthAfterLoad : function(im, maxwidth) {
		if (im.width > maxwidth) {
			im.style.width = "";
			im.style.height = "";
			im.height = Math.round(maxwidth * im.height / im.width);
			im.width = maxwidth;
		}
	},

	// 

	floatADivOnDomLoad : function(id, parentid) {
		util.doOnDomLoad( function() {
			if ($(id)) document.observe('scroll', util.floatADivOnScrollHandler.bind(this,id,parentid));
			// this is for the IEs                                                                                   
			if (window.attachEvent && $(id)) window.attachEvent("onscroll", util.floatADivOnScrollHandler.bind(this,id, parentid));	
		});
	},
	
	// 
	floatADivOnScrollHandler : function(id, parentid) {
		var b = $(id);
		var par = $(parentid);
		var coff = par.cumulativeOffset()[1];
		var csoff = par.cumulativeScrollOffset()[1];
		if (coff < csoff) 
			b.style.position = "fixed";
		else 
			b.style.position = "static";
	},
	// 
	toMask : function() {
	  	var res = 0;
	
	  	if(typeof arguments[0] == "object")
			bits = arguments[0];
		else 
			bits = arguments;
			
	  	for (var i = 0; i < bits.length;i++) {
		 	if (bits[i] > 31 || bits[i] < 0)
				throw("fillBitsInMask expects ints in [0..30] due to JS bitwise limitations");
			res = res | Math.pow(2,bits[i]);
	  	}
	  	return res;
	},
	// 
	fromMaskToList : function(mask) {
		var res = [];
		for (var i = 0; i < 31; i++)
			if (Math.pow(2,i) & mask)
				res.push(i);
		return res;
	},
	// 
	isBitSetInMask : function(mask, bit) {
		return Math.pow(2, bit) & mask ? 1 : 0;
	},
	
	/* Mobile toggle */
	
	flipMobile:function(mobile) {
		if(mobile) {
			target = 0;
			cgi = "enable_mobile=";
		} else {
			target = 1;
			cgi = "disable_mobile=";
		}
		
		url = window.location.toString().replace(/[&?](en|dis)able_mobile=1/g,"");

		gluon = (url.indexOf("?") != -1 ? "&" : "?");
		url = url + gluon + cgi + "1";
		
		new Ajax.Request(
			"/settings", 
			{
				method: 'get', 
				parameters: {
					update_ui_prefs:1,
					bit:62,
					val:target
				},
				onSuccess:function() { window.location = url; }
			}
		);
	}
};
/*  */


/* Extensions to the Element class ------------------------------------------ */

// Use Object.extend instead of Element.prototype= because IE6 doesn't support that.  Thanks Prototype!
Object.extend(Element.Methods, {
	
	// Finds inputs with the given class name and returns the values of the ones that are selected.
	getValues: function (element, class_name) {
		return element.select('input.' + class_name).collect(function(input) {return input.checked ? input.value : 0}).without(0).reduce() || null;
	},
	
	// Pulses an element if it's visible; otherwise, makes it visible.
	showOrPulse: function (element) {
		element.visible() ? element.pulsate ({pulses: 2, duration: 0.6}) : element.show ();
	},
	
	// Remove the class names from elements in the array passed in.
	removeClassNames: function (element, class_names) {
		for (var i = 0; i < class_names.length; i++) {
			element.removeClassName (class_names[i]);
		}
		return element;
	}
});

// Add the methods to the element class
Element.addMethods ();

/* /extensions to the Element class ----------------------------------------- */


/* Further work and future integration */

function updateFavCount() {
	var num_favs_online = document.getElementById('favs_online').getElementsByTagName('li').length - 1;
	var favs_count_span = document.getElementById('favs_count');
	
	if (num_favs_online > 0) {
		favs_count_span.getElementsByTagName('strong')[0].innerHTML = num_favs_online;
		favs_count_span.style.display = "";
	}
}

function checkForm(tab){ // check if user has made a from entry

    if((FormId == "profileeditform") && (tab == "profileedit" ||  tab == "details")) {

        tab = (tab == "details" ? tab : "essays");

        $("tab-" + OldId).removeClassName("tab-on");
        $("tab-" + tab).addClassName("tab-on");
        displayDiv(tab);
    } else {
        if(FormId != 'picturerows' && SerializedForm != Form.serialize(FormId)) {

            $(FormId).action += "?tab=" + tab; // redirect to tabbed page after form submission

            if(FormId == "settingsform"){ // check if user entered password
    	        if(!document.getElementById("settingsSubmit").disabled) {
        		    $(FormId).submit(); // submit changes
        	    } else {
        		    alert("Please enter your password to save your settings.");
        		    document.getElementById("oldPassword").focus();
        	    }
            } else {
                $(FormId).submit(); // submit changes
            }

        } else { // send user to tabbed page

            if(tab == "details"){ // "details" and "essays" tab share the same page
                page = "profileedit";
            } else {
                page = tab;
            }
            document.location.href = "/" + page + "?tab=" + tab;
        }
    }

}

var util = Utilities;

// these functions probably have prototype equivalents; deprecate or move to utility array funcs
// Note: these do NOT have prototype equivalents; assess later, fine for now

/* standard?  how far back does this go? */

if(typeof Array.prototype.push=='undefined')
  Array.prototype.push=function(){
    var i=0;
    b=this.length;a=arguments;
    for(i;i<a.length;i++)this[b+i]=a[i];
    return this.length;
  };



function pushFront(A, x, maxsize) {
 var i=A.length;
 if (maxsize && i>maxsize - 1)
  i=maxsize - 1;
 while (i>0) {
  A[i] = A[i-1];
  i--;
 }
 A[0] = x;
}

function popMiddle(A,i) {
  var x;
  if (i>A.length-1)
    return (false);
  for (x=i; x<A.length-1; x++)
     A[x]=A[x+1];
  A.length=A.length-1;
  return (true);
}

function popFront(A) {
  return (popMiddle(A,0));
}

function moveToFront(A,i) {
 var temp=A[i];
 while (i>0) {
  A[i]=A[i-1];
  i--;
 }
 A[0]=temp;
}

// 

function $RF(el, radioGroup) {
    if($(el).type && $(el).type.toLowerCase() == 'radio') {
        var radioGroup = $(el).name;
        var el = $(el).form;
    } else if ($(el).tagName.toLowerCase() != 'form') {
        return false;
    }

    var checked = $(el).getInputs('radio', radioGroup).find(
        function(re) {return re.checked;}
    );
    return (checked) ? $F(checked) : null;
}


function favorites_toggle() {
    var toggle_text = $("favs_toggle");
    
    if($bit.get(33) == 1)
        toggle_text.innerHTML = "Show offline users";
    else
        toggle_text.innerHTML = "Hide offline users";
        
    util.toggle('favs_offline', 33);
}

function topics_toggle() {
    var topic_toggle = $("topic_toggle");
    
    if($bit.get(36) == 0)
        topic_toggle.innerHTML = "Show Topics";
    else
        topic_toggle.innerHTML = "Hide Topics";
        
	util.toggle('lb_recent_topics',36);
}





/* On DOM/window load events */
util.doOnDomLoad(
			function()
			{
				if($("ads3_set_leftbar")) Utilities.ads3_call("ads3_set_leftbar","showAd=1&adEvent=4&adEventAdId=1");
			
					// fill in the hidden p on logged out pages only
					if ($('header_login')) util.fillInTheP();
			
					// show the save profiles menu in the left bar for two ours (based on the cookie)
					if ($('lb_favorites_menu') && !NanoCookie.get('saved_display')) $('lb_favorites_menu').style.display = "";
					
					// adjust the page's height on load
					// you can move this if it makes you unhappy here [AS]
					Utilities.adjustMCHeight();
			}
);

Utilities.setDefaultText("mainMenuSearchBox", ""); // old search box
Utilities.setDefaultText("site_search_query", ""); // new search box

var GOOGLE_PUNCH = false;
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/prototype_abort.js
AUTOCORE_SELF_CHECK.push("prototype_abort.js");
if (typeof(Ajax) != "undefined") {
   Ajax.Request.prototype.abort = function() {
    var abort_type = typeof this.transport.abort;
    if (abort_type == "function") {
        this.transport.onreadystatechange = Prototype.emptyFunction;
        this.transport.abort();
        Ajax.activeRequestCount--;
    }
   };
					       } 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/scriptaculous-1.8.1-for-autocore/scriptaculous.js
AUTOCORE_SELF_CHECK.push("scriptaculous-1.8.1-for-autocore/scriptaculous.js");

var Scriptaculous = {
  Version: '1.8.1',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
  },
  REQUIRED_PROTOTYPE: '1.6.0',
  load: function() {
    function convertVersionString(versionString){
      var r = versionString.split('.');
      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
    }
 
//    if((typeof Prototype=='undefined') || 
//       (typeof Element == 'undefined') || 
//       (typeof Element.Methods=='undefined') ||
//       (convertVersionString(Prototype.Version) < 
//        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
//       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
//        Scriptaculous.REQUIRED_PROTOTYPE);
    
//    $A(document.getElementsByTagName("script")).findAll( function(s) {
//      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
//    }).each( function(s) {
//      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
//      var includes = s.src.match(/\?.*load=([a-z,]*)/);
//      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
//       function(include) { Scriptaculous.require(path+include+'.js') });
//    });
  }
}

Scriptaculous.load(); 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/scriptaculous-1.8.1-for-autocore/effects.js
AUTOCORE_SELF_CHECK.push("scriptaculous-1.8.1-for-autocore/effects.js");
// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
//  Justin Palmer (http://encytemedia.com/)
//  Mark Pilgrim (http://diveintomark.org/)
//  Martin Bialasinki
// 
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ 

// converts rgb() and #xxx to #xxxxxx format,  
// returns self (or first argument) if not convertable  
String.prototype.parseColor = function() {  
  var color = '#';
  if (this.slice(0,4) == 'rgb(') {  
    var cols = this.slice(4,this.length-1).split(',');  
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
  } else {  
    if (this.slice(0,1) == '#') {  
      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
      if (this.length==7) color = this.toLowerCase();  
    }  
  }  
  return (color.length==7 ? color : (arguments[0] || this));  
};

/*--------------------------------------------------------------------------*/

Element.collectTextNodes = function(element) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
  }).flatten().join('');
};

Element.collectTextNodesIgnoreClass = function(element, className) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
        Element.collectTextNodesIgnoreClass(node, className) : ''));
  }).flatten().join('');
};

Element.setContentZoom = function(element, percent) {
  element = $(element);  
  element.setStyle({fontSize: (percent/100) + 'em'});   
  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
  return element;
};

Element.getInlineOpacity = function(element){
  return $(element).style.opacity || '';
};

Element.forceRerendering = function(element) {
  try {
    element = $(element);
    var n = document.createTextNode(' ');
    element.appendChild(n);
    element.removeChild(n);
  } catch(e) { }
};

/*--------------------------------------------------------------------------*/

var Effect = {
  _elementDoesNotExistError: {
    name: 'ElementDoesNotExistError',
    message: 'The specified DOM element does not exist, but is required for this effect to operate'
  },
  Transitions: {
    linear: Prototype.K,
    sinoidal: function(pos) {
      return (-Math.cos(pos*Math.PI)/2) + 0.5;
    },
    reverse: function(pos) {
      return 1-pos;
    },
    flicker: function(pos) {
      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
      return pos > 1 ? 1 : pos;
    },
    wobble: function(pos) {
      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
    },
    pulse: function(pos, pulses) { 
      pulses = pulses || 5; 
      return (
        ((pos % (1/pulses)) * pulses).round() == 0 ? 
              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
        );
    },
    spring: function(pos) { 
      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
    },
    none: function(pos) {
      return 0;
    },
    full: function(pos) {
      return 1;
    }
  },
  DefaultOptions: {
    duration:   1.0,   // seconds
    fps:        100,   // 100= assume 66fps max.
    sync:       false, // true for combining
    from:       0.0,
    to:         1.0,
    delay:      0.0,
    queue:      'parallel'
  },
  tagifyText: function(element) {
    var tagifyStyle = 'position:relative';
    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
    
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if (child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            new Element('span', {style: tagifyStyle}).update(
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if (((typeof element == 'object') || 
        Object.isFunction(element)) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || { });
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || { });
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};

Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;

/* ------------- core effects ------------- */

Effect.ScopedQueue = Class.create(Enumerable, {
  initialize: function() {
    this.effects  = [];
    this.interval = null;    
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = Object.isString(effect.options.queue) ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'with-last':
        timestamp = this.effects.pluck('startOn').max() || timestamp;
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if (!this.interval)
      this.interval = setInterval(this.loop.bind(this), 15);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if (this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    for(var i=0, len=this.effects.length;i<len;i++) 
      this.effects[i] && this.effects[i].loop(timePos);
  }
});

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if (!Object.isString(queueName)) return queueName;
    
    return this.instances.get(queueName) ||
      this.instances.set(queueName, new Effect.ScopedQueue());
  }
};
Effect.Queue = Effect.Queues.get('global');

Effect.Base = Class.create({
  position: null,
  start: function(options) {
    function codeForEvent(options,eventName){
      return (
        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
      );
    }
    if (options && options.transition === false) options.transition = Effect.Transitions.linear;
    this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn+(this.options.duration*1000);
    this.fromToDelta  = this.options.to-this.options.from;
    this.totalTime    = this.finishOn-this.startOn;
    this.totalFrames  = this.options.fps*this.options.duration;
    
    eval('this.render = function(pos){ '+
      'if (this.state=="idle"){this.state="running";'+
      codeForEvent(this.options,'beforeSetup')+
      (this.setup ? 'this.setup();':'')+ 
      codeForEvent(this.options,'afterSetup')+
      '};if (this.state=="running"){'+
      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
      'this.position=pos;'+
      codeForEvent(this.options,'beforeUpdate')+
      (this.update ? 'this.update(pos);':'')+
      codeForEvent(this.options,'afterUpdate')+
      '}}');
    
    this.event('beforeStart');
    if (!this.options.sync)
      Effect.Queues.get(Object.isString(this.options.queue) ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if (timePos >= this.startOn) {
      if (timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if (this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / this.totalTime,
          frame = (pos * this.totalFrames).round();
      if (frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  cancel: function() {
    if (!this.options.sync)
      Effect.Queues.get(Object.isString(this.options.queue) ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if (this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    var data = $H();
    for(property in this)
      if (!Object.isFunction(this[property])) data.set(property, this[property]);
    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
});

Effect.Parallel = Class.create(Effect.Base, {
  initialize: function(effects) {
    this.effects = effects || [];
    this.start(arguments[1]);
  },
  update: function(position) {
    this.effects.invoke('render', position);
  },
  finish: function(position) {
    this.effects.each( function(effect) {
      effect.render(1.0);
      effect.cancel();
      effect.event('beforeFinish');
      if (effect.finish) effect.finish(position);
      effect.event('afterFinish');
    });
  }
});

Effect.Tween = Class.create(Effect.Base, {
  initialize: function(object, from, to) {
    object = Object.isString(object) ? $(object) : object;
    var args = $A(arguments), method = args.last(), 
      options = args.length == 5 ? args[3] : null;
    this.method = Object.isFunction(method) ? method.bind(object) :
      Object.isFunction(object[method]) ? object[method].bind(object) : 
      function(value) { object[method] = value };
    this.start(Object.extend({ from: from, to: to }, options || { }));
  },
  update: function(position) {
    this.method(position);
  }
});

Effect.Event = Class.create(Effect.Base, {
  initialize: function() {
    this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
  },
  update: Prototype.emptyFunction
});

Effect.Opacity = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    // make this work on IE on elements without 'layout'
    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
      this.element.setStyle({zoom: 1});
    var options = Object.extend({
      from: this.element.getOpacity() || 0.0,
      to:   1.0
    }, arguments[1] || { });
    this.start(options);
  },
  update: function(position) {
    this.element.setOpacity(position);
  }
});

Effect.Move = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || { });
    this.start(options);
  },
  setup: function() {
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if (this.options.mode == 'absolute') {
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: (this.options.x  * position + this.originalLeft).round() + 'px',
      top:  (this.options.y  * position + this.originalTop).round()  + 'px'
    });
  }
});

// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
};

Effect.Scale = Class.create(Effect.Base, {
  initialize: function(element, percent) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      scaleX: true,
      scaleY: true,
      scaleContent: true,
      scaleFromCenter: false,
      scaleMode: 'box',        // 'box' or 'contents' or { } with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || { });
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');
    
    this.originalStyle = { };
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    
    var fontSize = this.element.getStyle('font-size') || '100%';
    ['em','px','%','pt'].each( function(fontSizeType) {
      if (fontSize.indexOf(fontSizeType)>0) {
        this.fontSize     = parseFloat(fontSize);
        this.fontSizeType = fontSizeType;
      }
    }.bind(this));
    
    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    
    this.dims = null;
    if (this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if (/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if (!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
    if (this.options.scaleContent && this.fontSize)
      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
  },
  finish: function(position) {
    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = { };
    if (this.options.scaleX) d.width = width.round() + 'px';
    if (this.options.scaleY) d.height = height.round() + 'px';
    if (this.options.scaleFromCenter) {
      var topd  = (height - this.dims[0])/2;
      var leftd = (width  - this.dims[1])/2;
      if (this.elementPositioning == 'absolute') {
        if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
        if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
      } else {
        if (this.options.scaleY) d.top = -topd + 'px';
        if (this.options.scaleX) d.left = -leftd + 'px';
      }
    }
    this.element.setStyle(d);
  }
});

Effect.Highlight = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
    this.start(options);
  },
  setup: function() {
    // Prevent executing on elements not in the layout flow
    if (this.element.getStyle('display')=='none') { this.cancel(); return; }
    // Disable background image during the effect
    this.oldStyle = { };
    if (!this.options.keepBackgroundImage) {
      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
      this.element.setStyle({backgroundImage: 'none'});
    }
    if (!this.options.endcolor)
      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
    if (!this.options.restorecolor)
      this.options.restorecolor = this.element.getStyle('background-color');
    // init color calculations
    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
  },
  update: function(position) {
    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
      return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
  },
  finish: function() {
    this.element.setStyle(Object.extend(this.oldStyle, {
      backgroundColor: this.options.restorecolor
    }));
  }
});

Effect.ScrollTo = function(element) {
  var options = arguments[1] || { },
    scrollOffsets = document.viewport.getScrollOffsets(),
    elementOffsets = $(element).cumulativeOffset(),
    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  

  if (options.offset) elementOffsets[1] += options.offset;

  return new Effect.Tween(null,
    scrollOffsets.top,
    elementOffsets[1] > max ? max : elementOffsets[1],
    options,
    function(p){ scrollTo(scrollOffsets.left, p.round()) }
  );
};

/* ------------- combination effects ------------- */

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
    from: element.getOpacity() || 1.0,
    to:   0.0,
    afterFinishInternal: function(effect) { 
      if (effect.options.to!=0) return;
      effect.element.hide().setStyle({opacity: oldOpacity}); 
    }
  }, arguments[1] || { });
  return new Effect.Opacity(element,options);
};

Effect.Appear = function(element) {
  element = $(element);
  var options = Object.extend({
  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
  to:   1.0,
  // force Safari to render floated elements properly
  afterFinishInternal: function(effect) {
    effect.element.forceRerendering();
  },
  beforeSetup: function(effect) {
    effect.element.setOpacity(effect.options.from).show(); 
  }}, arguments[1] || { });
  return new Effect.Opacity(element,options);
};

Effect.Puff = function(element) {
  element = $(element);
  var oldStyle = { 
    opacity: element.getInlineOpacity(), 
    position: element.getStyle('position'),
    top:  element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height
  };
  return new Effect.Parallel(
   [ new Effect.Scale(element, 200, 
      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
     Object.extend({ duration: 1.0, 
      beforeSetupInternal: function(effect) {
        Position.absolutize(effect.effects[0].element)
      },
      afterFinishInternal: function(effect) {
         effect.effects[0].element.hide().setStyle(oldStyle); }
     }, arguments[1] || { })
   );
};

Effect.BlindUp = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0,
    Object.extend({ scaleContent: false, 
      scaleX: false, 
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping();
      } 
    }, arguments[1] || { })
  );
};

Effect.BlindDown = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false,
    scaleFrom: 0,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.undoClipping();
    }
  }, arguments[1] || { }));
};

Effect.SwitchOff = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  return new Effect.Appear(element, Object.extend({
    duration: 0.4,
    from: 0,
    transition: Effect.Transitions.flicker,
    afterFinishInternal: function(effect) {
      new Effect.Scale(effect.element, 1, { 
        duration: 0.3, scaleFromCenter: true,
        scaleX: false, scaleContent: false, restoreAfterFinish: true,
        beforeSetup: function(effect) { 
          effect.element.makePositioned().makeClipping();
        },
        afterFinishInternal: function(effect) {
          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
        }
      })
    }
  }, arguments[1] || { }));
};

Effect.DropOut = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left'),
    opacity: element.getInlineOpacity() };
  return new Effect.Parallel(
    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    Object.extend(
      { duration: 0.5,
        beforeSetup: function(effect) {
          effect.effects[0].element.makePositioned(); 
        },
        afterFinishInternal: function(effect) {
          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
        } 
      }, arguments[1] || { }));
};

Effect.Shake = function(element) {
  element = $(element);
  var options = Object.extend({
    distance: 20,
    duration: 0.5
  }, arguments[1] || {});
  var distance = parseFloat(options.distance);
  var split = parseFloat(options.duration) / 10.0;
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left') };
    return new Effect.Move(element,
      { x:  distance, y: 0, duration: split, afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
        effect.element.undoPositioned().setStyle(oldStyle);
  }}) }}) }}) }}) }}) }});
};

Effect.SlideDown = function(element) {
  element = $(element).cleanWhitespace();
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false, 
    scaleFrom: window.opera ? 0 : 1,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if (window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
    }, arguments[1] || { })
  );
};

Effect.SlideUp = function(element) {
  element = $(element).cleanWhitespace();
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, window.opera ? 0 : 1,
   Object.extend({ scaleContent: false, 
    scaleX: false, 
    scaleMode: 'box',
    scaleFrom: 100,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if (window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().show();
    },  
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' });
    },
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
    }
   }, arguments[1] || { })
  );
};

// Bug in opera makes the TD containing this element expand for a instance after finish 
Effect.Squish = function(element) {
  return new Effect.Scale(element, window.opera ? 1 : 0, { 
    restoreAfterFinish: true,
    beforeSetup: function(effect) {
      effect.element.makeClipping(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping(); 
    }
  });
};

Effect.Grow = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.full
  }, arguments[1] || { });
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();    
  var initialMoveX, initialMoveY;
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      initialMoveX = initialMoveY = moveX = moveY = 0; 
      break;
    case 'top-right':
      initialMoveX = dims.width;
      initialMoveY = moveY = 0;
      moveX = -dims.width;
      break;
    case 'bottom-left':
      initialMoveX = moveX = 0;
      initialMoveY = dims.height;
      moveY = -dims.height;
      break;
    case 'bottom-right':
      initialMoveX = dims.width;
      initialMoveY = dims.height;
      moveX = -dims.width;
      moveY = -dims.height;
      break;
    case 'center':
      initialMoveX = dims.width / 2;
      initialMoveY = dims.height / 2;
      moveX = -dims.width / 2;
      moveY = -dims.height / 2;
      break;
  }
  
  return new Effect.Move(element, {
    x: initialMoveX,
    y: initialMoveY,
    duration: 0.01, 
    beforeSetup: function(effect) {
      effect.element.hide().makeClipping().makePositioned();
    },
    afterFinishInternal: function(effect) {
      new Effect.Parallel(
        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
          new Effect.Scale(effect.element, 100, {
            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
        ], Object.extend({
             beforeSetup: function(effect) {
               effect.effects[0].element.setStyle({height: '0px'}).show(); 
             },
             afterFinishInternal: function(effect) {
               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
             }
           }, options)
      )
    }
  });
};

Effect.Shrink = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.none
  }, arguments[1] || { });
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      moveX = moveY = 0;
      break;
    case 'top-right':
      moveX = dims.width;
      moveY = 0;
      break;
    case 'bottom-left':
      moveX = 0;
      moveY = dims.height;
      break;
    case 'bottom-right':
      moveX = dims.width;
      moveY = dims.height;
      break;
    case 'center':  
      moveX = dims.width / 2;
      moveY = dims.height / 2;
      break;
  }
  
  return new Effect.Parallel(
    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    ], Object.extend({            
         beforeStartInternal: function(effect) {
           effect.effects[0].element.makePositioned().makeClipping(); 
         },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
       }, options)
  );
};

Effect.Pulsate = function(element) {
  element = $(element);
  var options    = arguments[1] || { };
  var oldOpacity = element.getInlineOpacity();
  var transition = options.transition || Effect.Transitions.sinoidal;
  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
  reverser.bind(transition);
  return new Effect.Opacity(element, 
    Object.extend(Object.extend({  duration: 2.0, from: 0,
      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
    }, options), {transition: reverser}));
};

Effect.Fold = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height };
  element.makeClipping();
  return new Effect.Scale(element, 5, Object.extend({   
    scaleContent: false,
    scaleX: false,
    afterFinishInternal: function(effect) {
    new Effect.Scale(element, 1, { 
      scaleContent: false, 
      scaleY: false,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping().setStyle(oldStyle);
      } });
  }}, arguments[1] || { }));
};

Effect.Morph = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      style: { }
    }, arguments[1] || { });
    
    if (!Object.isString(options.style)) this.style = $H(options.style);
    else {
      if (options.style.include(':'))
        this.style = options.style.parseStyle();
      else {
        this.element.addClassName(options.style);
        this.style = $H(this.element.getStyles());
        this.element.removeClassName(options.style);
        var css = this.element.getStyles();
        this.style = this.style.reject(function(style) {
          return style.value == css[style.key];
        });
        options.afterFinishInternal = function(effect) {
          effect.element.addClassName(effect.options.style);
          effect.transforms.each(function(transform) {
            effect.element.style[transform.style] = '';
          });
        }
      }
    }
    this.start(options);
  },
  
  setup: function(){
    function parseColor(color){
      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
      color = color.parseColor();
      return $R(0,2).map(function(i){
        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
      });
    }
    this.transforms = this.style.map(function(pair){
      var property = pair[0], value = pair[1], unit = null;

      if (value.parseColor('#zzzzzz') != '#zzzzzz') {
        value = value.parseColor();
        unit  = 'color';
      } else if (property == 'opacity') {
        value = parseFloat(value);
        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
          this.element.setStyle({zoom: 1});
      } else if (Element.CSS_LENGTH.test(value)) {
          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
          value = parseFloat(components[1]);
          unit = (components.length == 3) ? components[2] : null;
      }

      var originalValue = this.element.getStyle(property);
      return { 
        style: property.camelize(), 
        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
        targetValue: unit=='color' ? parseColor(value) : value,
        unit: unit
      };
    }.bind(this)).reject(function(transform){
      return (
        (transform.originalValue == transform.targetValue) ||
        (
          transform.unit != 'color' &&
          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
        )
      )
    });
  },
  update: function(position) {
    var style = { }, transform, i = this.transforms.length;
    while(i--)
      style[(transform = this.transforms[i]).style] = 
        transform.unit=='color' ? '#'+
          (Math.round(transform.originalValue[0]+
            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
          (Math.round(transform.originalValue[1]+
            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
          (Math.round(transform.originalValue[2]+
            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
        (transform.originalValue +
          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
            (transform.unit === null ? '' : transform.unit);
    this.element.setStyle(style, true);
  }
});

Effect.Transform = Class.create({
  initialize: function(tracks){
    this.tracks  = [];
    this.options = arguments[1] || { };
    this.addTracks(tracks);
  },
  addTracks: function(tracks){
    tracks.each(function(track){
      track = $H(track);
      var data = track.values().first();
      this.tracks.push($H({
        ids:     track.keys().first(),
        effect:  Effect.Morph,
        options: { style: data }
      }));
    }.bind(this));
    return this;
  },
  play: function(){
    return new Effect.Parallel(
      this.tracks.map(function(track){
        var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
        var elements = [$(ids) || $$(ids)].flatten();
        return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
      }).flatten(),
      this.options
    );
  }
});

Element.CSS_PROPERTIES = $w(
  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
  'fontSize fontWeight height left letterSpacing lineHeight ' +
  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
  'right textIndent top width wordSpacing zIndex');
  
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;

String.__parseStyleElement = document.createElement('div');
String.prototype.parseStyle = function(){
  var style, styleRules = $H();
  if (Prototype.Browser.WebKit)
    style = new Element('div',{style:this}).style;
  else {
    String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
    style = String.__parseStyleElement.childNodes[0].style;
  }
  
  Element.CSS_PROPERTIES.each(function(property){
    if (style[property]) styleRules.set(property, style[property]); 
  });
  
  if (Prototype.Browser.IE && this.include('opacity'))
    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);

  return styleRules;
};

if (document.defaultView && document.defaultView.getComputedStyle) {
  Element.getStyles = function(element) {
    var css = document.defaultView.getComputedStyle($(element), null);
    return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
      styles[property] = css[property];
      return styles;
    });
  };
} else {
  Element.getStyles = function(element) {
    element = $(element);
    var css = element.currentStyle, styles;
    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
      results[property] = css[property];
      return results;
    });
    if (!styles.opacity) styles.opacity = element.getOpacity();
    return styles;
  };
};

Effect.Methods = {
  morph: function(element, style) {
    element = $(element);
    new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
    return element;
  },
  visualEffect: function(element, effect, options) {
    element = $(element)
    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
    new Effect[klass](element, options);
    return element;
  },
  highlight: function(element, options) {
    element = $(element);
    new Effect.Highlight(element, options);
    return element;
  }
};

$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
  'pulsate shake puff squish switchOff dropOut').each(
  function(effect) { 
    Effect.Methods[effect] = function(element, options){
      element = $(element);
      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
      return element;
    }
  }
);

$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
  function(f) { Effect.Methods[f] = Element[f]; }
);

Element.addMethods(Effect.Methods);
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/scriptaculous-1.8.1-for-autocore/dragdrop.js
AUTOCORE_SELF_CHECK.push("scriptaculous-1.8.1-for-autocore/dragdrop.js");
// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//           (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
// 
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Droppables = {
  drops: [],

  remove: function(element) {
    this.drops = this.drops.reject(function(d) { return d.element==$(element) });
  },

  add: function(element) {
    element = $(element);
    var options = Object.extend({
      greedy:     true,
      hoverclass: null,
      tree:       false
    }, arguments[1] || { });

    // cache containers
    if(options.containment) {
      options._containers = [];
      var containment = options.containment;
      if(Object.isArray(containment)) {
        containment.each( function(c) { options._containers.push($(c)) });
      } else {
        options._containers.push($(containment));
      }
    }
    
    if(options.accept) options.accept = [options.accept].flatten();

    Element.makePositioned(element); // fix IE
    options.element = element;

    this.drops.push(options);
  },
  
  findDeepestChild: function(drops) {
    deepest = drops[0];
      
    for (i = 1; i < drops.length; ++i)
      if (Element.isParent(drops[i].element, deepest.element))
        deepest = drops[i];
    
    return deepest;
  },

  isContained: function(element, drop) {
    var containmentNode;
    if(drop.tree) {
      containmentNode = element.treeNode; 
    } else {
      containmentNode = element.parentNode;
    }
    return drop._containers.detect(function(c) { return containmentNode == c });
  },
  
  isAffected: function(point, element, drop) {
    return (
      (drop.element!=element) &&
      ((!drop._containers) ||
        this.isContained(element, drop)) &&
      ((!drop.accept) ||
        (Element.classNames(element).detect( 
          function(v) { return drop.accept.include(v) } ) )) &&
      Position.within(drop.element, point[0], point[1]) );
  },

  deactivate: function(drop) {
    if(drop.hoverclass)
      Element.removeClassName(drop.element, drop.hoverclass);
    this.last_active = null;
  },

  activate: function(drop) {
    if(drop.hoverclass)
      Element.addClassName(drop.element, drop.hoverclass);
    this.last_active = drop;
  },

  show: function(point, element) {
    if(!this.drops.length) return;
    var drop, affected = [];
    
    this.drops.each( function(drop) {
      if(Droppables.isAffected(point, element, drop))
        affected.push(drop);
    });
        
    if(affected.length>0)
      drop = Droppables.findDeepestChild(affected);

    if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
    if (drop) {
      Position.within(drop.element, point[0], point[1]);
      if(drop.onHover)
        drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
      
      if (drop != this.last_active) Droppables.activate(drop);
    }
  },

  fire: function(event, element) {
    if(!this.last_active) return;
    Position.prepare();

    if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
      if (this.last_active.onDrop) {
        this.last_active.onDrop(element, this.last_active.element, event); 
        return true; 
      }
  },

  reset: function() {
    if(this.last_active)
      this.deactivate(this.last_active);
  }
}

var Draggables = {
  drags: [],
  observers: [],
  
  register: function(draggable) {
    if(this.drags.length == 0) {
      this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
      this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
      this.eventKeypress  = this.keyPress.bindAsEventListener(this);
      
      Event.observe(document, "mouseup", this.eventMouseUp);
      Event.observe(document, "mousemove", this.eventMouseMove);
      Event.observe(document, "keypress", this.eventKeypress);
    }
    this.drags.push(draggable);
  },
  
  unregister: function(draggable) {
    this.drags = this.drags.reject(function(d) { return d==draggable });
    if(this.drags.length == 0) {
      Event.stopObserving(document, "mouseup", this.eventMouseUp);
      Event.stopObserving(document, "mousemove", this.eventMouseMove);
      Event.stopObserving(document, "keypress", this.eventKeypress);
    }
  },
  
  activate: function(draggable) {
    if(draggable.options.delay) { 
      this._timeout = setTimeout(function() { 
        Draggables._timeout = null; 
        window.focus(); 
        Draggables.activeDraggable = draggable; 
      }.bind(this), draggable.options.delay); 
    } else {
      window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
      this.activeDraggable = draggable;
    }
  },
  
  deactivate: function() {
    this.activeDraggable = null;
  },
  
  updateDrag: function(event) {
    if(!this.activeDraggable) return;
    var pointer = [Event.pointerX(event), Event.pointerY(event)];
    // Mozilla-based browsers fire successive mousemove events with
    // the same coordinates, prevent needless redrawing (moz bug?)
    if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
    this._lastPointer = pointer;
    
    this.activeDraggable.updateDrag(event, pointer);
  },
  
  endDrag: function(event) {
    if(this._timeout) { 
      clearTimeout(this._timeout); 
      this._timeout = null; 
    }
    if(!this.activeDraggable) return;
    this._lastPointer = null;
    this.activeDraggable.endDrag(event);
    this.activeDraggable = null;
  },
  
  keyPress: function(event) {
    if(this.activeDraggable)
      this.activeDraggable.keyPress(event);
  },
  
  addObserver: function(observer) {
    this.observers.push(observer);
    this._cacheObserverCallbacks();
  },
  
  removeObserver: function(element) {  // element instead of observer fixes mem leaks
    this.observers = this.observers.reject( function(o) { return o.element==element });
    this._cacheObserverCallbacks();
  },
  
  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
    if(this[eventName+'Count'] > 0)
      this.observers.each( function(o) {
        if(o[eventName]) o[eventName](eventName, draggable, event);
      });
    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
  },
  
  _cacheObserverCallbacks: function() {
    ['onStart','onEnd','onDrag'].each( function(eventName) {
      Draggables[eventName+'Count'] = Draggables.observers.select(
        function(o) { return o[eventName]; }
      ).length;
    });
  }
}

/*--------------------------------------------------------------------------*/

var Draggable = Class.create({
  initialize: function(element) {
    var defaults = {
      handle: false,
      reverteffect: function(element, top_offset, left_offset) {
        var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
        new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
          queue: {scope:'_draggable', position:'end'}
        });
      },
      endeffect: function(element) {
        var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
          queue: {scope:'_draggable', position:'end'},
          afterFinish: function(){ 
            Draggable._dragging[element] = false 
          }
        }); 
      },
      zindex: 1000,
      revert: false,
      quiet: false,
      scroll: false,
      scrollSensitivity: 20,
      scrollSpeed: 15,
      snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
      delay: 0
    };
    
    if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
      Object.extend(defaults, {
        starteffect: function(element) {
          element._opacity = Element.getOpacity(element);
          Draggable._dragging[element] = true;
          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
        }
      });
    
    var options = Object.extend(defaults, arguments[1] || { });

    this.element = $(element);
    
    if(options.handle && Object.isString(options.handle))
      this.handle = this.element.down('.'+options.handle, 0);
    
    if(!this.handle) this.handle = $(options.handle);
    if(!this.handle) this.handle = this.element;
    
    if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
      options.scroll = $(options.scroll);
      this._isScrollChild = Element.childOf(this.element, options.scroll);
    }

    Element.makePositioned(this.element); // fix IE    

    this.options  = options;
    this.dragging = false;   

    this.eventMouseDown = this.initDrag.bindAsEventListener(this);
    Event.observe(this.handle, "mousedown", this.eventMouseDown);
    
    Draggables.register(this);
  },
  
  destroy: function() {
    Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
    Draggables.unregister(this);
  },
  
  currentDelta: function() {
    return([
      parseInt(Element.getStyle(this.element,'left') || '0'),
      parseInt(Element.getStyle(this.element,'top') || '0')]);
  },
  
  initDrag: function(event) {
    if(!Object.isUndefined(Draggable._dragging[this.element]) &&
      Draggable._dragging[this.element]) return;
    if(Event.isLeftClick(event)) {    
      // abort on form elements, fixes a Firefox issue
      var src = Event.element(event);
      if((tag_name = src.tagName.toUpperCase()) && (
        tag_name=='INPUT' ||
        tag_name=='SELECT' ||
        tag_name=='OPTION' ||
        tag_name=='BUTTON' ||
        tag_name=='TEXTAREA')) return;
        
      var pointer = [Event.pointerX(event), Event.pointerY(event)];
      var pos     = Position.cumulativeOffset(this.element);
      this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
      
      Draggables.activate(this);
      Event.stop(event);
    }
  },
  
  startDrag: function(event) {
    this.dragging = true;
    if(!this.delta)
      this.delta = this.currentDelta();
    
    if(this.options.zindex) {
      this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
      this.element.style.zIndex = this.options.zindex;
    }
    
    if(this.options.ghosting) {
      this._clone = this.element.cloneNode(true);
      this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
      if (!this.element._originallyAbsolute)
        Position.absolutize(this.element);
      this.element.parentNode.insertBefore(this._clone, this.element);
    }
    
    if(this.options.scroll) {
      if (this.options.scroll == window) {
        var where = this._getWindowScroll(this.options.scroll);
        this.originalScrollLeft = where.left;
        this.originalScrollTop = where.top;
      } else {
        this.originalScrollLeft = this.options.scroll.scrollLeft;
        this.originalScrollTop = this.options.scroll.scrollTop;
      }
    }
    
    Draggables.notify('onStart', this, event);
        
    if(this.options.starteffect) this.options.starteffect(this.element);
  },
  
  updateDrag: function(event, pointer) {
    if(!this.dragging) this.startDrag(event);
    
    if(!this.options.quiet){
      Position.prepare();
      Droppables.show(pointer, this.element);
    }
    
    Draggables.notify('onDrag', this, event);
    
    this.draw(pointer);
    if(this.options.change) this.options.change(this);
    
    if(this.options.scroll) {
      this.stopScrolling();
      
      var p;
      if (this.options.scroll == window) {
        with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
      } else {
        p = Position.page(this.options.scroll);
        p[0] += this.options.scroll.scrollLeft + Position.deltaX;
        p[1] += this.options.scroll.scrollTop + Position.deltaY;
        p.push(p[0]+this.options.scroll.offsetWidth);
        p.push(p[1]+this.options.scroll.offsetHeight);
      }
      var speed = [0,0];
      if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
      if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
      if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
      if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
      this.startScrolling(speed);
    }
    
    // fix AppleWebKit rendering
    if(Prototype.Browser.WebKit) window.scrollBy(0,0);
    
    Event.stop(event);
  },
  
  finishDrag: function(event, success) {
    this.dragging = false;
    
    if(this.options.quiet){
      Position.prepare();
      var pointer = [Event.pointerX(event), Event.pointerY(event)];
      Droppables.show(pointer, this.element);
    }

    if(this.options.ghosting) {
      if (!this.element._originallyAbsolute)
        Position.relativize(this.element);
      delete this.element._originallyAbsolute;
      Element.remove(this._clone);
      this._clone = null;
    }

    var dropped = false; 
    if(success) { 
      dropped = Droppables.fire(event, this.element); 
      if (!dropped) dropped = false; 
    }
    if(dropped && this.options.onDropped) this.options.onDropped(this.element);
    Draggables.notify('onEnd', this, event);

    var revert = this.options.revert;
    if(revert && Object.isFunction(revert)) revert = revert(this.element);
    
    var d = this.currentDelta();
    if(revert && this.options.reverteffect) {
      if (dropped == 0 || revert != 'failure')
        this.options.reverteffect(this.element,
          d[1]-this.delta[1], d[0]-this.delta[0]);
    } else {
      this.delta = d;
    }

    if(this.options.zindex)
      this.element.style.zIndex = this.originalZ;

    if(this.options.endeffect) 
      this.options.endeffect(this.element);
      
    Draggables.deactivate(this);
    Droppables.reset();
  },
  
  keyPress: function(event) {
    if(event.keyCode!=Event.KEY_ESC) return;
    this.finishDrag(event, false);
    Event.stop(event);
  },
  
  endDrag: function(event) {
    if(!this.dragging) return;
    this.stopScrolling();
    this.finishDrag(event, true);
    Event.stop(event);
  },
  
  draw: function(point) {
    var pos = Position.cumulativeOffset(this.element);
    if(this.options.ghosting) {
      var r   = Position.realOffset(this.element);
      pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
    }
    
    var d = this.currentDelta();
    pos[0] -= d[0]; pos[1] -= d[1];
    
    if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
      pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
      pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
    }
    
    var p = [0,1].map(function(i){ 
      return (point[i]-pos[i]-this.offset[i]) 
    }.bind(this));
    
    if(this.options.snap) {
      if(Object.isFunction(this.options.snap)) {
        p = this.options.snap(p[0],p[1],this);
      } else {
      if(Object.isArray(this.options.snap)) {
        p = p.map( function(v, i) {
          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
      } else {
        p = p.map( function(v) {
          return (v/this.options.snap).round()*this.options.snap }.bind(this))
      }
    }}
    
    var style = this.element.style;
    if((!this.options.constraint) || (this.options.constraint=='horizontal'))
      style.left = p[0] + "px";
    if((!this.options.constraint) || (this.options.constraint=='vertical'))
      style.top  = p[1] + "px";
    
    if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
  },
  
  stopScrolling: function() {
    if(this.scrollInterval) {
      clearInterval(this.scrollInterval);
      this.scrollInterval = null;
      Draggables._lastScrollPointer = null;
    }
  },
  
  startScrolling: function(speed) {
    if(!(speed[0] || speed[1])) return;
    this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
    this.lastScrolled = new Date();
    this.scrollInterval = setInterval(this.scroll.bind(this), 10);
  },
  
  scroll: function() {
    var current = new Date();
    var delta = current - this.lastScrolled;
    this.lastScrolled = current;
    if(this.options.scroll == window) {
      with (this._getWindowScroll(this.options.scroll)) {
        if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
          var d = delta / 1000;
          this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
        }
      }
    } else {
      this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
      this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
    }
    
    Position.prepare();
    Droppables.show(Draggables._lastPointer, this.element);
    Draggables.notify('onDrag', this);
    if (this._isScrollChild) {
      Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
      Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
      Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
      if (Draggables._lastScrollPointer[0] < 0)
        Draggables._lastScrollPointer[0] = 0;
      if (Draggables._lastScrollPointer[1] < 0)
        Draggables._lastScrollPointer[1] = 0;
      this.draw(Draggables._lastScrollPointer);
    }
    
    if(this.options.change) this.options.change(this);
  },
  
  _getWindowScroll: function(w) {
    var T, L, W, H;
    with (w.document) {
      if (w.document.documentElement && documentElement.scrollTop) {
        T = documentElement.scrollTop;
        L = documentElement.scrollLeft;
      } else if (w.document.body) {
        T = body.scrollTop;
        L = body.scrollLeft;
      }
      if (w.innerWidth) {
        W = w.innerWidth;
        H = w.innerHeight;
      } else if (w.document.documentElement && documentElement.clientWidth) {
        W = documentElement.clientWidth;
        H = documentElement.clientHeight;
      } else {
        W = body.offsetWidth;
        H = body.offsetHeight
      }
    }
    return { top: T, left: L, width: W, height: H };
  }
});

Draggable._dragging = { };

/*--------------------------------------------------------------------------*/

var SortableObserver = Class.create({
  initialize: function(element, observer) {
    this.element   = $(element);
    this.observer  = observer;
    this.lastValue = Sortable.serialize(this.element);
  },
  
  onStart: function() {
    this.lastValue = Sortable.serialize(this.element);
  },
  
  onEnd: function() {
    Sortable.unmark();
    if(this.lastValue != Sortable.serialize(this.element))
      this.observer(this.element)
  }
});

var Sortable = {
  SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
  
  sortables: { },
  
  _findRootElement: function(element) {
    while (element.tagName.toUpperCase() != "BODY") {  
      if(element.id && Sortable.sortables[element.id]) return element;
      element = element.parentNode;
    }
  },

  options: function(element) {
    element = Sortable._findRootElement($(element));
    if(!element) return;
    return Sortable.sortables[element.id];
  },
  
  destroy: function(element){
    var s = Sortable.options(element);
    
    if(s) {
      Draggables.removeObserver(s.element);
      s.droppables.each(function(d){ Droppables.remove(d) });
      s.draggables.invoke('destroy');
      
      delete Sortable.sortables[s.element.id];
    }
  },

  create: function(element) {
    element = $(element);
    var options = Object.extend({ 
      element:     element,
      tag:         'li',       // assumes li children, override with tag: 'tagname'
      dropOnEmpty: false,
      tree:        false,
      treeTag:     'ul',
      overlap:     'vertical', // one of 'vertical', 'horizontal'
      constraint:  'vertical', // one of 'vertical', 'horizontal', false
      containment: element,    // also takes array of elements (or id's); or false
      handle:      false,      // or a CSS class
      only:        false,
      delay:       0,
      hoverclass:  null,
      ghosting:    false,
      quiet:       false, 
      scroll:      false,
      scrollSensitivity: 20,
      scrollSpeed: 15,
      format:      this.SERIALIZE_RULE,
      
      // these take arrays of elements or ids and can be 
      // used for better initialization performance
      elements:    false,
      handles:     false,
      
      onChange:    Prototype.emptyFunction,
      onUpdate:    Prototype.emptyFunction
    }, arguments[1] || { });

    // clear any old sortable with same element
    this.destroy(element);

    // build options for the draggables
    var options_for_draggable = {
      revert:      true,
      quiet:       options.quiet,
      scroll:      options.scroll,
      scrollSpeed: options.scrollSpeed,
      scrollSensitivity: options.scrollSensitivity,
      delay:       options.delay,
      ghosting:    options.ghosting,
      constraint:  options.constraint,
      handle:      options.handle };

    if(options.starteffect)
      options_for_draggable.starteffect = options.starteffect;

    if(options.reverteffect)
      options_for_draggable.reverteffect = options.reverteffect;
    else
      if(options.ghosting) options_for_draggable.reverteffect = function(element) {
        element.style.top  = 0;
        element.style.left = 0;
      };

    if(options.endeffect)
      options_for_draggable.endeffect = options.endeffect;

    if(options.zindex)
      options_for_draggable.zindex = options.zindex;

    // build options for the droppables  
    var options_for_droppable = {
      overlap:     options.overlap,
      containment: options.containment,
      tree:        options.tree,
      hoverclass:  options.hoverclass,
      onHover:     Sortable.onHover
    }
    
    var options_for_tree = {
      onHover:      Sortable.onEmptyHover,
      overlap:      options.overlap,
      containment:  options.containment,
      hoverclass:   options.hoverclass
    }

    // fix for gecko engine
    Element.cleanWhitespace(element); 

    options.draggables = [];
    options.droppables = [];

    // drop on empty handling
    if(options.dropOnEmpty || options.tree) {
      Droppables.add(element, options_for_tree);
      options.droppables.push(element);
    }

    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
      var handle = options.handles ? $(options.handles[i]) :
        (options.handle ? $(e).select('.' + options.handle)[0] : e); 
      options.draggables.push(
        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
      Droppables.add(e, options_for_droppable);
      if(options.tree) e.treeNode = element;
      options.droppables.push(e);      
    });
    
    if(options.tree) {
      (Sortable.findTreeElements(element, options) || []).each( function(e) {
        Droppables.add(e, options_for_tree);
        e.treeNode = element;
        options.droppables.push(e);
      });
    }

    // keep reference
    this.sortables[element.id] = options;

    // for onupdate
    Draggables.addObserver(new SortableObserver(element, options.onUpdate));

  },

  // return all suitable-for-sortable elements in a guaranteed order
  findElements: function(element, options) {
    return Element.findChildren(
      element, options.only, options.tree ? true : false, options.tag);
  },
  
  findTreeElements: function(element, options) {
    return Element.findChildren(
      element, options.only, options.tree ? true : false, options.treeTag);
  },

  onHover: function(element, dropon, overlap) {
    if(Element.isParent(dropon, element)) return;

    if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
      return;
    } else if(overlap>0.5) {
      Sortable.mark(dropon, 'before');
      if(dropon.previousSibling != element) {
        var oldParentNode = element.parentNode;
        element.style.visibility = "hidden"; // fix gecko rendering
        dropon.parentNode.insertBefore(element, dropon);
        if(dropon.parentNode!=oldParentNode) 
          Sortable.options(oldParentNode).onChange(element);
        Sortable.options(dropon.parentNode).onChange(element);
      }
    } else {
      Sortable.mark(dropon, 'after');
      var nextElement = dropon.nextSibling || null;
      if(nextElement != element) {
        var oldParentNode = element.parentNode;
        element.style.visibility = "hidden"; // fix gecko rendering
        dropon.parentNode.insertBefore(element, nextElement);
        if(dropon.parentNode!=oldParentNode) 
          Sortable.options(oldParentNode).onChange(element);
        Sortable.options(dropon.parentNode).onChange(element);
      }
    }
  },
  
  onEmptyHover: function(element, dropon, overlap) {
    var oldParentNode = element.parentNode;
    var droponOptions = Sortable.options(dropon);
        
    if(!Element.isParent(dropon, element)) {
      var index;
      
      var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
      var child = null;
            
      if(children) {
        var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
        
        for (index = 0; index < children.length; index += 1) {
          if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
            offset -= Element.offsetSize (children[index], droponOptions.overlap);
          } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
            child = index + 1 < children.length ? children[index + 1] : null;
            break;
          } else {
            child = children[index];
            break;
          }
        }
      }
      
      dropon.insertBefore(element, child);
      
      Sortable.options(oldParentNode).onChange(element);
      droponOptions.onChange(element);
    }
  },

  unmark: function() {
    if(Sortable._marker) Sortable._marker.hide();
  },

  mark: function(dropon, position) {
    // mark on ghosting only
    var sortable = Sortable.options(dropon.parentNode);
    if(sortable && !sortable.ghosting) return; 

    if(!Sortable._marker) {
      Sortable._marker = 
        ($('dropmarker') || Element.extend(document.createElement('DIV'))).
          hide().addClassName('dropmarker').setStyle({position:'absolute'});
      document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
    }    
    var offsets = Position.cumulativeOffset(dropon);
    Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
    
    if(position=='after')
      if(sortable.overlap == 'horizontal') 
        Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
      else
        Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
    
    Sortable._marker.show();
  },
  
  _tree: function(element, options, parent) {
    var children = Sortable.findElements(element, options) || [];
  
    for (var i = 0; i < children.length; ++i) {
      var match = children[i].id.match(options.format);

      if (!match) continue;
      
      var child = {
        id: encodeURIComponent(match ? match[1] : null),
        element: element,
        parent: parent,
        children: [],
        position: parent.children.length,
        container: $(children[i]).down(options.treeTag)
      }
      
      /* Get the element containing the children and recurse over it */
      if (child.container)
        this._tree(child.container, options, child)
      
      parent.children.push (child);
    }

    return parent; 
  },

  tree: function(element) {
    element = $(element);
    var sortableOptions = this.options(element);
    var options = Object.extend({
      tag: sortableOptions.tag,
      treeTag: sortableOptions.treeTag,
      only: sortableOptions.only,
      name: element.id,
      format: sortableOptions.format
    }, arguments[1] || { });
    
    var root = {
      id: null,
      parent: null,
      children: [],
      container: element,
      position: 0
    }
    
    return Sortable._tree(element, options, root);
  },

  /* Construct a [i] index for a particular node */
  _constructIndex: function(node) {
    var index = '';
    do {
      if (node.id) index = '[' + node.position + ']' + index;
    } while ((node = node.parent) != null);
    return index;
  },

  sequence: function(element) {
    element = $(element);
    var options = Object.extend(this.options(element), arguments[1] || { });
    
    return $(this.findElements(element, options) || []).map( function(item) {
      return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
    });
  },

  setSequence: function(element, new_sequence) {
    element = $(element);
    var options = Object.extend(this.options(element), arguments[2] || { });
    
    var nodeMap = { };
    this.findElements(element, options).each( function(n) {
        if (n.id.match(options.format))
            nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
        n.parentNode.removeChild(n);
    });
   
    new_sequence.each(function(ident) {
      var n = nodeMap[ident];
      if (n) {
        n[1].appendChild(n[0]);
        delete nodeMap[ident];
      }
    });
  },
  
  serialize: function(element) {
    element = $(element);
    var options = Object.extend(Sortable.options(element), arguments[1] || { });
    var name = encodeURIComponent(
      (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
    
    if (options.tree) {
      return Sortable.tree(element, arguments[1]).children.map( function (item) {
        return [name + Sortable._constructIndex(item) + "[id]=" + 
                encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
      }).flatten().join('&');
    } else {
      return Sortable.sequence(element, arguments[1]).map( function(item) {
        return name + "[]=" + encodeURIComponent(item);
      }).join('&');
    }
  }
}

// Returns true if child is contained within element
Element.isParent = function(child, element) {
  if (!child.parentNode || child == element) return false;
  if (child.parentNode == element) return true;
  return Element.isParent(child.parentNode, element);
}

Element.findChildren = function(element, only, recursive, tagName) {   
  if(!element.hasChildNodes()) return null;
  tagName = tagName.toUpperCase();
  if(only) only = [only].flatten();
  var elements = [];
  $A(element.childNodes).each( function(e) {
    if(e.tagName && e.tagName.toUpperCase()==tagName &&
      (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
        elements.push(e);
    if(recursive) {
      var grandchildren = Element.findChildren(e, only, recursive, tagName);
      if(grandchildren) elements.push(grandchildren);
    }
  });

  return (elements.length>0 ? elements.flatten() : []);
}

Element.offsetSize = function (element, type) {
  return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
}
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/FacebookConnect.js
AUTOCORE_SELF_CHECK.push("FacebookConnect.js");
FacebookConnect = {
    key : "66620421d55cbafb1a0f8dbe12a5a592",
    receiver : "/fbconnect/xd_receiver.htm",
    inited : false,

    init : function(initDone) {
        if (this.inited) {
            return;
        }
        FB.init(this.key, this.receiver);
        FB.ensureInit(function() { FacebookConnect.inited=true; initDone(); });
    },

    notInited : function(funcName) {
        alert(funcName + " called before init in FacebookConnect.js");
    },

    // doneFn takes an int, which can be one of:
    // FB.ConnectState.connected
    // FB.ConnectState.userNotLoggedIn
    // FB.ConnectState.appNotAuthorized
    getConnStatus : function(doneFn) {
        if (!this.inited) {
            this.notInited("getConnStatus");
            return;
        }
        FB.Connect.get_status().waitUntilReady(doneFn);
    },

    afterFbLogin : function(isLoggedIn) {
        var loc = window.location.pathname;
        var newLoc = "/login?p=" + escape(loc);
        if (isLoggedIn) {
            newLoc += "&fb_connect=1";
        }
        window.location.href = newLoc;
    },

    getUserData : function(handler) {
        var uid = FB.Connect.get_loggedInUser();
        var api = FB.ApiClient(this.key);
        api.fql_query("SELECT first_name, last_name, pic_big, birthday_date, " +
                      "sex, meeting_sex, meeting_for, relationship_status, " +
                      "current_location, activities, interests, music, tv, " +
                      "movies, books, about_me, profile_blurb " +
                      "from user where uid=" + uid, handler);
    },

    requireSession : function(nextFunction) {
        return FB.Connect.requireSession(nextFunction);
    }

}
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/md5.js
AUTOCORE_SELF_CHECK.push("md5.js");


// 


function get_md5_bit (in_str, which_bit) 
{
    while (which_bit > 127) {
	in_str = hex_md5(in_str);
	which_bit -= 128;
    }
    var hex = hex_md5(in_str);
    var c_pos = hex.length - 1 - Math.floor(which_bit / 4);
    var c = hex.charAt(c_pos);
    var base10 = parseInt("0x" + c, 16);
    var char_bit = which_bit % 4;
    while (char_bit > 0) {
	base10 = base10 >> 1;
	char_bit--;
    }
    return base10 % 2;
}
//
// returns an int in [0..15] for picking which 
// group a string (probably user) is in, in an experiment
//
function get_experiment_group(uid_str, experiment_str)
{
    var hex = hex_md5(uid_str + experiment_str);
    var last_char = hex.charAt(hex.length - 1);
    return parseInt("0x" + last_char, 16);
}

// 



/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 */

/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = ""; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */

/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }

/*
 * Perform a simple self-test to see if the VM is working
 */
function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}

/*
 * Calculate the MD5 of an array of little-endian words, and a bit length
 */
function core_md5(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;

  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);

}

/*
 * These functions implement the four basic operations the algorithm uses.
 */
function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}

/*
 * Calculate the HMAC-MD5, of a key and some data
 */
function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}

/*
 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
 * to work around bugs in some JS interpreters.
 */
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

/*
 * Bitwise rotate a 32-bit number to the left.
 */
function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

/*
 * Convert a string to an array of little-endian words
 * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
 */
function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}

/*
 * Convert an array of little-endian words to a string
 */
function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}

/*
 * Convert an array of little-endian words to a hex string.
 */
function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

/*
 * Convert an array of little-endian words to a base-64 string
 */
function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/OkLocation.js
AUTOCORE_SELF_CHECK.push("OkLocation.js");
//

//
// 
//

if (typeof Prototype =='undefined'  || Prototype.Version < "1.6" ) {
	throw("OkLocation requires Prototype 1.6 or higher.");
}



var OkLocation = Class.create({

	initialize: function(params) {
		          
		this.AjaxPath = "/locquery";
        this.Status = "pending";
		this.FormType = "text";
		this.TempId = "loc_" + Math.round(Math.random() * 1000000000);
        this.Params = params;
		this.LocId = "";
		this.QueryString = "";
		this.PossibleMatches = new Array();		
		this.AjaxResult = new Object;
        
        this.startExperience();

	},
	                
	getStatus: function() {
		return this.Status;
	},
	
	submitFormIfLocationReady: function(form_id, failure_cb, loc_mandatory) {
		if (this.Status == "success" || (!loc_mandatory && $F('text_' + this.TempId) == "")) {
			$(form_id).submit();
		}
		else if (loc_mandatory && $F('text_' + this.TempId) == "") {
			alert('You must enter a location!');
		}
		else {
			failure_cb(this);
		}
	},
	
	startExperience: function() {

		if (this.Params.previous_loc_id && this.Params.previous_loc_id != 0 && this.Params.previous_loc_id != "") {
			this.Status = "success";
			this.LocId = this.Params.previous_loc_id;
		}
		if (this.Params.previous_query_string) {
			this.QueryString = this.Params.previous_query_string;
		}
		
		this.drawInputs();
	},
	
	drawInputs: function() {
		var res = "";

		if (this.FormType == "select") {
			res += '<select id="sel_' + this.TempId + '">';
			res += '<option value=""> - choose one - </option>';
			res += '<option value="reset"> - start over - </option>';
			for (var i = 0; i < this.PossibleMatches.length; i++) {
				res += '<option value="' + this.PossibleMatches[i].locid + '">' + this.PossibleMatches[i].text + '</option>';
			}
			res += '</select>';	
			this.Status = "pulldown";
		}
		else {
            if(this.Params.replaceEnter == true)
                res += '<input class="location_input" onkeydown="if(event.keyCode==13 || event.which==13) {'+this.Params.newEnter+';return false;}" type="text" id="text_' + this.TempId + '" name="text_' + this.TempId + '" value="' + this.QueryString + '"/>';
            else
			    res += '<input class="location_input" type="text" id="text_' + this.TempId + '" name="text_' + this.TempId + '" value="' + this.QueryString + '"/>';
		}

		var input_type = "hidden";
		var id_label = "";
		var query_label = "";
		if (this.Params.debug) {
			input_type="text";
			id_label = "LocID hidden input ('" + this.Params.loc_id_input_name + "'): ";
			query_label = "Query hidden input ('" + this.Params.query_input_name + "'): ";
		}
		res += id_label + '<input type="' + input_type + '" name="' + this.Params.loc_id_input_name 
				+ '" id="' + this.Params.loc_id_input_name 
				+ '" name="' + this.Params.loc_id_input_name 
				+ '" value="' + this.LocId + '" />';
		res += query_label + '<input type="' + input_type + '" name="' + this.Params.query_input_name
				+ '" id="' + this.Params.query_input_name 
				+ '" name="' + this.Params.query_input_name 
				+ '" value="' + this.QueryString + '" />';
				
		$(this.Params.dest_div).innerHTML = res;
		if (this.FormType == "select") {
			Event.observe('sel_' + this.TempId, 'change', this.selectChange.bindAsEventListener(this));
		}
		else {
			Event.observe('text_' + this.TempId, 'keyup', this.textChange.bindAsEventListener(this));
			Event.observe('text_' + this.TempId, 'blur', this.performLookup.bindAsEventListener(this));
		}
	},

	textChange: function() {
		if ($F(this.Params.query_input_name) != $F("text_" + this.TempId)) {
			this.Status = "pending";
			this.LocId = "";
			$(this.Params.loc_id_input_name).value = "";			
			if (this.Params.cb_lost_success) {
	            this.Params.cb_lost_success(this);			
			}				
			$(this.Params.query_input_name).value = $F("text_" + this.TempId);
		}
	},

	selectChange: function() {
		var id = $F("sel_" + this.TempId);

		if (id == "reset" || id == "") {
			if($("find_btn")) $("find_btn").style.display = "inline";
			this.Status = "pulldown";
			this.LocId = "";
			this.FormType="text";
			$(this.Params.loc_id_input_name).value = "";
			$(this.Params.query_input_name).value = "";
			this.QueryString = "";
			this.PossibleMatches = new Array();		
			this.AjaxResult = new Object;
			this.drawInputs();
			if (this.Params.cb_reset) {
	            this.Params.cb_reset(this);			
			}
		}
		else {
			this.Status = "success";
			this.LocId = id;
			$(this.Params.loc_id_input_name).value = this.LocId;
			$(this.Params.query_input_name).value = this.AjaxResult.query;
			if (this.Params.cb_success) {			
	            this.Params.cb_success(this);			
			}
		}
		$(this.Params.loc_id_input_name).value = this.LocId;		
	},
	
	performLookup: function() {
		var req = new Ajax.Request(this.AjaxPath, {
			method: "get",
			parameters: {func : "query", query : $F("text_" + this.TempId), cbust : Math.round(Math.random() * 1000000000)},
			onSuccess: this.performLookup_cb.bindAsEventListener(this),
			onFailure: function() { alert("Location lookup failed!"); }
		});		
	},

	performLookup_cb: function(data) {
		this.AjaxResult = data.responseText.evalJSON();
		// Make sure the request is what the user still has in the text box to avoid race condition
		if ($("text_" + this.TempId) && $F("text_" + this.TempId) == this.AjaxResult.query) {
			if (this.AjaxResult.locid && this.AjaxResult.locid != 0 && this.AjaxResult.locid != "") {
				this.handleSuccess();
			}
			else {
				this.handleError();
			}
		}
	},
	
	handleError: function() {
		this.LocId = "";
		if (this.AjaxResult.results.length > 0) {
			this.FormType = "select";
			this.PossibleMatches = this.AjaxResult.results;
			this.drawInputs();
		}
		if (this.Params.cb_error) {
			this.Params.cb_error(this);
		}
	},
	
	handleSuccess: function() {
		this.Status = "success";
		this.LocId = this.AjaxResult.locid;
		$(this.Params.loc_id_input_name).value = this.LocId;
		if (this.Params.cb_success) {			
            this.Params.cb_success(this);			
		}
	}


});
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/OkLoginJoin.js
AUTOCORE_SELF_CHECK.push("OkLoginJoin.js");

// 

function killEnterAll(e) {
	var Ucode=e.keyCode? e.keyCode : e.charCode;
	if (Ucode == 13){}
	e = (e) ? e : ((window.event) ? window.event : "");
	if (e) {return !( e.keyCode==13 || e.which==13 );}	
}

var OKLJ = Class.create({

	inititalize : function() {
		
	},
	
	
	//
	//   optional inside params object:
	//   --------------------------------
	//   success_cb : a function to call after a successful login
	//   success_redirect : where to redirect browser after successful login
	//   failure_cb : a function to call after a failed login
	//   failure_redirect : where to redirect browser after failed login

	login : function(screenname, password, params) {
		var ajax_params = { "ajax" : 1, "username" : screenname, "password" : password, enable: params.enable ? 1 : 0};
		var req = new Ajax.Request("/login", {
			method: 'post', 
			parameters: ajax_params ,
			onSuccess: this.login_cb.bindAsEventListener(this, params), 
			onFailure: this.login_cb_failed.bindAsEventListener(this, params)});
		return req;
		
	},


	// This used to be fairly simple, but we also may get a paramter back from the login
	// service telling us we need to visit an authlink, in a hidden iframe. Can't use
	// AJAX for domain security reasons.  So we need to visit that before calling it a day. So this function
	// isn't the last one; it'll invoke login_cb_post_authlink when it's done

	login_cb : function(data, params) {
		var response = data.responseText.evalJSON();
		this.tempHoldings = {'data' : data, 'params' : params };
		if (response.hq_okc_authlink && response.hq_okc_authlink != "") {
			Element.insert(document.body, {  bottom: '<iframe style="display:none;" onload="OkLoginJoin.login_cb_post_authlink()" src="' + response.hq_okc_authlink + '" id="auth-ajax-login"></iframe>'  }  );			
			// doubly-set src for old IE bug where iframes added with src didn't work
			$('auth-ajax-login').src = response.hq_okc_authlink;
            setTimeout("OkLoginJoin.login_cb_post_authlink()", 1000);
		}
		else {
			this.login_cb_post_authlink();
		}		
	},
	
	login_cb_post_authlink : function() {
		
		var data = this.tempHoldings.data;
		var params = this.tempHoldings.params;
		var response = data.responseText.evalJSON();
		if (response.status == "success") {
			if (params.success_cb) {
				params.success_cb(response);
			}
			if (params.success_redirect) {
				document.location.href = params.success_redirect;
			}
		}
		else {
			if (params.failure_cb) {
				params.failure_cb(response);
			}
			if (params.failure_redirect) {
				document.location.href = params.failure_redirect;
			}			
		}
		
	},
	
	login_cb_failed : function(data, params) {
		alert("AJAX login Failed!");		
	},
	
	//
	//   optional inside params object:
	//   --------------------------------
	//   success_cb : a function to call after a successful logout
	//   success_redirect : where to redirect browser after successful logout

	logout : function(params) {
		var ajax_params = { "ajax" : 1 };
		var req = new Ajax.Request("/logout", {
			method: 'post',
			parameters: ajax_params ,
			onSuccess: this.logout_cb.bindAsEventListener(this, params), 
			onFailure: this.logout_cb_failed.bindAsEventListener(this, params)});
		return req;
	},

	logout_cb : function(data, params) {
		var response = data.responseText.evalJSON();
		if (response.status == "success") {
			if (params.success_cb) {
				params.success_cb(response);
			}
			if (params.success_redirect) {
				document.location.href = params.success_redirect;
			}
			Element.insert(document.body,
					{  bottom: '<iframe style="display:none;" src="http://www.okcupid.com/logout" id="auth-ajax-okc-logout"></iframe>'  }  );
		}
		else {
			alert("Logout somehow failed");
		}
	},
	
	logout_cb_failed : function(data, params) {
		alert("AJAX logout Failed!");		
	},
	

	//
	//   optional inside params object:
	//   --------------------------------
	//   success_cb : a function to call after a successful request (user exists, mail sent)
	//   success_redirect : where to redirect browser after successful request (user exists, mail sent)
	//   failure_cb : a function to call after a failed request
	//   failure_redirect : where to redirect browser after failed request

	lostPassword : function(screenname_or_email, params) {
		var ajax_params = { "ajax" : 1, "email" : screenname_or_email};
		var req = new Ajax.Request("/lostpassword", {
			method: 'post', 
			parameters: ajax_params ,
			onSuccess: this.lostPassword_cb.bindAsEventListener(this, params), 
			onFailure: this.lostPassword_cb_failed.bindAsEventListener(this, params)});
		return req;		
	},
	
	lostPassword_cb : function(data, params) {
		var response = data.responseText.evalJSON();
		if (response.status == "SUCCESS") {
			if (params.success_cb) {
				params.success_cb(response);
			}
			if (params.success_redirect) {
				document.location.href = params.success_redirect;
			}
		}
		else {
			if (params.failure_cb) {
				params.failure_cb(response);
			}
			if (params.failure_redirect) {
				document.location.href = params.failure_redirect;
			}			
		}
	},
	
	lostPassword_cb_failed : function(data, params) {
		alert("AJAX lostPassword Failed!");		
	},



	//
	// for signup, params state maintained in member, since we can't pass through cgi safely;
	// with other functions we use bindAsEventListener to pass to callback
	//
	optionalParams : { },

	//
	//   dest_div: where on the page they'll be doing the signup.
	//   signup_path : required, e.g. "/signup/paths/inga/1.html" -- path to first file in process
    //   cgi_extras : extra cgi parameters to pass to the signup service. ("cf", "gender", etc.)
	//     
	//   optional inside params object:
	//   --------------------------------
	//   success_cb : a function to call after a successful request (user exists, mail sent)
	//   success_redirect : where to redirect browser after successful request (user exists, mail sent)
	
	join : function(dest_div, signup_path, cgi_extras, params) {

			this.optionalJoinParams = params;
		
			var default_params = { "ajax" : 1, "reqs" : 0, "cbust" : Math.random() };
			var ajax_params = this.combineTwoObjs(default_params, cgi_extras);
			ajax_params["next_page"] = signup_path;
			var req = new Ajax.Updater(dest_div, "/signup", {
				method: 'post', 
				evalScripts: true,
				parameters: ajax_params });
	},

	//
	// Called by the HTML inserted via signup
	//
	// This used to be fairly simple, but we also may get a paramter back from join
	// service telling us we need to visit an authlink, in a hidden iframe. Can't use
	// AJAX for domain security reasons.  So we need to visit that before calling it a day. So this function
	// isn't the last one; it'll invoke login_cb_post_authlink when it's done

	join_cb : function (data) {
		this.tempHoldings = {'data' : data };
		if (data.hq_okc_authlink && data.hq_okc_authlink != "") {
			Element.insert(document.body, {  bottom: '<iframe style="display:none;" onload="OkLoginJoin.join_cb_post_authlink()" src="' + data.hq_okc_authlink + '" id="auth-ajax-join"></iframe>'  }  );
            setTimeout("OkLoginJoin.join_cb_post_authlink()", 1000);
		}
		else {
			this.join_cb_post_authlink()
		}
	},
	
	join_cb_post_authlink : function() {
		var data = this.tempHoldings.data;
		
		if (this.optionalJoinParams.success_cb) {
			this.optionalJoinParams.success_cb(data);
		}
		if (this.optionalJoinParams.success_redirect) {
			document.location.href = this.optionalJoinParams.success_redirect;
		}		
	},
	
	//
	// helpers
	//
	
	combineTwoObjs : function(o1, o2) {
		
		var res = new Object();
		for (var key in o1) {
			res[key] = o1[key];
		}
		for (var key in o2) {
			res[key] = o2[key];
		}
		return res;			
	}
	
});
//----------------------------------------------------------------------------------------------------------------

 	var OkLoginJoin = new OKLJ(); 

//----------------------------------------------------------------------------------------------------------------

	
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Bitter.js
AUTOCORE_SELF_CHECK.push("Oryx/Bitter.js");
/* ----------------------------------------------------------------

OkCupid Bitter file

	- for some triple entendre 

This is a specialized file for setting the remote 64 bit settings
variable.

---------------------------------------------------------------- */

var Bitter = {
	
	//active:"" || false,
	
	bit:{},
	persist:NaN,
	funcs:new Array(),
	map:{},
	LOAD:function(cb)
	{			
		var pass = this;
		var fire = cb || function(){};
		
		new Ajax.Request(
			"/bitter_JSON.html",
			{
				method:"get",
				onSuccess:function(response) {
					pass.bit = response.responseText.evalJSON();
					fire();
				}
			}
		);
	},
	loadFromString:function(s)
	{
		for (var i = 0 ; i < s.length; i++) {
			this.bit["_" + i] = (s.charAt(i) == "1" ? 1 : 0);
		}
	},
	sanctify:function(bit) 
	{
		if(!bit && bit != 0) {
			bit = this.persist;
		}
		
		if(isNaN(bit)) {
			bit = this.map[bit];
		}
		
		formbit = "_" + bit;
		this.persist = [formbit,bit];
		return [formbit,bit];
	},
	get:function(bit) 
	{
		_bit = this.sanctify(bit);
		_val = this.bit[_bit[0]];
		if (typeof(_val) == "undefined") _val = 0;
		return _val;
	},
	set:function(value,bit) 
	{
		//if(!this.active) return;
		
		_bit = (bit ? this.sanctify(bit) : this.persist);
		
		value = value == 1 ? 1 : 0;
		
		this.bit[_bit[0]] = value;
		
		var passbit = _bit[1];
		var passval = value;
	    var cashbrk = Math.round(Math.random()*10000000);
	
		new Ajax.Request(
			"/settings", 
			{
				method: 'get',
				parameters: {
					update_ui_prefs:1,
					bit:passbit,
					val:passval,
					bst:cashbrk
				},
				onSuccess:function(response){var sacrifice = response.responseText;}
			}
		);
	},
	trigger:function(funcs,bit) 
	{
		_bit = this.sanctify(bit);
	
		this.funcs[_bit[0]] = funcs;
		var pass = this;
	
		if(funcs.on) 	document.observe("dom:loaded", function() {if(pass.bit[_bit[0]] == 1) pass.funcs[_bit[0]].on();});
		if(funcs.off) 	document.observe("dom:loaded", function() {if(pass.bit[_bit[0]] == 0) pass.funcs[_bit[0]].off();});
	},
	toggle:function(bit) 
	{
		_val = this.get(bit);
		this.set(++_val%2);
	}
};

var $bit = Bitter;
	
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Sookie.js
AUTOCORE_SELF_CHECK.push("Oryx/Sookie.js");
/* 
 * 	Sookubit.js
 *  
 *  Manages the SOOKIE.sookubit object
 */

var Sookie = {
	
	url:'/sookie/remote_sookie.html',
	value:0,
	sookie:{},
	
	init:function(sookie)
	{
		if(sookie)
			this.sookie = sookie;
	},
	
	load:function()
	{
		var pass = this;
		new Ajax.Request(
			pass.url,
			{
				method:'get',
				parameters:{
					getall:1
				},
				onSuccess:function(response) {
					pass.sookie = response.responseText.evalJSON();
				}
			}
		);
	},
	
	get:function(n,o)
	{
		if(typeof this.sookie[n] == "undefined")
			return false;
		
		if(o)
			return this.sookie[n];
		else
			return this.sookie[n].value;
	},

	set:function(v,n,e)
	{
		var pass = this;
		
		params = {
			name:n,
			value:v
		}
		
		if(e) 
			params.expire = e;
		
		new Ajax.Request(
			pass.url,
			{
				method:'get',
				parameters:params,
				onSuccess:function() {
					pass.sookie[n] = v;
				}
			}
		);
	}
}

$sake = Sookie; 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Cookies.js
AUTOCORE_SELF_CHECK.push("Oryx/Cookies.js");
// 

function setOkCookie(name,value,expires) {
    setCookie(name,value,expires);
}

function deleteOkCookie(name) {
    deleteCookie(name);
}

// -----------------------------------------------------------------------------------

function getPageTopDomain() {
 var host = window.location.host;
 var parts = host.split('.');
 var res = parts[parts.length-2] + "." + parts[parts.length-1];
 if (res.indexOf(':') != -1) {
	 res = res.substr(0,res.indexOf(':'));
 }
 return res;
}

function secondsFromNow (sec) {
   res = new Date();
   res.setTime(new Date().getTime() + sec * 1000);
   return res;
}

// -----------------------------------------------------------------------------------

function setCookie(name,value,expires) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      "; path=/"+
      "; domain=" + getPageTopDomain();
  document.cookie = curCookie;
}
function deleteCookie(name) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    "; domain=" + getPageTopDomain() + 
    "; path=/"+
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function getCookie(name) {
	var dc = document.cookie;
  	var prefix = name + "=";
  	var begin = dc.indexOf("; " + prefix);
  	if (begin == -1) {
    	begin = dc.indexOf(prefix);
    	if (begin != 0) return null;
  	} 
	else
    	begin += 2;
  	var end = document.cookie.indexOf(";", begin);
  	if (end == -1)
    	end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

 /* 
 */

function addNewCoresToCookie(file_nums, hash) {
	 var old_cookie = getCookie("core");
	 var old_cookie_parts = [];
	 var new_cookie = old_cookie;
	 if (old_cookie)
		old_cookie_parts = old_cookie.split(":");
	 if (old_cookie_parts.length == 0 || old_cookie_parts[0] != hash)
		old_cookie
	 if (! old_cookie || old_cookie.split(":")[0] != hash)
		new_cookie = hash;
	 var new_addition = file_nums.join(",");
	 for (var i = 1; i < old_cookie_parts.length && old_cookie_parts[0] == hash; i++) {
		 if (old_cookie_parts[i] == new_addition) {
			 return;
		 }
	 }
	 new_cookie += ":" + new_addition;
	 setCookie("core", new_cookie, secondsFromNow(86400 * 30));
}

// Backwards compatibility, but limit miniCookies to 3600 seconds.
 
function setMiniCookie(name,value) {
	NanoCookie.set(name,value,{ms:3600*1000});
}

function deleteMiniCookie(name) {
	NanoCookie.remove(name);
}

function getMiniCookie(name) {
	return NanoCookie.get(name);
}

// 
NanoCookie = {
	
	// 
	set : function(key,value,expires,test) {
		var cookies = this.deserialize();
		var d = new Date();
		var obj = new Object();
		obj["k"] = key;
		obj["v"] = value;
		if (expires.ms)
			obj["e"] = d.getTime() + parseInt(expires.ms);
		else if (expires.gmt)
			obj["e"] = expires.gmt;
		else
			obj["e"] = expires.date.getTime();
		if (isNaN(obj["e"]))
			obj["e"] = 0;
		var found = false;

		for (var i = 0; i < cookies.length; i++) {
			if (cookies[i]["k"] == key) {
				cookies[i] = obj;
				found = true;
			}
		}
		if (! found)
			cookies.push(obj);
		this.serializeAndStore(cookies);
	},
	get : function(key) {
		var cookies = this.deserialize();
		for (var i = 0; i < cookies.length; i++) {
			if (cookies[i]["k"] == key) {
				return cookies[i]["v"];
			}
		}
		return null;
	},	
	// 
	getAll : function(nano_cookie_str) {
		var cookies = this.deserialize(nano_cookie_str);
		var res = [];
		for (var i = 0; i < cookies.length; i++) {
			var obj = new Object();
			obj["key"] = cookies[i]["k"];
			obj["value"] = cookies[i]["v"];
			obj["expires"] = new Date(cookies[i]["e"]);
			res.push(obj);
		}
		return res;		
	},
	// 
	findRegExp : function(regexp) {
		var cookies = this.deserialize();
		var res = [];
		for (var i = 0; i < cookies.length; i++) {
			if (regexp.test(cookies[i]["k"])) {
				var obj = new Object();
				obj["key"] = cookies[i]["k"];
				obj["value"] = cookies[i]["v"];
				obj["expires"] = new Date(cookies[i]["e"]);
				res.push(obj);
			}
		}
		return res;
	},
	remove : function(key) {
		this.set(key,"",{ms:-1},true);		
	},
	removeAll : function() {
		deleteCookie("nano");
	},
	//
	// gets from cookie called "nano" ; alternatively you 
	// can pass it your own cookie and it'll deserialize that
	deserialize : function(nano_cookie_str) {

		var x = nano_cookie_str ? nano_cookie_str : getCookie("nano");
		
		var result = [];
		if (! x)
			return result;
		else {
			var individuals = x.split("|");
			for (var i = 0; i < individuals.length; i++) {
				var obj = new Object();
				var pairs = individuals[i].split(",");
				for (var j = 0; j < pairs.length; j++) {
					var pair = pairs[j].split("=");
					var val = unescape(pair[1]);
					var pval = parseInt(val);
					if (pval == val && ! isNaN(pval))
						val = pval;
					obj[pair[0]] = val;
				}
				result.push(obj);				
			}
			result.sort(this.compareDates);
			// 
			var d = new Date();
			var any_stripped = false;
			while(result.length > 0 && new Date(result[result.length - 1]["e"]) < d) {
				result.length--;
				any_stripped = true;
			}
			return result;
		}
	},
	// 
	serializeAndStore : function(cookies) {
		var res = "";
		for (var i = 0; i < cookies.length; i++) {
			res += (i == 0) ? "" : "|";
			res += "k=" + escape(cookies[i]["k"]);
			res += ",e=" + escape(cookies[i]["e"]);
			res += ",v=" + escape(cookies[i]["v"]);
		}
		setCookie("nano", res, secondsFromNow(3600*24*365));
	},
	compareDates : function(a,b) {
		if (a["e"] && b["e"])
			return ((a["e"] < b["e"]) ? 1 : ((a["e"] > b["e"]) ? -1 : 0));
	}
};
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Feedback.js
AUTOCORE_SELF_CHECK.push("Oryx/Feedback.js");
// JavaScript Document

var FeedbackImpl = Class.create({
	m_timeLoaded : {},
	initialize : function() {
		this.m_timeLoaded = new Date();
	},
	send : function(feedback_type, feedback_title, feedback_text, servergmt, additional_cgi) {
		var params = {};
		params["url"] = window.location.href;
		params["feedbacktype"] = feedback_type;
		params["feedbacktitle"] = feedback_title;
		params["feedbacktext"] = feedback_text;
		params["ajax"] = 1;
		params["servergmt"] = servergmt;
		params["rand"] = Math.random();
		if (additional_cgi) {
			for (var key in additional_cgi) {
				params[key] = additional_cgi[key];			
			}
		}
		params["BrowserInfo"] = this.summarizeBrowserInfo(servergmt);
		new Ajax.Request("/feedback", {method : "post", parameters : params });
	},
	summarizeBrowserInfo : function(servergmt) {
		var br=new Array(4);
		var os=new Array(2);
		var flash=new Array(2);
		br=getBrowser();
		os=getOS();
		flash=hasFlashPlugin();
		var client_info = "\n----------------\n";
		client_info += "Time diff (at pageload): " + (this.m_timeLoaded.getTime()/1000 - servergmt)  + "seconds;\n Browser time: " + this.m_timeLoaded + " (" + this.m_timeLoaded.getTime() + ") [Server = " + servergmt + "]\n";
		client_info += ("Browser identifier: "+br[0]+"\n");
		client_info += ("Browser version: "+br[1]+"\n");
		client_info += ("Browser major version: "+getMajorVersion(br[1])+"\n");
		client_info += ("Browser minor version: "+getMinorVersion(br[1])+"\n");
		client_info += ("Browser engine: "+br[2]+"\n");
		client_info += ("Browser engine version: "+br[3]+"\n");
		client_info += ("Full user agent string: "+getFullUAString()+"\n");
		client_info += ("Operating system identifier: "+os[0]+"\n");
		client_info += ("Operating system version: "+os[1]+"\n");
		client_info += ("Is Flash installed? "+ (flash[0]==2 ? "Yes" : (flash[0] == 1 ? "No" : "unknown"))+"\n");
		client_info += ("Flash version: "+flash[1] + "\n");
		client_info += ("Are popups allowed for this site? NOT TESTED.\n" );
		client_info += ("JS? Yes, obviously.\n");
		return client_info;			
	}
	
});

Feedback = new FeedbackImpl();
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Form.js
AUTOCORE_SELF_CHECK.push("Oryx/Form.js");
/* ----------------------------------------------------------------

Form.js

	- manages custom form manipulation


TODO:
	behavior variable may be unnecessary

---------------------------------------------------------------- */

var Frm = {
	
	last:false,
	locked:false,
	
	behaviors:{},
	multiv:{},
	multit:{},
	savelock:false,
	
	lock_auxiliary:function(id)
	{
		// Replace with functions to happen on lock
		return false;
	},
	
	unlock_auxiliary:function(id)
	{
		// Replace with functions to happen on unlock
		return false;
	},
	
	lock:function(id) {
		this.lock_auxiliary(id);
		this.locked = id;
	},
	unlock:function(id) {
		this.unlock_auxiliary(id);
		this.locked = false;
	},
	
	toggle:function(id,behavior,force)
	{			
		button = $(id + "_button") || false;
		if(!behavior || behavior == '') behavior = "toggle";
		if(behavior == "buff")
			this.buffed = false;
		
		
		if(this.last == "location_interface" && ($("nearme") && !$("nearme").checked) && $("anywhere") && !$("anywhere").checked) {
			check_empty();
			this.buffed = id;
			return;
		}
		
		else if(this.last && id != this.last && button) {
			$(this.last + "_button").removeClassName('active');
			$(this.last + "_drop").style.display = 'none';
			$(this.last).removeClassName("open");
		}
		if(button) this.last = id;
		if(!this.behaviors[id]) this.behaviors[id] = behavior;
		if(button) {
			if(!button.hasClassName("active")) {
				$(id).addClassName("open");
				$(button).addClassName("active");
				$(id + '_drop').style.display = "block";
			} else if (behavior == "toggle" || behavior == "adder") {
				$(id).removeClassName("open");
				$(button).removeClassName('active');
				$(id + '_drop').style.display = "none";
			}
		}
	},
	set_auxiliary:function()
	{
		// Set this if you have a local action that 
		// needs to take place during the set operation
		return false;
	},
	set:function(name,value,id,text,init,pattern)
	{
		if(!init) this.save_reset();
		
		if(!$(name)) return;

		$(name).value = value;
			
		if(!pattern)
			$(id + "_button_text").innerHTML = $(text).innerHTML;
		else {
			t = $(text).innerHTML;
			$(id + "_button_text").innerHTML = util.jogf(pattern,{s:t});
		}

		this.set_auxiliary(name,value,id,text,init,pattern);

		if(!init) this.toggle(id,this.behaviors[id]);
	},
	save_reset:function()
	{
		/* 
		This function is overwritten by match.js if it's included.
		Left in because it could have utility elsewhere.
		*/
		return false;
	},
	
	pro_show:function(from)
	{
		/* 
		This function is overwritten by match.js if it's included.
		Left in because it could have utility elsewhere.
		*/
		return false;
	},
	
	multi_set:function(name,id,point,count,pattern,width,default_text,init)
	{	
		
		c = $(id + "_check_" + point);
		
		if(c.checked != true || init) 
			c.checked = true;
		else
			c.checked = false;
		
		this.multiv[id] = [];
		this.multit[id] = [];
		
		items = $(id + "_drop").getElementsByTagName("li");
		
		for(iter=0;iter<items.length;iter++) {
			
			if(items[iter].className == "divvy") continue;
			var item = $(items[iter]).getElementsByTagName("input")[0];
			
			if(item.checked) {
				this.multiv[id][this.multiv[id].length] = item.value;
				this.multit[id][this.multit[id].length] = item.title;
			}
		}
		
		$(name).value = util.toMask(this.multiv[id]);
		
		if(this.multit[id].length != 0) {
			text = this.multit[id].join(", ");
			display = this.limit_text(pattern,text,width);
		} else {
			display = default_text;
		}
		$(id + "_button_text").innerHTML = display;
		
		if(!init) this.save_reset();
	},
	
	limit_text:function(pattern,text,width)
	{
		display = util.jogf(pattern,{s:text});
		
		flashback = pattern.substring(0,pattern.indexOf(" %s"));
		
		lim = Math.round(width/10);

		if(display.length > lim) display = display.substring(0,lim) + "...";
		
		display = display.substring(flashback.length,display.length);
		output = flashback + "<span>" + display + "</span>";
		
		return output;
	},
	
	// Special cases
	
	process_age:function(init)
	{
		minc = $("min_age").value;
		min = parseInt($("min_age").value.strip());
		max = parseInt($("max_age").value.strip());
		txt = $("ages_button_text");
		
		if(isNaN(min)) {
			min = false;
			$("min_age").value = "";
		}
		if(isNaN(max)) {
			max = false;
			$("max_age").value = "";
		}
		if(min < 18 && minc.length == 2) {
			min = 18;
			$("min_age").value = 18;
		}
		
		if(min && !max) {
			txt.innerHTML = "Ages " + min + " to 99" ;
		} else if(!min && max) {
			txt.innerHTML = "Ages 18 to " + max;
		} else if(min && max) {
			txt.innerHTML = "Ages " + min + " to " + max;
		} else {
			txt.innerHTML = "Age";
		}
		if(!init) this.save_reset();
	},
	
	process_keywords:function(v,init) 
	{
		if(v.strip().length != 0) {
			list = v.split(" ");
			text = list.join(", ");
			pattern = "Keywords: %s";
			width = 240;
			display = this.limit_text(pattern,text,width);
		} else {
 			display = "Keywords";
		}
		$("keywords_search_button_text").innerHTML = display;
		if(!init) this.save_reset();
	},
	
	process_height:function(init)
	{
		min_obj = $("height_min");
		max_obj = $("height_max");
		
		min = min_obj.value;
		max = max_obj.value;
		
		min_t = min_obj[min_obj.selectedIndex].innerHTML;
		max_t = max_obj[max_obj.selectedIndex].innerHTML;
		
		if(min > max && max != "0")
		{
			max_obj.selectedIndex = min_obj.selectedIndex;
		}
		
		if(min != "0" && max == "0") {
			display = "At least " + min_t;
		} else if (min == "0" && max != "0") {
			display = "Under " + max_t;
		} else if (min != "0" && max != "0") {
			display = "Between " + min_t + " and " + max_t;
		} else {
			display = "Height";
		}
		
		$("heights_button_text").innerHTML = display;
		
		if(!init) this.save_reset();
	},
	
	process_language:function(v,init)
	{
		objs = $("language");
		for(iter=0;iter<objs.length;++iter) {
			if(objs[iter].value==v && objs[iter].value != "") {
				desig = objs[iter].value;
				lang = objs[iter].innerHTML;
			} else if(objs[iter].value == "") {
				desig = "";
				lang = "...";
			}
		}
		
		if(lang) 
		{
			$("languages_button_text").innerHTML = "Speaks " + lang;
			$("MATCH_FILTER_LANGUAGES").value = desig;
			$("match_lang").checked = false;
		} else {
			$("languages_button_text").innerHTML = "Speaks ...";
		}
		if(!init) this.save_reset();
	},
	
	process_match_lang:function(checked,init)
	{
		console.log(init);
		
		if(!checked) {
			this.process_language($("language")[$("language").selectedIndex].value,init);
		} else {
			$("MATCH_FILTER_LANGUAGES").value = "0";
			$("languages_button_text").innerHTML = "Speaks my language(s)";
		}
		if(!init) this.save_reset();
	},
	
	// A bunch of location specific stuff

	timed:false,
	begin_check:function()
	{
		if(this.timed) clearTimeout(this.timed);
		this.timed = setTimeout("Frm.try_location()",1200);
	},
	
	try_location:function()
	{
		check_empty();
	},
	
	location_swaps:function(state)
	{
		switch(state)
		{
			case "nearme":
				$('radius').disabled = false;
			break;
			case "text":
				if($("nearme")) $("nearme").checked = false;
				$("anywhere").checked = false;
				$('radius').disabled = false;
			break;
			case "anywhere":
				$('radius').disabled = true;
			break;
		}
		this.save_reset();
	}
}

document.observe("click",function() {
	if(Frm.last && Frm.locked != Frm.last)
	{
		if(Frm.last != "location_interface") {
			$(Frm.last).removeClassName("open");
			$(Frm.last + "_button").removeClassName("active");
			$(Frm.last + "_drop").style.display = 'none';
		} else {
			check_empty();
		}
	}
	if($("searches_drop") && $("searches_drop").style.display=="block" && !Frm.savelock) {
		$("searches_drop").style.display="none";
	}
});
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/MatchCall.js
AUTOCORE_SELF_CHECK.push("Oryx/MatchCall.js");
var MatchCall = Class.create({
	initialize:function(args) {
		this.args = args;
		this.makecall();
	},
    //the strings and numbers here are pulled from match_prot.x; be sure to keep them up to date!
    //last updated: 9/15/08
    lookupSortString:function(name)
    {
        if(name == "match")
            return 0;
        if(name == "enemy")
            return 1;
        if(name == "random")
            return 2;
        if(name == "friend")
            return 3;
        if(name == "login")
            return 4;
        if(name == "join")
            return 6;
        if(name == "distance")
            return 7;
        if(name == "looks")
            return 8;
        if(name == "personality")
            return 9;
        if(name == "first_contact")
            return 10;
        if(name == "completeness")
            return 11;
        if(name == "rmatch")
            return 12;

        $log("unknown sort specified "+name, "error");
        return -1;
    },
    lookupFilterString:function(name)
    {
        if(name == "gentation")
            return 0;
        if(name == "require_photo")
            return 1;
        if(name == "age")
            return 2;
        if(name == "radius")
            return 3;
        if(name == "last_login")
            return 5;
        if(name == "join_date")
            return 6;
        if(name == "eligible")
            return 7;
        if(name == "religion")
            return 8;
        if(name == "ethnicity")
            return 9;
        if(name == "height")
            return 10;
        if(name == "smoking")
            return 11;
        if(name == "drinking")
            return 12;
        if(name == "drugs")
            return 13;
        if(name == "money")
            return 14;
        if(name == "jobtype")
            return 15;
        if(name == "dogs")
            return 16;
        if(name == "cats")
            return 17;
        if(name == "children")
            return 18;
        if(name == "education")
            return 19;
        if(name == "personality")
            return 20;
        if(name == "sign")
            return 21;
        if(name == "languages")
            return 22;
        if(name == "v_looks")
            return 23;
        if(name == "v_personality")
            return 25;
        if(name == "v_first_contact")
            return 27;
        if(name == "completeness")
            return 29;
        $log("unknown filter "+name, "error");
        return -1;
    },

    createParamString:function(obj) 
    {
        //see https://okoffice.okcupid.com/oktrac/wiki/MatchAjaxCalls for the idea behind what
        //goes in this object.  In a jiffy: immediate parameters "low", "count", "templateStyle",
        //and "destination"; and arrays "filters" and "sorts"

        //while a member of this object, nonetheless this is a handy general purpose function
        var cgi_param_str = "ajax=1&cacheBust=" + Math.round(Math.random()*1000000000000);
        if(obj.count)
        {
            cgi_param_str += "&count="+obj.count;
        }

        if(obj.locid)
        {
            cgi_param_str += "&locid="+obj.locid;
        }

        if(obj.low)
        {
            cgi_param_str += "&low="+obj.low;
        }

        if(obj.templateStyle)
        {
            cgi_param_str += "&template_style="+obj.templateStyle;
        }
        //using default prefs/ ignoring old prefs, unless specified
        if(obj.discard_prefs)
        {
            cgi_param_str += "&discard_prefs="+obj.discard_prefs;
        }
        else
        {
            cgi_param_str += "&discard_prefs=1";
        }
        if(obj.use_prefs)
        {
            cgi_param_str += "&use_prefs="+obj.use_prefs;
        }
        else
        {
            cgi_param_str += "&use_prefs=0";
        }
        
        //filters
        if(obj.filtersOverride && obj.filtersOverride.length) {
            cgi_param_str += obj.filtersOverride;
        } else if(obj.filters) {
            for(var i = 0; i < obj.filters.length; i++)
            {
                if(!obj.filters[i].name)
                {
                    $log("Missing filter name!", "error");
                    continue;
                }
                if(obj.filters[i].values.length == 0 ||
                   obj.filters[i].values.length > 2)
                {
                    $log("too many, or two few, values for filter", "error");
                    continue;
                }
                var filterNo = this.lookupFilterString(obj.filters[i].name);
                var part1 = "," + obj.filters[i].values[0];
                var part2 = "";
                if(obj.filters[i].values.length == 2)
                {
                    part2 += "," + obj.filters[i].values[1];
                }
                cgi_param_str += "&filter"+(i+1)+"="+filterNo+part1+part2;
            }
        }

        //sorts
        if(obj.sorts)
        {
            for(var i = 0; i < obj.sorts.length; i++)
            {
                if(!obj.sorts[i].name)
                {
                    $log("Missing sort name!", "error");
                    continue;
                }
                if(!obj.sorts[i].weight ||
                    obj.sorts[i].weight < 0 ||
                    obj.sorts[i].weight > 10000) 
                {
                    $log("sort missing weight, or invalid weight!", "error");
                    continue;
                }
                var sortNo = this.lookupSortString(obj.sorts[i].name);
                cgi_param_str += "&sort"+(i+1)+"="+sortNo+","+obj.sorts[i].weight;
                if(obj.sorts[i].reverse) //default is false, so we only need to override if true
                {
                    cgi_param_str += ",1"; //see match.T, line 1254 (as of this code revision)
                }
            }
        }
        return cgi_param_str;
    },
	makecall:function() {
        var params = this.createParamString(this.args);
		var success_function = this.doNothing;
        if(this.args.onSuccess)
        {
            success_function = this.args.onSuccess; //caller interrupts and does what he will...
        }
        else if(this.args.destination)
        {
            if(! this.args.templateStyle)
            {
                $log("destination specified, but templateStyle not - will be injecting raw JSON...", "error");
            }
            var pass = this;
            success_function = function(resp) { pass.setHTMLHelper(resp); };
        }

        new Ajax.Request(
			'/match',
			{
                method:'POST',
			    parameters:params,
			    onSuccess:success_function
            }
		);
	},
	setHTMLHelper:function(resp)
    {
		if (this.args.overwrite)
			$(this.args.destination).innerHTML = resp.transport.responseText;
		else
        	$(this.args.destination).innerHTML += resp.transport.responseText;
		resp = "";
    },
    doNothing:function(whatever){}
});
/*
Example setup

function output(response){
    $log(response.responseText);
}
var call_object = {
    count:13,
    destination: 'abc',
    templateStyle:'xyz',
    sorts: [{name:"match", weight:10}]
};
new AjaxMatchCall(call_object);

*/
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/StepAction.js
AUTOCORE_SELF_CHECK.push("Oryx/StepAction.js");
/* ----------------------------------------------------------------

StepAction.js

	- Left, Left, left ...

Allows for resetting evironments on action triggers.

TODO : Create abstract action tree implementation

---------------------------------------------------------------- */

var StepAction = Class.create({
	initialize:function(advancers,steps,pattern,init)
	{
	    this.steps = {_step:function(){},_clean:function(){}};
	     
		this.stage 		= -1;
		this.advancer 	= advancers;
		this.pattern	= pattern;
		this.steps		= Object.extend(this.steps,steps);
		
		var pass = this;
		
		KeyCombos[advancers.next] = function() {pass.advance();}
		KeyCombos[advancers.prev] = function() {pass.regress();}
		
		if(init) this.advance();
	},	
	advance:function(e)
	{
		if(++this.stage == this.pattern.length) this.stage = 0;
		this.steps._step();
		this.steps[this.pattern[this.stage]]();
		this.steps._clean();
	},
	regress:function(e)
	{
		if(--this.stage < 0) this.stage = this.pattern.length -1;
		this.steps._step();
		this.steps[this.pattern[this.stage]]();
		this.steps._clean();
	}
}); 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/TextDialogue.js
AUTOCORE_SELF_CHECK.push("Oryx/TextDialogue.js");
/* ----------------------------------------------------------------

OkCupid TextDialogues

	- Maintains some specified textbox features

This is a highly specialized file for the okcupid text boxes.

---------------------------------------------------------------- */

var TextDialogue = Class.create({
    initialize:function(obj,parameters) {
        this.o = $(obj);
        
        if(Object.isString(obj))    this.n = obj;
        else                        this.n = obj.id;
        
        if(!this.n || !this.o) return;
                
        new Draggable(this.o);

		if(Prototype.Browser.IE == false)
			this.o.style.position = "fixed";
        else {
			this.o.style.position = "absolute";
			var pass = this;
			Event.observe(window,"scroll",function(){
				// No need for prototype here; native methods used for performance
				pass.o.style.marginTop = document.documentElement.scrollTop + "px";
			});
		}

        var text = $(this.n + "_text");
        var acts = $(this.n + "_acts");
        var togg = $(this.n + "_togg");
        
        var actsTextDefault = acts.innerHTML;
        var toggTextDefault = togg.innerHTML;
        
        var altered = false;
        
        text.observe("keydown",function() {
            if(!altered) return;
            acts.innerHTML = actsTextDefault;
            togg.innerHTML = toggTextDefault;
            altered = false;
        });
        
        acts.href = "#nogo";
        acts.observe("click",function() {parameters.action(), altered = true;});
    }
});

/*
Current implementation is a little verbose; will make the class more robust if
needed.

EXAMPLE:

var messageDialogue = {
    action:function() {
		var params = {whatever:something}
        new Ajax.Request("/url",{
            parameters:params,
            onSuccess:function() {
                Do something
            }
        });
    }
}
document.observe("dom:loaded",function(){new TextDialogue("message", messageDialogue);});

*/ 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/Oryx/Utilities.Admin.js
AUTOCORE_SELF_CHECK.push("Oryx/Utilities.Admin.js");
var Admin = {
    blacklist:function(whom,id) {
        var comment = prompt("What reason are you blacklisting " + whom + " for?");
        if (comment != null)
        {
            window.location.href =
                "http://services.okcupid.com/admin/acctstatus" +
                    "?submit-update=1" + 
                    "&userid=" + id +
                    "&status=5" +
                    "&comment=" + comment;
        }
    }
}
 
AUTOCORE_SELF_CHECK.pop();
	
// File: /okcontent/js/service/match_graph.js
AUTOCORE_SELF_CHECK.push("service/match_graph.js");
//
question_data = [

	{
		question: 'Let&#39;s get you some matches. First, are you attracted to dangerous situations?',
		answers: ["Yes","No"],
		WY: {
			StraightMale: [13,27],
			StraightFemale: [4,16],
			GayMale: [1,0],
			BiMale: [2,1],
			BiFemale: [1,1]
		},
		WV: {
			StraightMale: [65,87],
			StraightFemale: [33,53],
			GayMale: [0,4],
			GayFemale: [1,2],
			BiMale: [1,2],
			BiFemale: [10,10]
		},
		WI: {
			StraightMale: [249,473],
			StraightFemale: [102,266],
			GayMale: [14,32],
			GayFemale: [14,16],
			BiMale: [12,20],
			BiFemale: [57,60]
		},
		WA: {
			StraightMale: [604,954],
			StraightFemale: [258,537],
			GayMale: [27,75],
			GayFemale: [31,45],
			BiMale: [26,44],
			BiFemale: [118,187]
		},
		VT: {
			StraightMale: [39,50],
			StraightFemale: [14,41],
			GayMale: [1,7],
			GayFemale: [2,2],
			BiMale: [5,5],
			BiFemale: [9,11]
		},
		VI: {
			StraightMale: [0,3],
			StraightFemale: [0,1]
		},
		VA: {
			StraightMale: [410,598],
			StraightFemale: [172,361],
			GayMale: [21,45],
			GayFemale: [13,24],
			BiMale: [11,23],
			BiFemale: [68,66]
		},
		UT: {
			StraightMale: [126,140],
			StraightFemale: [42,76],
			GayMale: [2,10],
			GayFemale: [2,5],
			BiMale: [2,7],
			BiFemale: [16,18]
		},
		TX: {
			StraightMale: [934,1370],
			StraightFemale: [397,905],
			GayMale: [53,91],
			GayFemale: [33,51],
			BiMale: [29,43],
			BiFemale: [115,133]
		},
		TN: {
			StraightMale: [200,283],
			StraightFemale: [67,184],
			GayMale: [10,14],
			GayFemale: [7,9],
			BiMale: [8,9],
			BiFemale: [23,30]
		},
		SD: {
			StraightMale: [20,29],
			StraightFemale: [11,25],
			GayMale: [2,1],
			GayFemale: [0,1],
			BiFemale: [3,4]
		},
		SC: {
			StraightMale: [146,188],
			StraightFemale: [60,120],
			GayMale: [5,7],
			GayFemale: [10,7],
			BiMale: [4,2],
			BiFemale: [27,10]
		},
		RI: {
			StraightMale: [52,91],
			StraightFemale: [35,56],
			GayMale: [1,12],
			GayFemale: [4,2],
			BiMale: [6,3],
			BiFemale: [5,13]
		},
		PR: {
			StraightMale: [6,8],
			StraightFemale: [3,8],
			GayMale: [2,1],
			BiMale: [1,0]
		},
		PA: {
			StraightMale: [605,909],
			StraightFemale: [310,559],
			GayMale: [27,58],
			GayFemale: [32,26],
			BiMale: [29,30],
			BiFemale: [95,118]
		},
		OR: {
			StraightMale: [361,536],
			StraightFemale: [146,336],
			GayMale: [18,53],
			GayFemale: [23,28],
			BiMale: [13,22],
			BiFemale: [67,116]
		},
		OK: {
			StraightMale: [181,252],
			StraightFemale: [54,165],
			GayMale: [3,16],
			GayFemale: [6,5],
			BiMale: [3,2],
			BiFemale: [18,28]
		},
		OH: {
			StraightMale: [482,786],
			StraightFemale: [214,483],
			GayMale: [13,53],
			GayFemale: [24,22],
			BiMale: [23,22],
			BiFemale: [88,100]
		},
		NY: {
			StraightMale: [956,1411],
			StraightFemale: [483,932],
			GayMale: [71,147],
			GayFemale: [57,66],
			BiMale: [43,43],
			BiFemale: [169,160]
		},
		NV: {
			StraightMale: [128,168],
			StraightFemale: [54,93],
			GayMale: [5,11],
			GayFemale: [5,7],
			BiMale: [6,7],
			BiFemale: [29,18]
		},
		NM: {
			StraightMale: [76,128],
			StraightFemale: [32,64],
			GayMale: [7,8],
			GayFemale: [1,4],
			BiMale: [3,10],
			BiFemale: [18,15]
		},
		NJ: {
			StraightMale: [344,542],
			StraightFemale: [126,330],
			GayMale: [7,31],
			GayFemale: [10,18],
			BiMale: [9,10],
			BiFemale: [43,39]
		},
		NH: {
			StraightMale: [86,134],
			StraightFemale: [36,81],
			GayMale: [3,12],
			GayFemale: [4,4],
			BiMale: [6,7],
			BiFemale: [11,25]
		},
		NE: {
			StraightMale: [86,127],
			StraightFemale: [38,79],
			GayMale: [2,3],
			GayFemale: [2,3],
			BiMale: [2,4],
			BiFemale: [14,17]
		},
		ND: {
			StraightMale: [19,45],
			StraightFemale: [14,21],
			GayFemale: [0,0],
			BiMale: [2,2],
			BiFemale: [4,3]
		},
		NC: {
			StraightMale: [336,455],
			StraightFemale: [154,301],
			GayMale: [10,32],
			GayFemale: [13,21],
			BiMale: [14,19],
			BiFemale: [57,57]
		},
		MT: {
			StraightMale: [35,53],
			StraightFemale: [15,30],
			GayMale: [1,0],
			GayFemale: [0,2],
			BiMale: [0,5],
			BiFemale: [4,6]
		},
		MS: {
			StraightMale: [47,64],
			StraightFemale: [21,49],
			GayMale: [2,2],
			GayFemale: [0,3],
			BiMale: [0,6],
			BiFemale: [4,6]
		},
		MO: {
			StraightMale: [300,405],
			StraightFemale: [122,283],
			GayMale: [20,29],
			GayFemale: [6,19],
			BiMale: [10,9],
			BiFemale: [43,52]
		},
		MN: {
			StraightMale: [311,509],
			StraightFemale: [143,308],
			GayMale: [9,27],
			GayFemale: [10,19],
			BiMale: [9,19],
			BiFemale: [33,90]
		},
		MI: {
			StraightMale: [453,726],
			StraightFemale: [217,493],
			GayMale: [21,61],
			GayFemale: [18,29],
			BiMale: [16,24],
			BiFemale: [76,89]
		},
		ME: {
			StraightMale: [61,111],
			StraightFemale: [32,76],
			GayMale: [3,2],
			GayFemale: [6,5],
			BiMale: [3,4],
			BiFemale: [20,13]
		},
		MD: {
			StraightMale: [340,522],
			StraightFemale: [131,307],
			GayMale: [23,45],
			GayFemale: [21,22],
			BiMale: [11,25],
			BiFemale: [53,53]
		},
		MA: {
			StraightMale: [515,861],
			StraightFemale: [263,617],
			GayMale: [21,60],
			GayFemale: [28,40],
			BiMale: [26,34],
			BiFemale: [119,151]
		},
		LA: {
			StraightMale: [140,162],
			StraightFemale: [57,120],
			GayMale: [6,11],
			GayFemale: [11,5],
			BiMale: [6,4],
			BiFemale: [27,11]
		},
		KY: {
			StraightMale: [127,196],
			StraightFemale: [53,129],
			GayMale: [2,12],
			GayFemale: [1,5],
			BiMale: [6,6],
			BiFemale: [20,21]
		},
		KS: {
			StraightMale: [140,202],
			StraightFemale: [64,142],
			GayMale: [3,5],
			GayFemale: [9,4],
			BiMale: [10,6],
			BiFemale: [25,24]
		},
		IN: {
			StraightMale: [246,391],
			StraightFemale: [112,230],
			GayMale: [19,25],
			GayFemale: [13,8],
			BiMale: [10,18],
			BiFemale: [42,39]
		},
		IL: {
			StraightMale: [574,879],
			StraightFemale: [281,608],
			GayMale: [32,73],
			GayFemale: [15,38],
			BiMale: [21,28],
			BiFemale: [99,108]
		},
		ID: {
			StraightMale: [52,74],
			StraightFemale: [21,46],
			GayMale: [1,3],
			GayFemale: [0,2],
			BiMale: [2,1],
			BiFemale: [14,13]
		},
		IA: {
			StraightMale: [121,195],
			StraightFemale: [54,137],
			GayMale: [6,14],
			GayFemale: [1,6],
			BiMale: [6,4],
			BiFemale: [27,23]
		},
		HI: {
			StraightMale: [39,55],
			StraightFemale: [15,30],
			GayMale: [3,6],
			GayFemale: [2,2],
			BiMale: [0,2],
			BiFemale: [3,7]
		},
		GU: {
			StraightMale: [0,1],
			StraightFemale: [1,0]
		},
		GA: {
			StraightMale: [373,544],
			StraightFemale: [153,383],
			GayMale: [11,33],
			GayFemale: [14,26],
			BiMale: [8,15],
			BiFemale: [38,53]
		},
		FL: {
			StraightMale: [668,1048],
			StraightFemale: [342,688],
			GayMale: [28,66],
			GayFemale: [38,49],
			BiMale: [22,25],
			BiFemale: [139,118]
		},
		DE: {
			StraightMale: [48,64],
			StraightFemale: [14,56],
			GayMale: [1,3],
			GayFemale: [5,4],
			BiMale: [0,0],
			BiFemale: [6,7]
		},
		DC: {
			StraightMale: [90,103],
			StraightFemale: [58,84],
			GayMale: [10,31],
			GayFemale: [3,6],
			BiMale: [4,6],
			BiFemale: [14,9]
		},
		CT: {
			StraightMale: [172,229],
			StraightFemale: [75,170],
			GayMale: [9,21],
			GayFemale: [11,9],
			BiMale: [2,12],
			BiFemale: [27,34]
		},
		CO: {
			StraightMale: [347,442],
			StraightFemale: [143,264],
			GayMale: [9,24],
			GayFemale: [5,14],
			BiMale: [15,13],
			BiFemale: [57,62]
		},
		CA: {
			StraightMale: [2035,3044],
			StraightFemale: [893,1934],
			GayMale: [108,248],
			GayFemale: [103,129],
			BiMale: [96,128],
			BiFemale: [310,394]
		},
		AZ: {
			StraightMale: [312,439],
			StraightFemale: [130,317],
			GayMale: [10,43],
			GayFemale: [15,13],
			BiMale: [13,17],
			BiFemale: [46,55]
		},
		AS: {
			StraightMale: [0,3]
		},
		AR: {
			StraightMale: [74,111],
			StraightFemale: [31,82],
			GayMale: [2,8],
			GayFemale: [1,2],
			BiMale: [4,3],
			BiFemale: [12,13]
		},
		AL: {
			StraightMale: [120,170],
			StraightFemale: [48,131],
			GayMale: [3,13],
			GayFemale: [5,6],
			BiMale: [3,5],
			BiFemale: [15,19]
		},
		AK: {
			StraightMale: [50,54],
			StraightFemale: [27,32],
			GayMale: [3,2],
			GayFemale: [1,0],
			BiMale: [3,1],
			BiFemale: [8,7]
		}

	},
	{
		question: 'Interesting. Would you date someone who is bisexual? (Note the states have begun changing based on your answers.)',
		answers: ["Yes","No"],
		WY: {
			StraightMale: [677,199],
			StraightFemale: [154,355],
			GayMale: [22,10],
			GayFemale: [15,4],
			BiMale: [31,0],
			BiFemale: [69,4]
		},
		WV: {
			StraightMale: [1935,668],
			StraightFemale: [456,1368],
			GayMale: [118,38],
			GayFemale: [57,21],
			BiMale: [80,1],
			BiFemale: [263,25]
		},
		WI: {
			StraightMale: [9014,2727],
			StraightFemale: [2291,4733],
			GayMale: [506,119],
			GayFemale: [327,67],
			BiMale: [348,12],
			BiFemale: [1125,75]
		},
		WA: {
			StraightMale: [18324,4793],
			StraightFemale: [4632,8689],
			GayMale: [1168,329],
			GayFemale: [797,177],
			BiMale: [786,11],
			BiFemale: [2738,160]
		},
		VT: {
			StraightMale: [1201,230],
			StraightFemale: [395,545],
			GayMale: [75,15],
			GayFemale: [56,14],
			BiMale: [65,2],
			BiFemale: [232,10]
		},
		VI: {
			StraightMale: [19,14],
			StraightFemale: [4,22],
			GayMale: [1,0],
			GayFemale: [1,0],
			BiFemale: [4,0]
		},
		VA: {
			StraightMale: [13716,4111],
			StraightFemale: [2788,7208],
			GayMale: [800,209],
			GayFemale: [439,128],
			BiMale: [498,10],
			BiFemale: [1543,123]
		},
		UT: {
			StraightMale: [3509,1193],
			StraightFemale: [663,1645],
			GayMale: [216,60],
			GayFemale: [119,25],
			BiMale: [140,3],
			BiFemale: [418,28]
		},
		TX: {
			StraightMale: [31444,10420],
			StraightFemale: [6013,18922],
			GayMale: [1992,564],
			GayFemale: [1057,381],
			BiMale: [1158,25],
			BiFemale: [3352,392]
		},
		TN: {
			StraightMale: [7301,2629],
			StraightFemale: [1414,4638],
			GayMale: [451,152],
			GayFemale: [274,85],
			BiMale: [307,1],
			BiFemale: [862,92]
		},
		SD: {
			StraightMale: [784,282],
			StraightFemale: [185,467],
			GayMale: [34,10],
			GayFemale: [23,7],
			BiMale: [29,1],
			BiFemale: [111,10]
		},
		SC: {
			StraightMale: [4401,1545],
			StraightFemale: [856,2843],
			GayMale: [256,59],
			GayFemale: [155,57],
			BiMale: [141,4],
			BiFemale: [479,51]
		},
		RI: {
			StraightMale: [2098,543],
			StraightFemale: [523,1227],
			GayMale: [200,55],
			GayFemale: [105,32],
			BiMale: [85,0],
			BiFemale: [329,26]
		},
		PR: {
			StraightMale: [229,144],
			StraightFemale: [68,198],
			GayMale: [29,10],
			GayFemale: [8,1],
			BiMale: [9,1],
			BiFemale: [33,3]
		},
		PA: {
			StraightMale: [20571,5974],
			StraightFemale: [5123,11780],
			GayMale: [1254,358],
			GayFemale: [818,219],
			BiMale: [731,16],
			BiFemale: [2626,191]
		},
		OR: {
			StraightMale: [10531,2464],
			StraightFemale: [2992,5094],
			GayMale: [676,149],
			GayFemale: [566,117],
			BiMale: [545,9],
			BiFemale: [1907,108]
		},
		OK: {
			StraightMale: [6106,2164],
			StraightFemale: [982,3794],
			GayMale: [344,84],
			GayFemale: [182,59],
			BiMale: [240,8],
			BiFemale: [730,70]
		},
		OH: {
			StraightMale: [17786,5815],
			StraightFemale: [3961,10200],
			GayMale: [1078,339],
			GayFemale: [661,170],
			BiMale: [707,15],
			BiFemale: [2198,172]
		},
		NY: {
			StraightMale: [35240,9528],
			StraightFemale: [9677,21592],
			GayMale: [3113,1020],
			GayFemale: [1653,405],
			BiMale: [1266,34],
			BiFemale: [4242,396]
		},
		NV: {
			StraightMale: [4348,1177],
			StraightFemale: [795,2091],
			GayMale: [194,64],
			GayFemale: [112,43],
			BiMale: [154,4],
			BiFemale: [513,65]
		},
		NM: {
			StraightMale: [2483,741],
			StraightFemale: [618,1258],
			GayMale: [160,47],
			GayFemale: [71,30],
			BiMale: [134,1],
			BiFemale: [356,33]
		},
		NJ: {
			StraightMale: [12049,3668],
			StraightFemale: [2298,6943],
			GayMale: [672,239],
			GayFemale: [364,149],
			BiMale: [375,8],
			BiFemale: [1156,95]
		},
		NH: {
			StraightMale: [2909,685],
			StraightFemale: [691,1615],
			GayMale: [139,48],
			GayFemale: [92,36],
			BiMale: [101,0],
			BiFemale: [387,29]
		},
		NE: {
			StraightMale: [2514,755],
			StraightFemale: [498,1346],
			GayMale: [103,32],
			GayFemale: [69,27],
			BiMale: [94,4],
			BiFemale: [289,24]
		},
		ND: {
			StraightMale: [839,299],
			StraightFemale: [162,389],
			GayMale: [24,2],
			GayFemale: [23,1],
			BiMale: [29,3],
			BiFemale: [75,6]
		},
		NC: {
			StraightMale: [11605,3727],
			StraightFemale: [2394,7275],
			GayMale: [698,190],
			GayFemale: [462,135],
			BiMale: [427,8],
			BiFemale: [1405,140]
		},
		MT: {
			StraightMale: [1213,360],
			StraightFemale: [289,654],
			GayMale: [48,10],
			GayFemale: [40,12],
			BiMale: [40,1],
			BiFemale: [152,4]
		},
		MS: {
			StraightMale: [1822,703],
			StraightFemale: [334,1252],
			GayMale: [109,33],
			GayFemale: [53,24],
			BiMale: [66,2],
			BiFemale: [228,14]
		},
		MO: {
			StraightMale: [9310,2844],
			StraightFemale: [2089,5679],
			GayMale: [517,134],
			GayFemale: [318,91],
			BiMale: [379,8],
			BiFemale: [1136,108]
		},
		MN: {
			StraightMale: [9804,3130],
			StraightFemale: [2419,5333],
			GayMale: [599,160],
			GayFemale: [368,88],
			BiMale: [370,6],
			BiFemale: [1279,88]
		},
		MI: {
			StraightMale: [15993,4825],
			StraightFemale: [3840,9445],
			GayMale: [953,276],
			GayFemale: [555,153],
			BiMale: [627,10],
			BiFemale: [1983,166]
		},
		ME: {
			StraightMale: [2335,544],
			StraightFemale: [706,1325],
			GayMale: [121,38],
			GayFemale: [114,37],
			BiMale: [93,3],
			BiFemale: [377,21]
		},
		MD: {
			StraightMale: [10039,2772],
			StraightFemale: [2281,5317],
			GayMale: [648,152],
			GayFemale: [423,122],
			BiMale: [353,2],
			BiFemale: [1292,121]
		},
		MA: {
			StraightMale: [18245,4006],
			StraightFemale: [5384,10901],
			GayMale: [1439,399],
			GayFemale: [1125,201],
			BiMale: [719,12],
			BiFemale: [2725,190]
		},
		LA: {
			StraightMale: [4253,1370],
			StraightFemale: [882,2656],
			GayMale: [279,63],
			GayFemale: [167,43],
			BiMale: [170,6],
			BiFemale: [553,63]
		},
		KY: {
			StraightMale: [4929,1834],
			StraightFemale: [1062,3219],
			GayMale: [315,82],
			GayFemale: [158,46],
			BiMale: [182,6],
			BiFemale: [670,56]
		},
		KS: {
			StraightMale: [4414,1368],
			StraightFemale: [883,2406],
			GayMale: [188,60],
			GayFemale: [133,46],
			BiMale: [169,6],
			BiFemale: [532,53]
		},
		IN: {
			StraightMale: [9302,3002],
			StraightFemale: [1985,5708],
			GayMale: [560,156],
			GayFemale: [312,111],
			BiMale: [374,8],
			BiFemale: [1170,127]
		},
		IL: {
			StraightMale: [20989,6060],
			StraightFemale: [5066,11846],
			GayMale: [1440,497],
			GayFemale: [763,214],
			BiMale: [753,14],
			BiFemale: [2401,189]
		},
		ID: {
			StraightMale: [2001,707],
			StraightFemale: [424,1096],
			GayMale: [91,23],
			GayFemale: [39,13],
			BiMale: [70,1],
			BiFemale: [207,21]
		},
		IA: {
			StraightMale: [4182,1263],
			StraightFemale: [1005,2402],
			GayMale: [212,53],
			GayFemale: [130,38],
			BiMale: [146,7],
			BiFemale: [507,38]
		},
		HI: {
			StraightMale: [1550,395],
			StraightFemale: [290,658],
			GayMale: [102,20],
			GayFemale: [39,13],
			BiMale: [56,1],
			BiFemale: [138,10]
		},
		GU: {
			StraightMale: [33,15],
			StraightFemale: [17,19],
			GayMale: [2,0],
			GayFemale: [3,1],
			BiMale: [4,0],
			BiFemale: [4,0]
		},
		GA: {
			StraightMale: [12884,4148],
			StraightFemale: [2489,8052],
			GayMale: [778,234],
			GayFemale: [493,154],
			BiMale: [490,12],
			BiFemale: [1460,140]
		},
		FM: {
			StraightMale: [0,1],
			StraightFemale: [0,1],
			GayFemale: [0,1],
			BiFemale: [1,0]
		},
		FL: {
			StraightMale: [26772,8275],
			StraightFemale: [4844,15279],
			GayMale: [1592,487],
			GayFemale: [901,308],
			BiMale: [914,17],
			BiFemale: [3014,345]
		},
		DE: {
			StraightMale: [1247,367],
			StraightFemale: [282,765],
			GayMale: [85,25],
			GayFemale: [49,10],
			BiMale: [48,2],
			BiFemale: [155,10]
		},
		DC: {
			StraightMale: [2206,548],
			StraightFemale: [853,1604],
			GayMale: [327,116],
			GayFemale: [153,22],
			BiMale: [92,2],
			BiFemale: [311,25]
		},
		CT: {
			StraightMale: [5725,1528],
			StraightFemale: [1338,3132],
			GayMale: [300,123],
			GayFemale: [229,63],
			BiMale: [205,2],
			BiFemale: [701,59]
		},
		CO: {
			StraightMale: [10118,2927],
			StraightFemale: [2068,4868],
			GayMale: [470,122],
			GayFemale: [272,75],
			BiMale: [379,8],
			BiFemale: [1171,114]
		},
		CA: {
			StraightMale: [68158,19275],
			StraightFemale: [15182,35559],
			GayMale: [4934,1658],
			GayFemale: [2797,725],
			BiMale: [2508,51],
			BiFemale: [7952,678]
		},
		AZ: {
			StraightMale: [10623,3265],
			StraightFemale: [2046,5651],
			GayMale: [620,182],
			GayFemale: [342,123],
			BiMale: [373,6],
			BiFemale: [1197,115]
		},
		AS: {
			StraightMale: [3,0],
			StraightFemale: [0,1]
		},
		AR: {
			StraightMale: [2711,1037],
			StraightFemale: [617,1947],
			GayMale: [164,37],
			GayFemale: [101,26],
			BiMale: [132,3],
			BiFemale: [384,35]
		},
		AL: {
			StraightMale: [4324,1570],
			StraightFemale: [767,2790],
			GayMale: [252,74],
			GayFemale: [155,44],
			BiMale: [175,6],
			BiFemale: [524,53]
		},
		AK: {
			StraightMale: [1196,315],
			StraightFemale: [353,559],
			GayMale: [37,11],
			GayFemale: [45,7],
			BiMale: [58,1],
			BiFemale: [173,13]
		}

	},
	{
		question: 'Rate your self-confidence:',
		answers: ["Very, very high","Higher than average","Average","Below average"],
		WY: {
			StraightMale: [104,299,317,56],
			StraightFemale: [20,152,239,46],
			GayMale: [0,12,11,3],
			GayFemale: [0,5,10,3],
			BiMale: [3,12,9,2],
			BiFemale: [1,20,31,10]
		},
		WV: {
			StraightMale: [248,835,899,214],
			StraightFemale: [71,469,867,198],
			GayMale: [5,42,58,17],
			GayFemale: [0,21,31,8],
			BiMale: [7,24,22,12],
			BiFemale: [12,53,109,54]
		},
		WI: {
			StraightMale: [1007,4261,4027,811],
			StraightFemale: [234,2044,3438,573],
			GayMale: [31,171,254,72],
			GayFemale: [17,113,191,37],
			BiMale: [31,115,130,21],
			BiFemale: [41,329,473,150]
		},
		WA: {
			StraightMale: [2231,9048,7163,1368],
			StraightFemale: [554,4527,5966,920],
			GayMale: [103,527,551,159],
			GayFemale: [53,339,421,69],
			BiMale: [48,302,243,74],
			BiFemale: [147,864,1123,301]
		},
		VT: {
			StraightMale: [115,491,476,98],
			StraightFemale: [32,253,458,82],
			GayMale: [3,26,34,11],
			GayFemale: [1,15,35,5],
			BiMale: [5,20,26,5],
			BiFemale: [7,77,86,35]
		},
		VI: {
			StraightMale: [6,10,10,0],
			StraightFemale: [1,8,10,0],
			GayMale: [0,0,1,0],
			GayFemale: [0,0,1,0],
			BiFemale: [0,2,0,1]
		},
		VA: {
			StraightMale: [1905,6735,5361,1053],
			StraightFemale: [477,3297,4457,711],
			GayMale: [65,310,396,114],
			GayFemale: [32,177,267,44],
			BiMale: [47,172,124,48],
			BiFemale: [78,449,640,191]
		},
		UT: {
			StraightMale: [493,1803,1491,283],
			StraightFemale: [99,781,1079,177],
			GayMale: [24,95,104,14],
			GayFemale: [8,45,56,15],
			BiMale: [15,45,41,13],
			BiFemale: [23,133,170,51]
		},
		TX: {
			StraightMale: [5053,16367,12190,2190],
			StraightFemale: [1473,8382,11150,1701],
			GayMale: [184,778,1015,207],
			GayFemale: [97,462,657,121],
			BiMale: [106,338,364,102],
			BiFemale: [207,1026,1400,415]
		},
		TN: {
			StraightMale: [1032,3660,3246,660],
			StraightFemale: [316,1884,2899,474],
			GayMale: [41,167,235,70],
			GayFemale: [18,100,175,50],
			BiMale: [32,87,99,33],
			BiFemale: [43,248,371,140]
		},
		SD: {
			StraightMale: [85,369,353,78],
			StraightFemale: [22,175,315,46],
			GayMale: [4,14,13,4],
			GayFemale: [2,4,16,5],
			BiMale: [5,7,12,1],
			BiFemale: [6,24,49,11]
		},
		SC: {
			StraightMale: [610,2190,1850,364],
			StraightFemale: [192,1173,1743,262],
			GayMale: [18,94,121,38],
			GayFemale: [14,61,94,21],
			BiMale: [11,42,49,11],
			BiFemale: [35,127,215,52]
		},
		RI: {
			StraightMale: [228,939,945,163],
			StraightFemale: [80,539,811,150],
			GayMale: [13,74,89,33],
			GayFemale: [9,45,65,11],
			BiMale: [11,18,29,7],
			BiFemale: [10,90,143,42]
		},
		PR: {
			StraightMale: [75,108,82,22],
			StraightFemale: [41,81,82,14],
			GayMale: [5,14,12,1],
			GayFemale: [2,4,1,1],
			BiMale: [1,2,2,1],
			BiFemale: [4,5,10,3]
		},
		PA: {
			StraightMale: [2663,9509,8789,1916],
			StraightFemale: [716,4942,8112,1460],
			GayMale: [90,496,668,178],
			GayFemale: [61,299,471,100],
			BiMale: [57,218,228,79],
			BiFemale: [125,733,1092,383]
		},
		OR: {
			StraightMale: [1209,4956,4133,807],
			StraightFemale: [334,2714,3809,556],
			GayMale: [35,282,323,62],
			GayFemale: [26,278,292,51],
			BiMale: [39,190,161,52],
			BiFemale: [93,629,786,224]
		},
		OK: {
			StraightMale: [927,3159,2591,526],
			StraightFemale: [262,1473,2325,363],
			GayMale: [37,135,167,41],
			GayFemale: [20,52,118,25],
			BiMale: [28,69,82,24],
			BiFemale: [47,176,330,86]
		},
		OH: {
			StraightMale: [2418,8485,7793,1635],
			StraightFemale: [621,4021,7019,1271],
			GayMale: [91,415,550,157],
			GayFemale: [44,241,352,89],
			BiMale: [46,213,233,63],
			BiFemale: [105,528,1016,301]
		},
		NY: {
			StraightMale: [5047,16485,13388,2590],
			StraightFemale: [1678,10624,13557,2115],
			GayMale: [266,1472,1607,333],
			GayFemale: [117,707,863,193],
			BiMale: [108,393,401,129],
			BiFemale: [266,1279,1752,516]
		},
		NV: {
			StraightMale: [710,2194,1533,244],
			StraightFemale: [182,1009,1194,188],
			GayMale: [17,83,96,20],
			GayFemale: [14,57,56,12],
			BiMale: [19,48,53,15],
			BiFemale: [34,153,218,51]
		},
		NM: {
			StraightMale: [384,1272,988,211],
			StraightFemale: [97,700,811,136],
			GayMale: [15,65,85,21],
			GayFemale: [6,49,30,5],
			BiMale: [16,35,40,15],
			BiFemale: [17,123,151,49]
		},
		NJ: {
			StraightMale: [1681,5825,4851,942],
			StraightFemale: [476,3002,4255,638],
			GayMale: [70,302,362,66],
			GayFemale: [25,160,220,49],
			BiMale: [24,112,134,39],
			BiFemale: [65,295,478,159]
		},
		NH: {
			StraightMale: [316,1280,1262,258],
			StraightFemale: [82,663,1184,188],
			GayMale: [11,61,74,23],
			GayFemale: [11,36,68,16],
			BiMale: [14,28,27,10],
			BiFemale: [13,109,175,53]
		},
		NE: {
			StraightMale: [311,1161,1054,222],
			StraightFemale: [54,560,891,139],
			GayMale: [5,36,59,18],
			GayFemale: [5,28,43,10],
			BiMale: [2,30,30,11],
			BiFemale: [15,81,129,32]
		},
		ND: {
			StraightMale: [93,385,435,84],
			StraightFemale: [14,117,330,37],
			GayMale: [1,9,9,3],
			GayFemale: [1,4,15,2],
			BiMale: [4,10,10,2],
			BiFemale: [5,16,35,12]
		},
		NC: {
			StraightMale: [1665,5735,4658,890],
			StraightFemale: [499,3238,4499,674],
			GayMale: [38,281,348,97],
			GayFemale: [32,212,244,67],
			BiMale: [35,138,136,46],
			BiFemale: [68,395,605,204]
		},
		MT: {
			StraightMale: [155,571,501,114],
			StraightFemale: [35,266,464,93],
			GayMale: [4,19,21,1],
			GayFemale: [0,12,28,6],
			BiMale: [5,15,14,5],
			BiFemale: [4,39,65,19]
		},
		MS: {
			StraightMale: [303,867,869,157],
			StraightFemale: [84,487,716,128],
			GayMale: [7,44,58,15],
			GayFemale: [4,20,29,11],
			BiMale: [4,23,21,5],
			BiFemale: [17,52,92,31]
		},
		MO: {
			StraightMale: [1197,4522,3902,787],
			StraightFemale: [372,2397,3649,626],
			GayMale: [39,186,269,71],
			GayFemale: [24,127,204,41],
			BiMale: [38,108,113,46],
			BiFemale: [57,286,518,157]
		},
		MN: {
			StraightMale: [1138,4903,4399,811],
			StraightFemale: [299,2417,3760,547],
			GayMale: [41,224,303,82],
			GayFemale: [23,123,230,44],
			BiMale: [30,110,118,45],
			BiFemale: [55,378,538,156]
		},
		MI: {
			StraightMale: [1974,7629,6894,1398],
			StraightFemale: [531,3886,6558,1140],
			GayMale: [73,324,502,140],
			GayFemale: [33,197,345,72],
			BiMale: [48,208,175,64],
			BiFemale: [86,517,877,289]
		},
		ME: {
			StraightMale: [241,966,994,219],
			StraightFemale: [55,519,1049,202],
			GayMale: [6,45,73,19],
			GayFemale: [5,40,73,21],
			BiMale: [12,23,31,15],
			BiFemale: [14,94,168,60]
		},
		MD: {
			StraightMale: [1371,4876,3873,825],
			StraightFemale: [428,2445,3444,524],
			GayMale: [51,265,314,89],
			GayFemale: [32,161,250,59],
			BiMale: [24,110,103,44],
			BiFemale: [91,356,519,171]
		},
		MA: {
			StraightMale: [2251,8526,6864,1414],
			StraightFemale: [649,5587,7648,1125],
			GayMale: [117,663,726,170],
			GayFemale: [50,444,623,116],
			BiMale: [63,225,227,73],
			BiFemale: [122,823,1093,354]
		},
		LA: {
			StraightMale: [709,2038,1753,331],
			StraightFemale: [207,1029,1627,301],
			GayMale: [27,88,145,38],
			GayFemale: [8,68,99,14],
			BiMale: [13,56,54,15],
			BiFemale: [31,156,232,77]
		},
		KY: {
			StraightMale: [699,2317,2313,540],
			StraightFemale: [186,1182,2050,386],
			GayMale: [30,111,153,41],
			GayFemale: [15,61,96,20],
			BiMale: [23,41,58,20],
			BiFemale: [30,154,321,102]
		},
		KS: {
			StraightMale: [557,2096,1833,437],
			StraightFemale: [114,980,1590,247],
			GayMale: [15,76,99,23],
			GayFemale: [15,40,81,17],
			BiMale: [12,44,52,18],
			BiFemale: [28,149,220,77]
		},
		IN: {
			StraightMale: [1179,4384,4132,850],
			StraightFemale: [315,2272,3757,627],
			GayMale: [46,213,298,75],
			GayFemale: [30,100,204,39],
			BiMale: [19,104,134,36],
			BiFemale: [47,299,564,151]
		},
		IL: {
			StraightMale: [2965,10437,8204,1639],
			StraightFemale: [807,5528,7890,1157],
			GayMale: [109,634,791,183],
			GayFemale: [55,338,419,90],
			BiMale: [58,239,239,78],
			BiFemale: [132,711,970,286]
		},
		ID: {
			StraightMale: [226,1042,860,205],
			StraightFemale: [65,475,746,105],
			GayMale: [10,36,48,14],
			GayFemale: [2,16,25,6],
			BiMale: [11,19,24,6],
			BiFemale: [8,60,96,25]
		},
		IA: {
			StraightMale: [502,1832,1873,379],
			StraightFemale: [109,923,1695,310],
			GayMale: [14,79,101,28],
			GayFemale: [8,39,86,14],
			BiMale: [11,45,40,15],
			BiFemale: [31,138,224,65]
		},
		HI: {
			StraightMale: [210,773,534,107],
			StraightFemale: [57,306,374,70],
			GayMale: [11,35,40,17],
			GayFemale: [2,18,20,2],
			BiMale: [4,16,17,4],
			BiFemale: [6,41,47,17]
		},
		GU: {
			StraightMale: [7,17,13,1],
			StraightFemale: [5,6,18,2],
			GayMale: [0,0,2,0],
			GayFemale: [1,1,2,0],
			BiMale: [0,0,0,1],
			BiFemale: [0,1,1,0]
		},
		GA: {
			StraightMale: [1996,6607,5192,969],
			StraightFemale: [629,3547,4753,674],
			GayMale: [71,348,361,105],
			GayFemale: [40,195,270,67],
			BiMale: [52,163,146,43],
			BiFemale: [105,439,614,147]
		},
		FM: {
			StraightMale: [0,1,0,0],
			BiFemale: [0,1,0,0]
		},
		FL: {
			StraightMale: [4616,13303,10068,1817],
			StraightFemale: [1296,6857,8748,1275],
			GayMale: [165,655,799,174],
			GayFemale: [79,376,498,103],
			BiMale: [119,275,279,78],
			BiFemale: [222,965,1256,358]
		},
		DE: {
			StraightMale: [175,585,522,104],
			StraightFemale: [58,329,475,71],
			GayMale: [7,35,46,4],
			GayFemale: [5,18,23,6],
			BiMale: [4,13,18,5],
			BiFemale: [7,44,67,19]
		},
		DC: {
			StraightMale: [358,1230,639,109],
			StraightFemale: [149,1096,882,121],
			GayMale: [41,171,154,35],
			GayFemale: [12,66,68,12],
			BiMale: [8,45,17,5],
			BiFemale: [19,119,109,22]
		},
		CT: {
			StraightMale: [746,2676,2357,478],
			StraightFemale: [219,1391,2134,355],
			GayMale: [29,123,186,41],
			GayFemale: [18,76,148,28],
			BiMale: [12,71,64,26],
			BiFemale: [28,179,298,102]
		},
		CO: {
			StraightMale: [1422,5348,3906,672],
			StraightFemale: [347,2580,2995,424],
			GayMale: [49,205,224,52],
			GayFemale: [22,124,144,19],
			BiMale: [37,134,118,38],
			BiFemale: [56,432,501,113]
		},
		CA: {
			StraightMale: [10028,34717,24213,4361],
			StraightFemale: [2659,18848,20831,2791],
			GayMale: [429,2385,2424,515],
			GayFemale: [220,1390,1460,227],
			BiMale: [243,877,704,201],
			BiFemale: [475,2752,3136,742]
		},
		AZ: {
			StraightMale: [1683,5427,4096,759],
			StraightFemale: [448,2717,3459,504],
			GayMale: [49,268,295,64],
			GayFemale: [36,151,201,44],
			BiMale: [34,113,122,36],
			BiFemale: [70,373,504,151]
		},
		AS: {
			StraightMale: [0,1,1,1],
			StraightFemale: [0,0,1,0]
		},
		AR: {
			StraightMale: [427,1274,1215,288],
			StraightFemale: [135,658,1210,238],
			GayMale: [14,59,74,27],
			GayFemale: [3,31,69,11],
			BiMale: [6,40,43,13],
			BiFemale: [22,111,154,55]
		},
		AL: {
			StraightMale: [673,2125,1910,413],
			StraightFemale: [184,1021,1704,296],
			GayMale: [22,100,120,33],
			GayFemale: [10,47,89,22],
			BiMale: [16,60,62,16],
			BiFemale: [28,118,240,71]
		},
		AK: {
			StraightMale: [164,554,468,86],
			StraightFemale: [38,306,385,75],
			GayMale: [3,14,24,2],
			GayFemale: [4,14,25,5],
			BiMale: [2,22,15,6],
			BiFemale: [14,39,75,22]
		}

	},
	{
		question: 'Is your ideal sex rough or gentle?',
		answers: ["Rough","Gentle","I enjoy both equally","I'm a virgin"],
		WY: {
			StraightMale: [14,107,405,43],
			StraightFemale: [18,53,236,28],
			GayMale: [1,1,12,1],
			GayFemale: [0,4,10,0],
			BiMale: [0,1,14,2],
			BiFemale: [6,2,33,2]
		},
		WV: {
			StraightMale: [61,279,1074,145],
			StraightFemale: [63,200,736,129],
			GayMale: [3,16,53,13],
			GayFemale: [4,5,35,1],
			BiMale: [2,7,36,7],
			BiFemale: [26,14,117,18]
		},
		WI: {
			StraightMale: [280,1282,5041,817],
			StraightFemale: [259,718,3212,542],
			GayMale: [23,61,250,48],
			GayFemale: [18,39,173,37],
			BiMale: [15,29,136,34],
			BiFemale: [106,56,570,62]
		},
		WA: {
			StraightMale: [634,2362,10914,1323],
			StraightFemale: [604,1251,6191,863],
			GayMale: [57,205,676,95],
			GayFemale: [50,108,490,41],
			BiMale: [50,87,368,30],
			BiFemale: [289,130,1513,100]
		},
		VT: {
			StraightMale: [28,177,614,82],
			StraightFemale: [38,116,434,60],
			GayMale: [3,15,31,7],
			GayFemale: [2,13,28,5],
			BiMale: [3,9,32,2],
			BiFemale: [31,16,120,9]
		},
		VI: {
			StraightMale: [0,3,17,0],
			StraightFemale: [3,2,10,1],
			GayMale: [0,0,1,0],
			BiFemale: [1,0,1,0]
		},
		VA: {
			StraightMale: [412,1684,7702,1112],
			StraightFemale: [407,855,4270,691],
			GayMale: [40,113,424,78],
			GayFemale: [27,47,273,26],
			BiMale: [35,36,195,17],
			BiFemale: [148,69,758,78]
		},
		UT: {
			StraightMale: [89,420,1955,420],
			StraightFemale: [84,193,1020,235],
			GayMale: [6,31,113,32],
			GayFemale: [5,17,53,7],
			BiMale: [4,12,53,5],
			BiFemale: [34,16,223,18]
		},
		TX: {
			StraightMale: [1007,3873,18607,2464],
			StraightFemale: [1074,2291,11215,1592],
			GayMale: [75,255,1050,174],
			GayFemale: [73,125,651,79],
			BiMale: [41,96,451,60],
			BiFemale: [328,119,1721,145]
		},
		TN: {
			StraightMale: [231,1019,4225,654],
			StraightFemale: [264,656,2701,412],
			GayMale: [12,74,235,50],
			GayFemale: [20,37,150,25],
			BiMale: [12,29,120,20],
			BiFemale: [83,44,434,41]
		},
		SD: {
			StraightMale: [18,109,422,77],
			StraightFemale: [22,82,240,55],
			GayMale: [2,3,16,4],
			GayFemale: [1,4,9,3],
			BiMale: [0,1,13,2],
			BiFemale: [8,4,48,1]
		},
		SC: {
			StraightMale: [140,578,2544,357],
			StraightFemale: [157,394,1625,242],
			GayMale: [6,36,110,22],
			GayFemale: [8,21,109,5],
			BiMale: [4,15,52,11],
			BiFemale: [46,16,272,21]
		},
		RI: {
			StraightMale: [77,278,1191,140],
			StraightFemale: [68,144,814,116],
			GayMale: [9,34,91,25],
			GayFemale: [3,23,69,6],
			BiMale: [7,5,33,3],
			BiFemale: [39,11,160,18]
		},
		PR: {
			StraightMale: [6,33,112,24],
			StraightFemale: [10,28,74,26],
			GayMale: [1,7,15,2],
			GayFemale: [0,1,2,1],
			BiMale: [0,0,3,0],
			BiFemale: [0,0,13,3]
		},
		PA: {
			StraightMale: [728,2579,11707,1681],
			StraightFemale: [807,1507,7514,1183],
			GayMale: [58,168,675,126],
			GayFemale: [51,98,485,56],
			BiMale: [42,54,318,32],
			BiFemale: [234,120,1322,127]
		},
		OR: {
			StraightMale: [338,1500,6041,707],
			StraightFemale: [372,786,3843,472],
			GayMale: [35,94,383,43],
			GayFemale: [37,78,346,27],
			BiMale: [33,43,256,24],
			BiFemale: [189,99,1094,55]
		},
		OK: {
			StraightMale: [174,955,3510,471],
			StraightFemale: [156,578,2108,287],
			GayMale: [11,61,165,24],
			GayFemale: [11,36,109,11],
			BiMale: [9,17,94,11],
			BiFemale: [53,38,364,23]
		},
		OH: {
			StraightMale: [513,2337,10433,1577],
			StraightFemale: [612,1346,6297,1055],
			GayMale: [46,146,541,116],
			GayFemale: [32,63,380,53],
			BiMale: [25,45,310,39],
			BiFemale: [227,73,1072,129]
		},
		NY: {
			StraightMale: [1448,3894,19774,2317],
			StraightFemale: [1443,2457,13497,1922],
			GayMale: [172,415,1843,220],
			GayFemale: [97,175,963,96],
			BiMale: [62,95,499,99],
			BiFemale: [426,201,2090,223]
		},
		NV: {
			StraightMale: [129,556,2519,249],
			StraightFemale: [127,250,1333,140],
			GayMale: [7,28,95,11],
			GayFemale: [5,13,76,4],
			BiMale: [6,11,68,7],
			BiFemale: [49,13,283,23]
		},
		NM: {
			StraightMale: [85,349,1527,189],
			StraightFemale: [82,176,834,112],
			GayMale: [11,20,95,13],
			GayFemale: [1,14,49,5],
			BiMale: [1,7,68,6],
			BiFemale: [33,19,205,14]
		},
		NJ: {
			StraightMale: [439,1353,6968,930],
			StraightFemale: [401,835,4029,614],
			GayMale: [28,104,353,68],
			GayFemale: [18,47,232,23],
			BiMale: [22,30,135,22],
			BiFemale: [117,53,548,61]
		},
		NH: {
			StraightMale: [71,415,1654,216],
			StraightFemale: [86,234,1067,145],
			GayMale: [9,36,61,15],
			GayFemale: [4,15,50,6],
			BiMale: [2,8,46,5],
			BiFemale: [33,20,200,16]
		},
		NE: {
			StraightMale: [52,370,1337,248],
			StraightFemale: [56,162,785,156],
			GayMale: [3,17,45,17],
			GayFemale: [2,11,41,8],
			BiMale: [4,12,35,5],
			BiFemale: [22,13,153,15]
		},
		ND: {
			StraightMale: [31,118,476,96],
			StraightFemale: [20,51,225,48],
			GayMale: [0,2,10,1],
			GayFemale: [0,2,8,5],
			BiMale: [3,4,9,0],
			BiFemale: [7,5,35,4]
		},
		NC: {
			StraightMale: [358,1424,6674,824],
			StraightFemale: [410,957,4324,583],
			GayMale: [32,105,337,54],
			GayFemale: [39,58,256,29],
			BiMale: [24,28,183,32],
			BiFemale: [143,64,720,66]
		},
		MT: {
			StraightMale: [29,201,650,78],
			StraightFemale: [40,102,386,62],
			GayMale: [0,8,20,2],
			GayFemale: [1,7,23,3],
			BiMale: [1,6,18,1],
			BiFemale: [23,4,63,4]
		},
		MS: {
			StraightMale: [47,268,1080,138],
			StraightFemale: [43,170,673,105],
			GayMale: [7,17,41,12],
			GayFemale: [2,7,35,1],
			BiMale: [4,6,18,6],
			BiFemale: [22,9,108,6]
		},
		MO: {
			StraightMale: [275,1280,5365,740],
			StraightFemale: [319,786,3418,546],
			GayMale: [28,77,279,55],
			GayFemale: [13,37,224,19],
			BiMale: [18,33,143,22],
			BiFemale: [122,44,598,47]
		},
		MN: {
			StraightMale: [311,1390,5691,871],
			StraightFemale: [305,778,3379,672],
			GayMale: [31,102,279,50],
			GayFemale: [25,41,237,34],
			BiMale: [17,48,135,25],
			BiFemale: [132,63,673,63]
		},
		MI: {
			StraightMale: [469,2016,9059,1408],
			StraightFemale: [577,1174,5866,1099],
			GayMale: [50,127,449,126],
			GayFemale: [31,66,330,35],
			BiMale: [39,40,237,45],
			BiFemale: [181,81,1041,84]
		},
		ME: {
			StraightMale: [54,342,1154,171],
			StraightFemale: [82,215,861,135],
			GayMale: [4,21,54,13],
			GayFemale: [8,16,64,11],
			BiMale: [3,10,40,8],
			BiFemale: [32,27,202,16]
		},
		MD: {
			StraightMale: [325,1271,5716,824],
			StraightFemale: [348,620,3355,546],
			GayMale: [33,101,340,55],
			GayFemale: [33,59,256,25],
			BiMale: [14,27,143,19],
			BiFemale: [146,51,633,78]
		},
		MA: {
			StraightMale: [740,2158,10314,1125],
			StraightFemale: [761,1487,7317,1086],
			GayMale: [79,220,803,129],
			GayFemale: [70,119,634,64],
			BiMale: [42,68,326,44],
			BiFemale: [290,127,1427,139]
		},
		LA: {
			StraightMale: [137,503,2476,328],
			StraightFemale: [154,335,1600,220],
			GayMale: [13,33,150,23],
			GayFemale: [9,22,88,10],
			BiMale: [8,10,70,5],
			BiFemale: [53,14,301,25]
		},
		KY: {
			StraightMale: [150,679,2829,441],
			StraightFemale: [148,398,1746,311],
			GayMale: [12,46,146,34],
			GayFemale: [5,17,83,15],
			BiMale: [4,12,72,12],
			BiFemale: [52,16,361,29]
		},
		KS: {
			StraightMale: [132,617,2427,385],
			StraightFemale: [153,336,1435,227],
			GayMale: [8,31,88,17],
			GayFemale: [4,20,83,16],
			BiMale: [11,11,62,14],
			BiFemale: [45,17,278,21]
		},
		IN: {
			StraightMale: [252,1261,5270,773],
			StraightFemale: [330,735,3422,536],
			GayMale: [22,75,302,51],
			GayFemale: [13,47,172,16],
			BiMale: [21,39,132,25],
			BiFemale: [105,45,593,63]
		},
		IL: {
			StraightMale: [728,2372,12153,1790],
			StraightFemale: [802,1495,7620,1288],
			GayMale: [67,179,853,127],
			GayFemale: [49,94,492,47],
			BiMale: [33,53,336,43],
			BiFemale: [254,79,1198,137]
		},
		ID: {
			StraightMale: [50,310,1095,168],
			StraightFemale: [71,151,667,82],
			GayMale: [4,14,48,5],
			GayFemale: [3,3,32,2],
			BiMale: [1,6,22,4],
			BiFemale: [21,10,107,6]
		},
		IA: {
			StraightMale: [103,565,2243,398],
			StraightFemale: [137,340,1459,257],
			GayMale: [5,27,104,22],
			GayFemale: [6,15,64,13],
			BiMale: [6,10,64,8],
			BiFemale: [38,25,275,26]
		},
		HI: {
			StraightMale: [29,175,828,126],
			StraightFemale: [31,85,404,60],
			GayMale: [2,12,46,15],
			GayFemale: [2,2,24,2],
			BiMale: [1,5,22,4],
			BiFemale: [8,6,65,6]
		},
		GU: {
			StraightMale: [0,3,12,3],
			StraightFemale: [2,2,14,2],
			GayMale: [0,0,1,0],
			GayFemale: [0,0,3,0],
			BiMale: [0,0,1,0],
			BiFemale: [0,0,2,0]
		},
		GA: {
			StraightMale: [456,1511,7639,963],
			StraightFemale: [445,995,4707,751],
			GayMale: [34,125,408,75],
			GayFemale: [26,61,301,31],
			BiMale: [28,43,179,18],
			BiFemale: [150,48,727,61]
		},
		FM: {
			StraightMale: [0,0,1,0],
			StraightFemale: [0,0,1,0]
		},
		FL: {
			StraightMale: [815,3325,15215,1802],
			StraightFemale: [839,1943,8869,1176],
			GayMale: [59,215,807,133],
			GayFemale: [42,115,539,67],
			BiMale: [42,79,343,49],
			BiFemale: [314,108,1522,139]
		},
		DE: {
			StraightMale: [34,167,700,81],
			StraightFemale: [50,96,478,42],
			GayMale: [8,13,41,6],
			GayFemale: [4,3,31,1],
			BiMale: [1,2,23,3],
			BiFemale: [14,4,82,6]
		},
		DC: {
			StraightMale: [96,228,1298,113],
			StraightFemale: [84,210,1059,181],
			GayMale: [14,49,198,20],
			GayFemale: [12,14,90,5],
			BiMale: [5,8,40,2],
			BiFemale: [21,13,176,14]
		},
		CT: {
			StraightMale: [189,693,3154,430],
			StraightFemale: [202,419,1957,314],
			GayMale: [12,46,188,38],
			GayFemale: [18,40,132,18],
			BiMale: [9,20,73,7],
			BiFemale: [63,34,344,39]
		},
		CO: {
			StraightMale: [306,1458,5989,740],
			StraightFemale: [301,679,3249,401],
			GayMale: [26,82,253,34],
			GayFemale: [12,40,162,13],
			BiMale: [19,32,166,22],
			BiFemale: [114,62,660,48]
		},
		CA: {
			StraightMale: [2329,7750,39729,5092],
			StraightFemale: [2395,4183,23087,3309],
			GayMale: [237,700,2924,447],
			GayFemale: [203,321,1749,167],
			BiMale: [130,187,1115,152],
			BiFemale: [873,320,4094,392]
		},
		AZ: {
			StraightMale: [350,1428,6431,782],
			StraightFemale: [368,755,3611,436],
			GayMale: [23,103,303,37],
			GayFemale: [28,59,214,19],
			BiMale: [15,23,155,23],
			BiFemale: [115,51,628,46]
		},
		AS: {
			StraightMale: [0,0,1,2]
		},
		AR: {
			StraightMale: [73,430,1524,241],
			StraightFemale: [89,272,1042,159],
			GayMale: [7,29,53,17],
			GayFemale: [3,9,60,3],
			BiMale: [4,11,48,6],
			BiFemale: [38,14,182,14]
		},
		AL: {
			StraightMale: [136,571,2509,355],
			StraightFemale: [143,357,1562,267],
			GayMale: [6,30,121,19],
			GayFemale: [10,23,75,7],
			BiMale: [4,16,77,7],
			BiFemale: [47,9,258,26]
		},
		AK: {
			StraightMale: [37,167,639,81],
			StraightFemale: [46,84,420,62],
			GayMale: [1,4,11,4],
			GayFemale: [5,5,20,3],
			BiMale: [2,6,27,1],
			BiFemale: [11,8,81,13]
		}

	},
	{
		question: 'Ideally, how often would you have sex?',
		answers: ["Every day","3 to 4 times per week","1 to 2 times per week","less than once per week"],
		WY: {
			StraightMale: [373,438,128,31],
			StraightFemale: [195,271,90,21],
			GayMale: [11,14,10,0],
			GayFemale: [3,9,9,2],
			BiMale: [15,10,4,4],
			BiFemale: [42,29,5,1]
		},
		WV: {
			StraightMale: [1301,1121,319,101],
			StraightFemale: [703,892,280,99],
			GayMale: [59,65,28,10],
			GayFemale: [26,44,17,4],
			BiMale: [44,32,10,3],
			BiFemale: [154,95,30,9]
		},
		WI: {
			StraightMale: [5194,5628,1872,394],
			StraightFemale: [2500,3720,1325,297],
			GayMale: [202,316,137,29],
			GayFemale: [125,221,76,25],
			BiMale: [146,139,71,22],
			BiFemale: [503,505,155,44]
		},
		WA: {
			StraightMale: [11362,11009,2517,574],
			StraightFemale: [5304,6997,1937,473],
			GayMale: [527,874,251,53],
			GayFemale: [329,573,181,43],
			BiMale: [385,315,91,25],
			BiFemale: [1313,1337,335,88]
		},
		VT: {
			StraightMale: [733,665,162,28],
			StraightFemale: [379,479,174,27],
			GayMale: [44,45,19,3],
			GayFemale: [28,37,19,2],
			BiMale: [40,29,9,2],
			BiFemale: [122,106,28,3]
		},
		VI: {
			StraightMale: [12,13,7,1],
			StraightFemale: [7,10,2,2],
			GayMale: [0,1,0,0],
			BiMale: [0,1,0,0],
			BiFemale: [2,1,0,1]
		},
		VA: {
			StraightMale: [8344,8689,2266,490],
			StraightFemale: [3774,5385,1515,405],
			GayMale: [345,531,200,47],
			GayFemale: [221,331,120,24],
			BiMale: [230,212,56,26],
			BiFemale: [763,744,195,68]
		},
		UT: {
			StraightMale: [2340,2235,564,168],
			StraightFemale: [944,1206,326,103],
			GayMale: [104,141,38,14],
			GayFemale: [49,80,28,14],
			BiMale: [65,43,17,7],
			BiFemale: [190,203,64,18]
		},
		TX: {
			StraightMale: [20354,20292,5348,1452],
			StraightFemale: [10088,13343,3837,1057],
			GayMale: [909,1411,495,116],
			GayFemale: [548,893,275,54],
			BiMale: [494,503,154,53],
			BiFemale: [1795,1602,455,134]
		},
		TN: {
			StraightMale: [4663,4761,1359,379],
			StraightFemale: [2519,3134,931,272],
			GayMale: [207,311,135,38],
			GayFemale: [122,198,93,16],
			BiMale: [170,121,43,11],
			BiFemale: [494,417,130,22]
		},
		SD: {
			StraightMale: [460,471,187,55],
			StraightFemale: [264,306,98,44],
			GayMale: [19,16,9,3],
			GayFemale: [14,11,6,1],
			BiMale: [10,13,6,0],
			BiFemale: [60,41,11,6]
		},
		SC: {
			StraightMale: [2855,2953,803,195],
			StraightFemale: [1525,2048,546,179],
			GayMale: [111,170,61,11],
			GayFemale: [93,107,54,12],
			BiMale: [74,68,15,5],
			BiFemale: [243,239,73,15]
		},
		RI: {
			StraightMale: [1222,1328,384,86],
			StraightFemale: [688,966,289,63],
			GayMale: [81,135,54,14],
			GayFemale: [53,81,27,3],
			BiMale: [39,31,15,5],
			BiFemale: [146,157,44,17]
		},
		PR: {
			StraightMale: [172,152,45,17],
			StraightFemale: [113,128,37,18],
			GayMale: [18,20,5,2],
			GayFemale: [4,7,0,0],
			BiMale: [6,1,4,1],
			BiFemale: [15,10,3,3]
		},
		PA: {
			StraightMale: [12021,13010,3981,951],
			StraightFemale: [6407,9054,2859,702],
			GayMale: [575,901,319,87],
			GayFemale: [379,604,229,37],
			BiMale: [320,329,102,31],
			BiFemale: [1247,1207,394,121]
		},
		OR: {
			StraightMale: [6570,6237,1439,260],
			StraightFemale: [3280,4437,1171,249],
			GayMale: [305,481,129,25],
			GayFemale: [268,433,136,16],
			BiMale: [275,229,55,18],
			BiFemale: [922,954,201,49]
		},
		OK: {
			StraightMale: [4033,3928,1109,264],
			StraightFemale: [2008,2383,760,204],
			GayMale: [166,198,80,17],
			GayFemale: [97,126,51,12],
			BiMale: [133,90,34,9],
			BiFemale: [447,270,87,38]
		},
		OH: {
			StraightMale: [10818,11409,3514,833],
			StraightFemale: [5291,7359,2400,648],
			GayMale: [496,706,302,64],
			GayFemale: [311,461,153,30],
			BiMale: [320,284,95,25],
			BiFemale: [1080,1030,305,87]
		},
		NY: {
			StraightMale: [22580,21922,5552,1361],
			StraightFemale: [13264,18043,4483,1144],
			GayMale: [1748,2499,675,136],
			GayFemale: [854,1340,406,63],
			BiMale: [569,554,177,60],
			BiFemale: [2224,2064,534,171]
		},
		NV: {
			StraightMale: [2851,2616,661,131],
			StraightFemale: [1246,1501,420,126],
			GayMale: [102,141,46,11],
			GayFemale: [63,93,28,8],
			BiMale: [88,70,17,5],
			BiFemale: [278,232,70,32]
		},
		NM: {
			StraightMale: [1500,1578,483,106],
			StraightFemale: [764,1006,280,82],
			GayMale: [74,108,51,5],
			GayFemale: [41,65,23,2],
			BiMale: [58,44,21,6],
			BiFemale: [179,166,41,16]
		},
		NJ: {
			StraightMale: [7233,7684,2222,524],
			StraightFemale: [3551,5260,1547,374],
			GayMale: [303,489,176,39],
			GayFemale: [176,332,103,17],
			BiMale: [182,182,47,14],
			BiFemale: [523,555,182,56]
		},
		NH: {
			StraightMale: [1708,1779,471,88],
			StraightFemale: [960,1224,358,81],
			GayMale: [59,111,38,10],
			GayFemale: [42,83,32,3],
			BiMale: [50,40,17,4],
			BiFemale: [207,170,63,16]
		},
		NE: {
			StraightMale: [1354,1542,523,133],
			StraightFemale: [637,899,344,73],
			GayMale: [39,60,45,10],
			GayFemale: [27,44,28,4],
			BiMale: [47,31,13,5],
			BiFemale: [141,129,36,16]
		},
		ND: {
			StraightMale: [493,530,184,49],
			StraightFemale: [198,293,86,37],
			GayMale: [13,14,6,1],
			GayFemale: [7,11,5,2],
			BiMale: [9,20,2,2],
			BiFemale: [32,37,9,2]
		},
		NC: {
			StraightMale: [7354,7518,2075,518],
			StraightFemale: [3925,5309,1582,387],
			GayMale: [353,472,162,39],
			GayFemale: [211,358,139,27],
			BiMale: [197,171,69,21],
			BiFemale: [752,677,185,48]
		},
		MT: {
			StraightMale: [768,712,212,43],
			StraightFemale: [381,441,149,37],
			GayMale: [25,33,8,2],
			GayFemale: [20,23,10,3],
			BiMale: [25,13,3,1],
			BiFemale: [76,64,19,2]
		},
		MS: {
			StraightMale: [1224,1172,376,99],
			StraightFemale: [624,799,290,72],
			GayMale: [63,67,21,10],
			GayFemale: [28,48,15,1],
			BiMale: [29,29,13,0],
			BiFemale: [118,112,27,14]
		},
		MP: {
			StraightMale: [0,2,0,0]
		},
		MO: {
			StraightMale: [5626,5795,1613,390],
			StraightFemale: [3108,4009,1247,314],
			GayMale: [247,345,116,35],
			GayFemale: [168,231,88,24],
			BiMale: [181,146,56,12],
			BiFemale: [609,510,161,39]
		},
		MN: {
			StraightMale: [5568,6466,1890,411],
			StraightFemale: [2758,4182,1340,300],
			GayMale: [261,395,143,26],
			GayFemale: [158,248,117,21],
			BiMale: [150,158,53,14],
			BiFemale: [551,612,189,42]
		},
		MI: {
			StraightMale: [9628,9801,2891,731],
			StraightFemale: [5132,6822,2109,595],
			GayMale: [420,636,237,64],
			GayFemale: [246,408,155,24],
			BiMale: [290,259,83,34],
			BiFemale: [955,944,248,86]
		},
		ME: {
			StraightMale: [1338,1367,351,72],
			StraightFemale: [890,1030,277,61],
			GayMale: [79,86,28,4],
			GayFemale: [51,95,32,5],
			BiMale: [57,31,13,0],
			BiFemale: [176,165,68,13]
		},
		MD: {
			StraightMale: [5971,6236,1732,345],
			StraightFemale: [2919,4124,1188,259],
			GayMale: [272,434,162,33],
			GayFemale: [179,331,117,30],
			BiMale: [156,143,59,21],
			BiFemale: [615,569,202,42]
		},
		MA: {
			StraightMale: [10766,10998,2790,538],
			StraightFemale: [6234,9547,2491,502],
			GayMale: [663,1122,374,68],
			GayFemale: [458,825,311,42],
			BiMale: [338,297,102,18],
			BiFemale: [1290,1325,341,87]
		},
		LA: {
			StraightMale: [2786,2612,716,220],
			StraightFemale: [1444,1835,510,161],
			GayMale: [130,191,65,12],
			GayFemale: [92,114,40,16],
			BiMale: [79,60,29,9],
			BiFemale: [293,250,62,16]
		},
		KY: {
			StraightMale: [2990,3245,968,279],
			StraightFemale: [1653,2181,677,211],
			GayMale: [152,195,87,14],
			GayFemale: [74,106,41,16],
			BiMale: [90,65,29,13],
			BiFemale: [330,307,95,22]
		},
		KS: {
			StraightMale: [2568,2672,843,204],
			StraightFemale: [1220,1709,531,126],
			GayMale: [78,144,50,12],
			GayFemale: [60,82,40,12],
			BiMale: [70,64,27,7],
			BiFemale: [268,245,78,22]
		},
		IN: {
			StraightMale: [5629,5815,1762,456],
			StraightFemale: [2911,3953,1242,314],
			GayMale: [287,359,126,26],
			GayFemale: [149,227,85,13],
			BiMale: [166,154,51,13],
			BiFemale: [617,508,163,50]
		},
		IL: {
			StraightMale: [12603,13256,3800,925],
			StraightFemale: [6404,9420,2744,672],
			GayMale: [638,1164,374,79],
			GayFemale: [378,577,206,49],
			BiMale: [327,326,118,38],
			BiFemale: [1218,1140,318,92]
		},
		ID: {
			StraightMale: [1259,1289,367,82],
			StraightFemale: [668,779,225,55],
			GayMale: [52,61,18,5],
			GayFemale: [17,36,9,2],
			BiMale: [38,33,8,2],
			BiFemale: [109,92,27,10]
		},
		IA: {
			StraightMale: [2262,2613,907,190],
			StraightFemale: [1191,1711,660,155],
			GayMale: [83,155,49,10],
			GayFemale: [54,72,35,8],
			BiMale: [69,56,21,4],
			BiFemale: [255,203,89,25]
		},
		HI: {
			StraightMale: [965,884,248,73],
			StraightFemale: [387,449,144,50],
			GayMale: [40,56,19,10],
			GayFemale: [17,27,10,3],
			BiMale: [23,22,6,5],
			BiFemale: [58,60,23,6]
		},
		GU: {
			StraightMale: [15,23,8,2],
			StraightFemale: [24,10,4,5],
			GayMale: [0,2,1,1],
			GayFemale: [0,3,1,0],
			BiMale: [1,0,1,0],
			BiFemale: [0,1,1,0]
		},
		GA: {
			StraightMale: [8260,8378,2227,577],
			StraightFemale: [4336,5644,1637,469],
			GayMale: [383,514,185,33],
			GayFemale: [240,364,139,34],
			BiMale: [251,203,61,28],
			BiFemale: [784,680,206,69]
		},
		FM: {
			StraightMale: [0,2,0,0],
			StraightFemale: [0,0,0,0],
			GayFemale: [0,0,1,0],
			BiFemale: [1,0,0,0]
		},
		FL: {
			StraightMale: [17976,16729,4209,1033],
			StraightFemale: [8773,10706,2941,744],
			GayMale: [817,1063,403,89],
			GayFemale: [498,634,245,54],
			BiMale: [463,375,108,47],
			BiFemale: [1696,1465,390,114]
		},
		DE: {
			StraightMale: [701,786,227,56],
			StraightFemale: [450,534,154,33],
			GayMale: [44,49,25,7],
			GayFemale: [29,24,16,1],
			BiMale: [24,19,6,2],
			BiFemale: [74,74,29,7]
		},
		DC: {
			StraightMale: [1476,1386,263,36],
			StraightFemale: [1052,1543,328,67],
			GayMale: [182,256,88,12],
			GayFemale: [65,124,36,8],
			BiMale: [60,31,13,2],
			BiFemale: [159,151,28,10]
		},
		CT: {
			StraightMale: [3345,3624,1029,215],
			StraightFemale: [1783,2341,770,183],
			GayMale: [150,250,93,22],
			GayFemale: [99,189,49,12],
			BiMale: [96,83,32,3],
			BiFemale: [325,336,93,20]
		},
		CO: {
			StraightMale: [6215,6433,1568,319],
			StraightFemale: [2797,3791,1086,226],
			GayMale: [232,316,92,25],
			GayFemale: [133,188,87,14],
			BiMale: [187,165,58,8],
			BiFemale: [573,596,174,43]
		},
		CA: {
			StraightMale: [44052,41965,9724,2564],
			StraightFemale: [21274,27495,7173,1922],
			GayMale: [2429,3843,1132,288],
			GayFemale: [1392,2221,751,143],
			BiMale: [1179,1059,334,97],
			BiFemale: [4068,3729,1040,281]
		},
		AZ: {
			StraightMale: [7033,6490,1723,394],
			StraightFemale: [3328,4068,1101,298],
			GayMale: [303,444,139,33],
			GayFemale: [189,255,111,18],
			BiMale: [183,155,58,11],
			BiFemale: [658,550,141,48]
		},
		AS: {
			StraightMale: [1,1,0,0],
			StraightFemale: [1,0,0,0]
		},
		AR: {
			StraightMale: [1874,1676,521,129],
			StraightFemale: [1003,1266,396,118],
			GayMale: [79,100,37,5],
			GayFemale: [67,63,30,6],
			BiMale: [71,45,18,3],
			BiFemale: [209,148,46,10]
		},
		AL: {
			StraightMale: [2716,2860,858,213],
			StraightFemale: [1455,1860,563,178],
			GayMale: [141,150,58,16],
			GayFemale: [64,102,53,11],
			BiMale: [97,65,33,15],
			BiFemale: [289,238,52,26]
		},
		AK: {
			StraightMale: [802,653,162,35],
			StraightFemale: [406,444,121,39],
			GayMale: [15,25,10,1],
			GayFemale: [24,26,11,2],
			BiMale: [32,14,5,2],
			BiFemale: [84,69,25,13]
		}

	},
	{
		question: 'Do you put more weight in science or faith?',
		answers: ["Science","Faith","Equally in both"],
		WY: {
			StraightMale: [216,99,193],
			StraightFemale: [81,93,122],
			GayMale: [3,1,9],
			GayFemale: [6,2,5],
			BiMale: [6,1,6],
			BiFemale: [10,10,20]
		},
		WV: {
			StraightMale: [554,317,506],
			StraightFemale: [215,387,385],
			GayMale: [21,21,36],
			GayFemale: [17,11,15],
			BiMale: [19,5,20],
			BiFemale: [54,36,60]
		},
		WI: {
			StraightMale: [3377,1046,2286],
			StraightFemale: [1381,1101,1652],
			GayMale: [197,36,116],
			GayFemale: [135,32,68],
			BiMale: [108,24,60],
			BiFemale: [331,88,271]
		},
		WA: {
			StraightMale: [8087,1611,4308],
			StraightFemale: [3155,1697,3077],
			GayMale: [554,80,343],
			GayFemale: [286,69,244],
			BiMale: [290,38,172],
			BiFemale: [936,163,649]
		},
		VT: {
			StraightMale: [457,62,285],
			StraightFemale: [221,92,219],
			GayMale: [26,6,23],
			GayFemale: [23,3,13],
			BiMale: [18,4,16],
			BiFemale: [83,17,44]
		},
		VI: {
			StraightMale: [9,2,7],
			StraightFemale: [4,6,5],
			BiFemale: [0,0,2]
		},
		VA: {
			StraightMale: [5071,1493,3346],
			StraightFemale: [1901,1488,2174],
			GayMale: [307,78,232],
			GayFemale: [159,55,103],
			BiMale: [146,25,82],
			BiFemale: [444,114,352]
		},
		UT: {
			StraightMale: [1196,459,982],
			StraightFemale: [377,381,608],
			GayMale: [69,25,74],
			GayFemale: [34,8,29],
			BiMale: [30,9,31],
			BiFemale: [122,26,104]
		},
		TX: {
			StraightMale: [10561,4561,8273],
			StraightFemale: [4007,4996,5403],
			GayMale: [659,218,570],
			GayFemale: [311,155,306],
			BiMale: [290,84,203],
			BiFemale: [867,314,761]
		},
		TN: {
			StraightMale: [2006,1420,2059],
			StraightFemale: [730,1473,1348],
			GayMale: [136,65,140],
			GayFemale: [80,37,83],
			BiMale: [67,33,68],
			BiFemale: [209,98,207]
		},
		SD: {
			StraightMale: [204,114,232],
			StraightFemale: [85,120,142],
			GayMale: [10,7,7],
			GayFemale: [11,4,4],
			BiMale: [4,4,5],
			BiFemale: [18,11,22]
		},
		SC: {
			StraightMale: [1250,774,1206],
			StraightFemale: [461,863,821],
			GayMale: [73,33,58],
			GayFemale: [56,21,43],
			BiMale: [44,11,20],
			BiFemale: [122,52,118]
		},
		RI: {
			StraightMale: [841,165,524],
			StraightFemale: [386,183,417],
			GayMale: [78,8,51],
			GayFemale: [42,8,34],
			BiMale: [22,3,14],
			BiFemale: [94,20,78]
		},
		PR: {
			StraightMale: [61,20,69],
			StraightFemale: [37,43,56],
			GayMale: [7,2,13],
			GayFemale: [1,0,3],
			BiMale: [4,1,0],
			BiFemale: [5,1,7]
		},
		PA: {
			StraightMale: [7636,2284,5092],
			StraightFemale: [3444,2468,3759],
			GayMale: [526,101,302],
			GayFemale: [303,88,209],
			BiMale: [231,40,155],
			BiFemale: [804,157,560]
		},
		OR: {
			StraightMale: [4520,885,2382],
			StraightFemale: [2031,1001,1851],
			GayMale: [298,38,150],
			GayFemale: [238,48,144],
			BiMale: [201,21,91],
			BiFemale: [693,95,436]
		},
		OK: {
			StraightMale: [1677,1156,1688],
			StraightFemale: [520,1204,1048],
			GayMale: [87,42,104],
			GayFemale: [49,37,55],
			BiMale: [48,25,52],
			BiFemale: [174,63,171]
		},
		OH: {
			StraightMale: [6140,2496,4609],
			StraightFemale: [2441,2492,3250],
			GayMale: [386,101,302],
			GayFemale: [184,76,178],
			BiMale: [188,36,130],
			BiFemale: [622,183,501]
		},
		NY: {
			StraightMale: [14086,2559,7305],
			StraightFemale: [7484,2969,6182],
			GayMale: [1288,218,767],
			GayFemale: [622,115,393],
			BiMale: [400,57,242],
			BiFemale: [1373,241,899]
		},
		NV: {
			StraightMale: [1512,443,1119],
			StraightFemale: [512,438,649],
			GayMale: [66,18,46],
			GayFemale: [33,13,34],
			BiMale: [36,7,27],
			BiFemale: [132,48,124]
		},
		NM: {
			StraightMale: [930,315,689],
			StraightFemale: [351,289,454],
			GayMale: [50,7,63],
			GayFemale: [20,15,27],
			BiMale: [35,5,33],
			BiFemale: [106,24,89]
		},
		NJ: {
			StraightMale: [4566,1122,2946],
			StraightFemale: [1725,1230,2105],
			GayMale: [263,58,184],
			GayFemale: [114,33,105],
			BiMale: [104,16,58],
			BiFemale: [315,85,270]
		},
		NH: {
			StraightMale: [1156,211,687],
			StraightFemale: [462,283,574],
			GayMale: [49,15,41],
			GayFemale: [29,9,27],
			BiMale: [33,3,14],
			BiFemale: [119,25,86]
		},
		NE: {
			StraightMale: [854,319,649],
			StraightFemale: [278,346,433],
			GayMale: [36,11,28],
			GayFemale: [29,12,20],
			BiMale: [32,8,14],
			BiFemale: [82,20,75]
		},
		ND: {
			StraightMale: [271,120,241],
			StraightFemale: [74,104,109],
			GayMale: [9,0,3],
			GayFemale: [4,1,8],
			BiMale: [4,5,6],
			BiFemale: [26,4,20]
		},
		NC: {
			StraightMale: [3626,1814,2903],
			StraightFemale: [1497,1989,2103],
			GayMale: [221,72,192],
			GayFemale: [132,44,132],
			BiMale: [111,18,101],
			BiFemale: [408,128,301]
		},
		MT: {
			StraightMale: [389,150,318],
			StraightFemale: [176,161,203],
			GayMale: [17,4,6],
			GayFemale: [10,4,14],
			BiMale: [12,3,11],
			BiFemale: [32,12,41]
		},
		MS: {
			StraightMale: [436,402,528],
			StraightFemale: [126,432,316],
			GayMale: [26,12,24],
			GayFemale: [13,10,17],
			BiMale: [12,11,5],
			BiFemale: [41,16,63]
		},
		MO: {
			StraightMale: [3143,1278,2501],
			StraightFemale: [1258,1453,1734],
			GayMale: [188,53,149],
			GayFemale: [120,32,86],
			BiMale: [90,28,75],
			BiFemale: [320,98,290]
		},
		MN: {
			StraightMale: [3979,1201,2440],
			StraightFemale: [1643,1180,1767],
			GayMale: [243,41,145],
			GayFemale: [141,42,87],
			BiMale: [130,23,60],
			BiFemale: [392,88,320]
		},
		MI: {
			StraightMale: [5617,1969,4178],
			StraightFemale: [2421,2345,3008],
			GayMale: [376,80,236],
			GayFemale: [188,55,143],
			BiMale: [172,37,113],
			BiFemale: [585,165,450]
		},
		ME: {
			StraightMale: [827,195,534],
			StraightFemale: [397,252,478],
			GayMale: [38,14,33],
			GayFemale: [38,13,37],
			BiMale: [23,5,23],
			BiFemale: [113,25,96]
		},
		MD: {
			StraightMale: [4171,948,2354],
			StraightFemale: [1677,989,1737],
			GayMale: [272,53,179],
			GayFemale: [169,42,107],
			BiMale: [111,16,53],
			BiFemale: [392,96,305]
		},
		MA: {
			StraightMale: [8366,1040,3517],
			StraightFemale: [4567,1412,3407],
			GayMale: [670,79,339],
			GayFemale: [470,70,250],
			BiMale: [270,25,117],
			BiFemale: [1050,113,553]
		},
		LA: {
			StraightMale: [1196,701,1161],
			StraightFemale: [499,743,824],
			GayMale: [88,23,82],
			GayFemale: [50,23,49],
			BiMale: [37,8,36],
			BiFemale: [157,53,119]
		},
		KY: {
			StraightMale: [1443,889,1311],
			StraightFemale: [523,873,919],
			GayMale: [83,40,94],
			GayFemale: [40,25,38],
			BiMale: [41,11,33],
			BiFemale: [160,64,164]
		},
		KS: {
			StraightMale: [1484,559,1158],
			StraightFemale: [568,602,761],
			GayMale: [53,25,52],
			GayFemale: [53,17,34],
			BiMale: [41,14,34],
			BiFemale: [169,41,115]
		},
		IN: {
			StraightMale: [2957,1419,2492],
			StraightFemale: [1116,1522,1815],
			GayMale: [178,60,168],
			GayFemale: [84,42,94],
			BiMale: [90,29,73],
			BiFemale: [318,114,248]
		},
		IL: {
			StraightMale: [8056,2199,4990],
			StraightFemale: [3626,2395,3797],
			GayMale: [633,127,369],
			GayFemale: [308,70,199],
			BiMale: [245,34,129],
			BiFemale: [760,142,521]
		},
		ID: {
			StraightMale: [664,259,529],
			StraightFemale: [257,269,362],
			GayMale: [33,11,24],
			GayFemale: [12,3,13],
			BiMale: [11,1,14],
			BiFemale: [56,22,51]
		},
		IA: {
			StraightMale: [1437,507,1128],
			StraightFemale: [567,599,758],
			GayMale: [65,15,56],
			GayFemale: [41,11,36],
			BiMale: [39,10,21],
			BiFemale: [159,38,116]
		},
		HI: {
			StraightMale: [493,152,373],
			StraightFemale: [166,106,227],
			GayMale: [33,3,26],
			GayFemale: [10,2,15],
			BiMale: [11,8,11],
			BiFemale: [27,11,29]
		},
		GU: {
			StraightMale: [6,5,8],
			StraightFemale: [2,5,11],
			GayFemale: [1,0,2],
			BiMale: [0,0,1],
			BiFemale: [2,0,1]
		},
		GA: {
			StraightMale: [4094,1958,3397],
			StraightFemale: [1573,2243,2301],
			GayMale: [276,63,237],
			GayFemale: [142,64,147],
			BiMale: [117,37,95],
			BiFemale: [383,115,343]
		},
		FM: {
			StraightMale: [0,1,0],
			BiFemale: [1,0,0]
		},
		FL: {
			StraightMale: [8999,3223,6719],
			StraightFemale: [3449,3316,4586],
			GayMale: [512,151,432],
			GayFemale: [286,118,239],
			BiMale: [203,63,178],
			BiFemale: [873,243,702]
		},
		DE: {
			StraightMale: [456,134,294],
			StraightFemale: [189,166,241],
			GayMale: [27,8,24],
			GayFemale: [12,4,14],
			BiMale: [9,1,14],
			BiFemale: [45,13,34]
		},
		DC: {
			StraightMale: [1086,98,345],
			StraightFemale: [819,144,418],
			GayMale: [181,15,74],
			GayFemale: [71,11,17],
			BiMale: [29,4,16],
			BiFemale: [122,8,48]
		},
		CT: {
			StraightMale: [2282,403,1348],
			StraightFemale: [929,551,1061],
			GayMale: [134,23,102],
			GayFemale: [78,25,54],
			BiMale: [56,7,38],
			BiFemale: [219,44,129]
		},
		CO: {
			StraightMale: [4003,1051,2634],
			StraightFemale: [1539,1003,1604],
			GayMale: [179,37,123],
			GayFemale: [92,29,78],
			BiMale: [107,18,86],
			BiFemale: [370,95,312]
		},
		CA: {
			StraightMale: [28651,5748,14945],
			StraightFemale: [12067,6215,10853],
			GayMale: [2163,376,1262],
			GayFemale: [1001,265,754],
			BiMale: [875,105,438],
			BiFemale: [2590,445,1753]
		},
		AZ: {
			StraightMale: [4059,1196,2692],
			StraightFemale: [1481,1259,1800],
			GayMale: [200,58,169],
			GayFemale: [130,37,105],
			BiMale: [95,18,86],
			BiFemale: [349,102,285]
		},
		AS: {
			StraightMale: [2,0,0]
		},
		AR: {
			StraightMale: [699,561,757],
			StraightFemale: [246,607,507],
			GayMale: [36,17,42],
			GayFemale: [20,7,32],
			BiMale: [28,17,20],
			BiFemale: [79,40,96]
		},
		AL: {
			StraightMale: [1118,893,1157],
			StraightFemale: [403,964,698],
			GayMale: [61,26,75],
			GayFemale: [39,26,35],
			BiMale: [30,18,38],
			BiFemale: [94,61,114]
		},
		AK: {
			StraightMale: [420,135,303],
			StraightFemale: [179,112,248],
			GayMale: [9,0,9],
			GayFemale: [18,5,6],
			BiMale: [16,4,12],
			BiFemale: [49,13,36]
		}

	},
	{
		question: 'Would you consider sleeping with someone on a first date?',
		answers: ["Yes","No"],
		WY: {
			StraightMale: [356,85],
			StraightFemale: [131,134],
			GayMale: [6,2],
			GayFemale: [4,7],
			BiMale: [12,1],
			BiFemale: [24,6]
		},
		WV: {
			StraightMale: [899,269],
			StraightFemale: [390,480],
			GayMale: [48,20],
			GayFemale: [28,11],
			BiMale: [31,7],
			BiFemale: [77,58]
		},
		WI: {
			StraightMale: [4473,1386],
			StraightFemale: [1726,2037],
			GayMale: [239,93],
			GayFemale: [148,71],
			BiMale: [146,27],
			BiFemale: [444,223]
		},
		WA: {
			StraightMale: [9778,2388],
			StraightFemale: [3610,3516],
			GayMale: [652,204],
			GayFemale: [373,166],
			BiMale: [395,51],
			BiFemale: [1190,461]
		},
		VT: {
			StraightMale: [591,113],
			StraightFemale: [248,240],
			GayMale: [38,12],
			GayFemale: [20,15],
			BiMale: [31,7],
			BiFemale: [100,33]
		},
		VI: {
			StraightMale: [14,1],
			StraightFemale: [8,3],
			BiFemale: [1,0]
		},
		VA: {
			StraightMale: [6539,1976],
			StraightFemale: [2127,2759],
			GayMale: [391,149],
			GayFemale: [166,114],
			BiMale: [200,25],
			BiFemale: [533,302]
		},
		UT: {
			StraightMale: [1641,622],
			StraightFemale: [500,683],
			GayMale: [104,46],
			GayFemale: [37,24],
			BiMale: [51,10],
			BiFemale: [151,77]
		},
		TX: {
			StraightMale: [15208,4501],
			StraightFemale: [5348,7130],
			GayMale: [933,319],
			GayFemale: [411,265],
			BiMale: [419,79],
			BiFemale: [1156,616]
		},
		TN: {
			StraightMale: [3468,1266],
			StraightFemale: [1207,1813],
			GayMale: [200,90],
			GayFemale: [106,77],
			BiMale: [119,21],
			BiFemale: [300,168]
		},
		SD: {
			StraightMale: [372,109],
			StraightFemale: [148,167],
			GayMale: [17,3],
			GayFemale: [8,6],
			BiMale: [11,2],
			BiFemale: [25,24]
		},
		SC: {
			StraightMale: [2105,655],
			StraightFemale: [693,1142],
			GayMale: [78,52],
			GayFemale: [67,50],
			BiMale: [51,10],
			BiFemale: [159,106]
		},
		RI: {
			StraightMale: [1039,282],
			StraightFemale: [388,487],
			GayMale: [98,34],
			GayFemale: [51,27],
			BiMale: [30,9],
			BiFemale: [102,72]
		},
		PR: {
			StraightMale: [80,30],
			StraightFemale: [40,72],
			GayMale: [12,4],
			GayFemale: [3,0],
			BiMale: [3,0],
			BiFemale: [4,6]
		},
		PA: {
			StraightMale: [9959,2989],
			StraightFemale: [3823,4803],
			GayMale: [595,225],
			GayFemale: [331,204],
			BiMale: [297,57],
			BiFemale: [918,505]
		},
		OR: {
			StraightMale: [5474,1361],
			StraightFemale: [2300,2068],
			GayMale: [378,94],
			GayFemale: [296,117],
			BiMale: [245,41],
			BiFemale: [828,303]
		},
		OK: {
			StraightMale: [2988,854],
			StraightFemale: [979,1338],
			GayMale: [162,52],
			GayFemale: [84,43],
			BiMale: [81,14],
			BiFemale: [257,115]
		},
		OH: {
			StraightMale: [8501,2965],
			StraightFemale: [2953,4309],
			GayMale: [503,200],
			GayFemale: [265,144],
			BiMale: [274,50],
			BiFemale: [738,433]
		},
		NY: {
			StraightMale: [16725,4078],
			StraightFemale: [7341,7724],
			GayMale: [1716,454],
			GayFemale: [749,321],
			BiMale: [498,105],
			BiFemale: [1506,791]
		},
		NV: {
			StraightMale: [2185,465],
			StraightFemale: [696,700],
			GayMale: [99,21],
			GayFemale: [42,23],
			BiMale: [57,13],
			BiFemale: [178,100]
		},
		NM: {
			StraightMale: [1322,300],
			StraightFemale: [493,480],
			GayMale: [94,19],
			GayFemale: [44,14],
			BiMale: [63,6],
			BiFemale: [147,58]
		},
		NJ: {
			StraightMale: [5811,1602],
			StraightFemale: [1785,2670],
			GayMale: [322,129],
			GayFemale: [152,94],
			BiMale: [129,33],
			BiFemale: [357,235]
		},
		NH: {
			StraightMale: [1395,414],
			StraightFemale: [548,651],
			GayMale: [73,25],
			GayFemale: [45,13],
			BiMale: [46,6],
			BiFemale: [150,67]
		},
		NE: {
			StraightMale: [1170,393],
			StraightFemale: [379,539],
			GayMale: [43,20],
			GayFemale: [25,30],
			BiMale: [37,3],
			BiFemale: [116,55]
		},
		ND: {
			StraightMale: [390,130],
			StraightFemale: [119,151],
			GayMale: [9,1],
			GayFemale: [3,8],
			BiMale: [12,1],
			BiFemale: [19,15]
		},
		NC: {
			StraightMale: [5358,1675],
			StraightFemale: [2022,2751],
			GayMale: [323,105],
			GayFemale: [161,106],
			BiMale: [168,30],
			BiFemale: [487,293]
		},
		MT: {
			StraightMale: [603,133],
			StraightFemale: [245,237],
			GayMale: [17,3],
			GayFemale: [20,10],
			BiMale: [24,1],
			BiFemale: [55,21]
		},
		MS: {
			StraightMale: [859,274],
			StraightFemale: [281,451],
			GayMale: [39,19],
			GayFemale: [22,10],
			BiMale: [18,6],
			BiFemale: [75,34]
		},
		MO: {
			StraightMale: [4561,1404],
			StraightFemale: [1682,2241],
			GayMale: [267,68],
			GayFemale: [145,74],
			BiMale: [143,23],
			BiFemale: [423,209]
		},
		MN: {
			StraightMale: [4966,1593],
			StraightFemale: [1910,2242],
			GayMale: [286,100],
			GayFemale: [162,75],
			BiMale: [150,35],
			BiFemale: [492,242]
		},
		MI: {
			StraightMale: [7558,2415],
			StraightFemale: [2825,3902],
			GayMale: [431,180],
			GayFemale: [249,130],
			BiMale: [239,53],
			BiFemale: [676,384]
		},
		ME: {
			StraightMale: [1037,271],
			StraightFemale: [503,509],
			GayMale: [56,18],
			GayFemale: [52,26],
			BiMale: [43,6],
			BiFemale: [161,78]
		},
		MD: {
			StraightMale: [5011,1523],
			StraightFemale: [1721,2177],
			GayMale: [344,126],
			GayFemale: [176,104],
			BiMale: [133,21],
			BiFemale: [448,276]
		},
		MA: {
			StraightMale: [9094,2382],
			StraightFemale: [3813,4681],
			GayMale: [726,257],
			GayFemale: [471,246],
			BiMale: [316,50],
			BiFemale: [1130,513]
		},
		LA: {
			StraightMale: [1985,596],
			StraightFemale: [756,1003],
			GayMale: [120,59],
			GayFemale: [56,39],
			BiMale: [62,13],
			BiFemale: [192,111]
		},
		KY: {
			StraightMale: [2335,747],
			StraightFemale: [806,1209],
			GayMale: [125,51],
			GayFemale: [58,37],
			BiMale: [60,11],
			BiFemale: [218,115]
		},
		KS: {
			StraightMale: [2133,593],
			StraightFemale: [750,946],
			GayMale: [89,35],
			GayFemale: [58,36],
			BiMale: [73,10],
			BiFemale: [183,92]
		},
		IN: {
			StraightMale: [4428,1485],
			StraightFemale: [1647,2252],
			GayMale: [269,93],
			GayFemale: [128,73],
			BiMale: [135,25],
			BiFemale: [393,220]
		},
		IL: {
			StraightMale: [10151,3001],
			StraightFemale: [3943,4825],
			GayMale: [760,279],
			GayFemale: [370,164],
			BiMale: [307,62],
			BiFemale: [824,470]
		},
		ID: {
			StraightMale: [985,254],
			StraightFemale: [384,410],
			GayMale: [48,13],
			GayFemale: [18,8],
			BiMale: [27,1],
			BiFemale: [76,37]
		},
		IA: {
			StraightMale: [1990,637],
			StraightFemale: [762,937],
			GayMale: [84,35],
			GayFemale: [46,34],
			BiMale: [61,6],
			BiFemale: [190,104]
		},
		HI: {
			StraightMale: [688,208],
			StraightFemale: [204,234],
			GayMale: [52,11],
			GayFemale: [12,12],
			BiMale: [24,3],
			BiFemale: [41,28]
		},
		GU: {
			StraightMale: [12,1],
			StraightFemale: [8,5],
			GayFemale: [1,1],
			BiMale: [1,0],
			BiFemale: [2,1]
		},
		GA: {
			StraightMale: [6088,1847],
			StraightFemale: [2123,3133],
			GayMale: [367,133],
			GayFemale: [202,119],
			BiMale: [184,28],
			BiFemale: [494,260]
		},
		FM: {
			StraightMale: [1,0]
		},
		FL: {
			StraightMale: [12492,3481],
			StraightFemale: [4102,5725],
			GayMale: [672,278],
			GayFemale: [348,211],
			BiMale: [333,69],
			BiFemale: [1066,569]
		},
		DE: {
			StraightMale: [588,172],
			StraightFemale: [230,285],
			GayMale: [38,19],
			GayFemale: [24,6],
			BiMale: [15,6],
			BiFemale: [56,27]
		},
		DC: {
			StraightMale: [1089,233],
			StraightFemale: [649,608],
			GayMale: [194,52],
			GayFemale: [57,32],
			BiMale: [34,9],
			BiFemale: [124,49]
		},
		CT: {
			StraightMale: [2722,791],
			StraightFemale: [960,1357],
			GayMale: [154,69],
			GayFemale: [92,61],
			BiMale: [76,15],
			BiFemale: [239,145]
		},
		CO: {
			StraightMale: [5241,1357],
			StraightFemale: [1802,1872],
			GayMale: [270,51],
			GayFemale: [116,59],
			BiMale: [166,26],
			BiFemale: [477,213]
		},
		CA: {
			StraightMale: [34420,8695],
			StraightFemale: [12581,13528],
			GayMale: [2633,835],
			GayFemale: [1288,628],
			BiMale: [1121,178],
			BiFemale: [3134,1436]
		},
		AZ: {
			StraightMale: [5473,1432],
			StraightFemale: [1914,2137],
			GayMale: [308,76],
			GayFemale: [170,72],
			BiMale: [145,24],
			BiFemale: [433,217]
		},
		AS: {
			StraightMale: [1,2]
		},
		AR: {
			StraightMale: [1277,427],
			StraightFemale: [471,700],
			GayMale: [62,19],
			GayFemale: [33,22],
			BiMale: [52,4],
			BiFemale: [124,64]
		},
		AL: {
			StraightMale: [1993,678],
			StraightFemale: [702,1038],
			GayMale: [100,41],
			GayFemale: [46,35],
			BiMale: [67,9],
			BiFemale: [164,89]
		},
		AK: {
			StraightMale: [595,147],
			StraightFemale: [242,247],
			GayMale: [12,5],
			GayFemale: [14,9],
			BiMale: [30,2],
			BiFemale: [62,29]
		}

	},
	{
		question: 'How much affection can you tolerate?',
		answers: ["Inifinite","Most of it.","A little bit.","Get off me!!"],
		WY: {
			StraightMale: [399,522,44,1],
			StraightFemale: [169,374,36,3],
			GayMale: [14,17,2,0],
			GayFemale: [13,9,1,1],
			BiMale: [15,15,2,0],
			BiFemale: [16,48,8,0]
		},
		WV: {
			StraightMale: [1278,1368,95,9],
			StraightFemale: [681,1159,121,12],
			GayMale: [65,87,11,1],
			GayFemale: [46,35,7,0],
			BiMale: [44,32,9,0],
			BiFemale: [91,171,13,3]
		},
		WI: {
			StraightMale: [4769,7196,487,30],
			StraightFemale: [2090,5263,514,21],
			GayMale: [206,393,57,2],
			GayFemale: [175,242,23,3],
			BiMale: [117,220,29,3],
			BiFemale: [356,718,107,4]
		},
		WA: {
			StraightMale: [9551,13862,896,43],
			StraightFemale: [4119,9558,967,54],
			GayMale: [509,1031,109,7],
			GayFemale: [361,668,59,5],
			BiMale: [261,490,45,5],
			BiFemale: [926,1764,214,15]
		},
		VT: {
			StraightMale: [614,823,50,4],
			StraightFemale: [317,645,56,4],
			GayMale: [35,52,10,0],
			GayFemale: [25,54,7,0],
			BiMale: [32,37,2,0],
			BiFemale: [73,151,24,1]
		},
		VI: {
			StraightMale: [15,12,0,0],
			StraightFemale: [7,13,0,0],
			GayMale: [0,1,0,0],
			GayFemale: [0,1,0,0],
			BiMale: [0,1,0,0],
			BiFemale: [0,2,1,0]
		},
		VA: {
			StraightMale: [7642,10342,746,44],
			StraightFemale: [3308,7105,760,45],
			GayMale: [369,651,65,3],
			GayFemale: [245,403,32,2],
			BiMale: [210,254,30,5],
			BiFemale: [533,1057,129,10]
		},
		UT: {
			StraightMale: [2122,2702,202,14],
			StraightFemale: [757,1687,173,8],
			GayMale: [105,159,30,0],
			GayFemale: [63,89,11,0],
			BiMale: [48,84,8,0],
			BiFemale: [144,283,40,1]
		},
		TX: {
			StraightMale: [18827,24406,1696,124],
			StraightFemale: [8639,17555,2047,95],
			GayMale: [962,1608,205,4],
			GayFemale: [658,962,82,4],
			BiMale: [447,615,93,7],
			BiFemale: [1252,2282,295,15]
		},
		TN: {
			StraightMale: [4789,5545,419,26],
			StraightFemale: [2216,4246,464,28],
			GayMale: [260,367,41,6],
			GayFemale: [149,228,30,2],
			BiMale: [132,169,16,6],
			BiFemale: [372,580,74,3]
		},
		SD: {
			StraightMale: [430,663,44,5],
			StraightFemale: [209,434,55,5],
			GayMale: [20,23,2,0],
			GayFemale: [14,19,0,0],
			BiMale: [8,15,5,1],
			BiFemale: [38,62,9,1]
		},
		SC: {
			StraightMale: [2812,3341,244,15],
			StraightFemale: [1470,2551,264,16],
			GayMale: [124,176,29,0],
			GayFemale: [101,135,13,2],
			BiMale: [68,75,8,0],
			BiFemale: [175,308,41,4]
		},
		RI: {
			StraightMale: [1158,1603,108,11],
			StraightFemale: [562,1305,137,5],
			GayMale: [81,167,15,2],
			GayFemale: [62,101,10,0],
			BiMale: [41,43,9,0],
			BiFemale: [108,211,24,1]
		},
		PR: {
			StraightMale: [184,147,20,2],
			StraightFemale: [100,162,24,3],
			GayMale: [19,19,2,0],
			GayFemale: [5,5,1,0],
			BiMale: [2,6,1,0],
			BiFemale: [9,18,2,0]
		},
		PA: {
			StraightMale: [11654,15760,1122,65],
			StraightFemale: [5630,12122,1321,60],
			GayMale: [563,1083,142,4],
			GayFemale: [432,704,68,6],
			BiMale: [281,406,57,7],
			BiFemale: [936,1721,225,16]
		},
		OR: {
			StraightMale: [5276,7874,500,25],
			StraightFemale: [2442,6024,541,29],
			GayMale: [278,554,62,3],
			GayFemale: [277,491,35,3],
			BiMale: [195,318,44,6],
			BiFemale: [584,1302,149,7]
		},
		OK: {
			StraightMale: [3875,4661,349,14],
			StraightFemale: [1806,3290,313,30],
			GayMale: [164,277,27,0],
			GayFemale: [112,147,22,1],
			BiMale: [99,127,17,1],
			BiFemale: [290,448,54,5]
		},
		OH: {
			StraightMale: [10901,13570,984,54],
			StraightFemale: [4862,10011,1062,58],
			GayMale: [534,855,111,3],
			GayFemale: [353,499,58,7],
			BiMale: [274,370,44,4],
			BiFemale: [784,1402,202,10]
		},
		NY: {
			StraightMale: [18161,27356,2214,163],
			StraightFemale: [9873,23779,2703,163],
			GayMale: [1359,2977,384,21],
			GayFemale: [811,1519,143,6],
			BiMale: [459,730,95,13],
			BiFemale: [1451,2924,382,30]
		},
		NV: {
			StraightMale: [2599,3001,221,18],
			StraightFemale: [1055,1904,225,10],
			GayMale: [91,164,23,0],
			GayFemale: [62,112,5,1],
			BiMale: [70,89,8,0],
			BiFemale: [191,341,48,4]
		},
		NM: {
			StraightMale: [1413,1938,155,16],
			StraightFemale: [626,1352,127,9],
			GayMale: [72,140,21,0],
			GayFemale: [36,85,3,1],
			BiMale: [52,66,12,0],
			BiFemale: [131,240,24,3]
		},
		NJ: {
			StraightMale: [6943,9084,669,35],
			StraightFemale: [3317,6803,664,29],
			GayMale: [317,582,64,5],
			GayFemale: [215,369,27,1],
			BiMale: [169,209,34,0],
			BiFemale: [414,750,83,10]
		},
		NH: {
			StraightMale: [1593,2129,112,9],
			StraightFemale: [836,1667,145,8],
			GayMale: [76,117,11,2],
			GayFemale: [45,100,8,1],
			BiMale: [34,64,8,0],
			BiFemale: [152,256,21,1]
		},
		NE: {
			StraightMale: [1312,1963,148,13],
			StraightFemale: [558,1300,172,11],
			GayMale: [57,91,7,0],
			GayFemale: [35,69,3,0],
			BiMale: [38,43,8,2],
			BiFemale: [111,169,28,5]
		},
		ND: {
			StraightMale: [469,680,70,3],
			StraightFemale: [192,379,63,1],
			GayMale: [6,25,3,0],
			GayFemale: [12,14,3,0],
			BiMale: [11,15,6,1],
			BiFemale: [25,48,8,0]
		},
		NC: {
			StraightMale: [6762,9004,617,39],
			StraightFemale: [3443,7061,729,35],
			GayMale: [326,579,79,4],
			GayFemale: [275,397,42,4],
			BiMale: [174,227,35,1],
			BiFemale: [537,919,127,9]
		},
		MT: {
			StraightMale: [661,959,55,2],
			StraightFemale: [271,681,63,4],
			GayMale: [12,43,7,0],
			GayFemale: [11,39,3,0],
			BiMale: [18,23,3,0],
			BiFemale: [41,97,14,1]
		},
		MS: {
			StraightMale: [1243,1414,117,7],
			StraightFemale: [617,1075,107,8],
			GayMale: [57,87,9,1],
			GayFemale: [45,41,6,0],
			BiMale: [31,33,7,0],
			BiFemale: [71,166,18,3]
		},
		MP: {
			StraightMale: [2,0,0,0]
		},
		MO: {
			StraightMale: [5437,6931,468,29],
			StraightFemale: [2711,5429,588,29],
			GayMale: [251,422,46,1],
			GayFemale: [180,278,29,3],
			BiMale: [130,211,34,6],
			BiFemale: [408,741,92,20]
		},
		MN: {
			StraightMale: [4954,8169,645,35],
			StraightFemale: [2251,5840,598,26],
			GayMale: [251,490,56,3],
			GayFemale: [166,320,31,0],
			BiMale: [139,199,27,2],
			BiFemale: [414,828,110,6]
		},
		MI: {
			StraightMale: [9212,12195,862,50],
			StraightFemale: [4379,9491,1037,59],
			GayMale: [435,788,87,5],
			GayFemale: [309,465,39,3],
			BiMale: [256,306,53,3],
			BiFemale: [721,1300,134,18]
		},
		ME: {
			StraightMale: [1256,1618,112,5],
			StraightFemale: [706,1422,122,7],
			GayMale: [67,104,12,0],
			GayFemale: [56,114,8,1],
			BiMale: [42,49,9,2],
			BiFemale: [129,250,28,0]
		},
		MD: {
			StraightMale: [5374,7648,548,31],
			StraightFemale: [2409,5533,595,33],
			GayMale: [279,546,59,2],
			GayFemale: [235,367,30,2],
			BiMale: [145,191,32,1],
			BiFemale: [472,816,86,10]
		},
		MA: {
			StraightMale: [8640,14062,1021,63],
			StraightFemale: [4772,12840,1378,48],
			GayMale: [613,1353,165,5],
			GayFemale: [530,988,87,3],
			BiMale: [244,406,60,9],
			BiFemale: [866,1841,247,14]
		},
		LA: {
			StraightMale: [2710,3064,231,24],
			StraightFemale: [1325,2387,250,14],
			GayMale: [137,201,32,2],
			GayFemale: [104,128,15,2],
			BiMale: [74,79,21,1],
			BiFemale: [204,342,45,6]
		},
		KY: {
			StraightMale: [3245,3657,263,23],
			StraightFemale: [1548,2911,302,16],
			GayMale: [157,246,28,3],
			GayFemale: [98,123,7,1],
			BiMale: [76,95,13,0],
			BiFemale: [241,429,58,4]
		},
		KS: {
			StraightMale: [2469,3300,242,18],
			StraightFemale: [1041,2334,240,9],
			GayMale: [95,159,23,1],
			GayFemale: [77,104,14,1],
			BiMale: [60,88,13,1],
			BiFemale: [198,356,42,2]
		},
		IN: {
			StraightMale: [5679,6910,521,26],
			StraightFemale: [2648,5305,536,22],
			GayMale: [277,457,53,2],
			GayFemale: [154,274,24,4],
			BiMale: [137,203,35,1],
			BiFemale: [443,762,96,3]
		},
		IL: {
			StraightMale: [11372,16307,1283,74],
			StraightFemale: [5308,12644,1332,67],
			GayMale: [640,1339,170,5],
			GayFemale: [376,705,69,2],
			BiMale: [285,431,55,1],
			BiFemale: [846,1587,195,19]
		},
		ID: {
			StraightMale: [1203,1559,118,8],
			StraightFemale: [493,1118,130,4],
			GayMale: [40,77,11,1],
			GayFemale: [27,34,2,0],
			BiMale: [37,34,8,2],
			BiFemale: [58,152,17,1]
		},
		IA: {
			StraightMale: [2244,3204,220,13],
			StraightFemale: [1010,2490,284,9],
			GayMale: [91,183,9,2],
			GayFemale: [59,110,10,0],
			BiMale: [55,71,8,4],
			BiFemale: [162,347,47,2]
		},
		HI: {
			StraightMale: [826,1124,66,5],
			StraightFemale: [308,648,74,1],
			GayMale: [53,74,7,0],
			GayFemale: [25,34,1,1],
			BiMale: [18,32,1,0],
			BiFemale: [48,87,15,0]
		},
		GU: {
			StraightMale: [18,31,2,0],
			StraightFemale: [15,27,0,0],
			GayMale: [1,3,0,0],
			GayFemale: [1,3,0,0],
			BiMale: [0,1,0,0],
			BiFemale: [1,4,0,0]
		},
		GA: {
			StraightMale: [7826,9930,726,41],
			StraightFemale: [3651,7553,855,32],
			GayMale: [411,623,80,3],
			GayFemale: [282,419,43,4],
			BiMale: [206,272,39,4],
			BiFemale: [569,957,126,14]
		},
		FM: {
			StraightMale: [0,1,0,0],
			StraightFemale: [0,1,0,0],
			GayFemale: [1,0,0,0],
			BiFemale: [1,0,0,0]
		},
		FL: {
			StraightMale: [17178,19355,1303,94],
			StraightFemale: [7690,13893,1416,83],
			GayMale: [858,1221,159,11],
			GayFemale: [570,734,70,3],
			BiMale: [390,478,69,7],
			BiFemale: [1242,1990,266,21]
		},
		DE: {
			StraightMale: [682,950,61,2],
			StraightFemale: [354,720,64,7],
			GayMale: [45,64,12,1],
			GayFemale: [33,33,2,1],
			BiMale: [20,32,0,0],
			BiFemale: [67,92,16,2]
		},
		DC: {
			StraightMale: [849,1910,166,9],
			StraightFemale: [623,2017,299,16],
			GayMale: [138,330,51,1],
			GayFemale: [82,126,13,1],
			BiMale: [34,51,10,1],
			BiFemale: [83,233,30,4]
		},
		CT: {
			StraightMale: [3188,4279,301,16],
			StraightFemale: [1500,3307,283,17],
			GayMale: [148,306,40,1],
			GayFemale: [136,175,12,2],
			BiMale: [75,116,16,3],
			BiFemale: [248,442,54,7]
		},
		CO: {
			StraightMale: [5426,7947,520,23],
			StraightFemale: [2217,5104,554,33],
			GayMale: [192,396,55,1],
			GayFemale: [142,230,22,1],
			BiMale: [145,226,21,3],
			BiFemale: [397,799,106,22]
		},
		CA: {
			StraightMale: [35825,52368,3814,224],
			StraightFemale: [16447,37017,3706,225],
			GayMale: [2186,4495,572,30],
			GayFemale: [1557,2512,211,13],
			BiMale: [940,1389,164,23],
			BiFemale: [2822,5278,591,58]
		},
		AZ: {
			StraightMale: [6343,7944,546,31],
			StraightFemale: [2663,5458,601,19],
			GayMale: [292,493,72,4],
			GayFemale: [190,320,27,1],
			BiMale: [159,193,26,1],
			BiFemale: [439,798,82,11]
		},
		AS: {
			StraightMale: [0,3,0,0],
			StraightFemale: [1,1,0,0]
		},
		AR: {
			StraightMale: [1834,2033,160,9],
			StraightFemale: [881,1724,191,13],
			GayMale: [68,124,20,0],
			GayFemale: [63,84,5,0],
			BiMale: [56,65,10,2],
			BiFemale: [130,251,26,1]
		},
		AL: {
			StraightMale: [2904,3254,248,15],
			StraightFemale: [1433,2384,294,22],
			GayMale: [123,192,29,1],
			GayFemale: [94,117,14,1],
			BiMale: [72,104,19,1],
			BiFemale: [211,307,49,9]
		},
		AK: {
			StraightMale: [625,885,74,4],
			StraightFemale: [281,631,81,2],
			GayMale: [20,28,5,1],
			GayFemale: [20,39,6,0],
			BiMale: [26,23,6,0],
			BiFemale: [61,113,12,2]
		}

	},
	{
		question: 'Do you prefer?',
		answers: ["Slim Men/Women","Average Men/Women","Fuller Figured Men/Women","I Don't Care/Not Fussy"],
		WY: {
			StraightMale: [194,307,29,143],
			StraightFemale: [25,205,21,137],
			GayMale: [6,10,0,6],
			GayFemale: [2,6,2,6],
			BiMale: [4,8,1,9],
			BiFemale: [6,23,3,20]
		},
		WV: {
			StraightMale: [526,810,121,482],
			StraightFemale: [102,680,82,493],
			GayMale: [26,52,6,21],
			GayFemale: [8,19,3,28],
			BiMale: [14,16,2,26],
			BiFemale: [28,77,18,87]
		},
		WI: {
			StraightMale: [2927,4049,402,1808],
			StraightFemale: [576,3116,386,1713],
			GayMale: [148,231,15,86],
			GayFemale: [39,130,28,131],
			BiMale: [55,99,21,91],
			BiFemale: [151,356,71,338]
		},
		WA: {
			StraightMale: [6282,7492,863,3528],
			StraightFemale: [1356,5756,701,2999],
			GayMale: [403,590,50,230],
			GayFemale: [123,377,80,304],
			BiMale: [144,199,43,219],
			BiFemale: [351,881,176,850]
		},
		VT: {
			StraightMale: [322,474,49,217],
			StraightFemale: [89,366,55,239],
			GayMale: [20,36,4,14],
			GayFemale: [8,30,4,20],
			BiMale: [11,22,5,13],
			BiFemale: [37,74,5,74]
		},
		VI: {
			StraightMale: [9,7,3,3],
			StraightFemale: [2,10,0,4],
			GayMale: [0,1,0,0],
			BiFemale: [0,0,0,0]
		},
		VA: {
			StraightMale: [4530,5798,604,2629],
			StraightFemale: [936,4399,429,2116],
			GayMale: [247,381,46,173],
			GayFemale: [89,202,37,171],
			BiMale: [79,133,26,116],
			BiFemale: [211,485,87,457]
		},
		UT: {
			StraightMale: [1313,1459,149,723],
			StraightFemale: [190,965,143,571],
			GayMale: [61,97,10,44],
			GayFemale: [18,45,8,42],
			BiMale: [24,34,7,33],
			BiFemale: [55,126,23,137]
		},
		TX: {
			StraightMale: [10932,13292,1527,6665],
			StraightFemale: [2204,10885,1380,5619],
			GayMale: [537,1013,99,375],
			GayFemale: [189,539,96,405],
			BiMale: [178,309,63,264],
			BiFemale: [450,1133,191,1021]
		},
		TN: {
			StraightMale: [2346,3224,374,1721],
			StraightFemale: [472,2494,313,1623],
			GayMale: [126,223,24,96],
			GayFemale: [36,127,27,104],
			BiMale: [54,78,16,70],
			BiFemale: [91,278,67,285]
		},
		SD: {
			StraightMale: [239,347,26,177],
			StraightFemale: [45,264,30,144],
			GayMale: [5,16,1,9],
			GayFemale: [2,10,2,9],
			BiMale: [2,6,2,12],
			BiFemale: [8,35,4,27]
		},
		SC: {
			StraightMale: [1392,2012,228,989],
			StraightFemale: [236,1596,214,875],
			GayMale: [73,113,8,51],
			GayFemale: [29,79,12,59],
			BiMale: [25,45,6,34],
			BiFemale: [54,147,34,149]
		},
		RI: {
			StraightMale: [684,856,85,400],
			StraightFemale: [161,852,82,376],
			GayMale: [61,93,11,35],
			GayFemale: [28,62,4,40],
			BiMale: [19,16,5,19],
			BiFemale: [51,107,13,93]
		},
		PR: {
			StraightMale: [55,98,13,61],
			StraightFemale: [21,93,12,64],
			GayMale: [8,13,3,2],
			GayFemale: [1,3,0,1],
			BiMale: [1,2,1,4],
			BiFemale: [2,5,2,11]
		},
		PA: {
			StraightMale: [6813,8781,933,4261],
			StraightFemale: [1599,7488,827,3791],
			GayMale: [417,620,65,264],
			GayFemale: [173,392,55,302],
			BiMale: [138,163,37,209],
			BiFemale: [349,893,153,766]
		},
		OR: {
			StraightMale: [3551,4357,464,2106],
			StraightFemale: [881,3624,398,1931],
			GayMale: [205,320,37,115],
			GayFemale: [80,253,67,220],
			BiMale: [91,144,31,138],
			BiFemale: [276,597,112,607]
		},
		OK: {
			StraightMale: [1901,2740,364,1444],
			StraightFemale: [298,1986,320,1271],
			GayMale: [92,158,13,73],
			GayFemale: [24,88,26,72],
			BiMale: [33,65,14,56],
			BiFemale: [64,241,51,222]
		},
		OH: {
			StraightMale: [5923,7916,838,3882],
			StraightFemale: [1048,6004,844,3529],
			GayMale: [312,536,43,221],
			GayFemale: [123,247,60,238],
			BiMale: [127,155,32,173],
			BiFemale: [259,680,139,727]
		},
		NY: {
			StraightMale: [12509,13292,1514,6671],
			StraightFemale: [4336,14112,1143,5857],
			GayMale: [1232,1661,133,605],
			GayFemale: [390,708,129,559],
			BiMale: [246,331,47,289],
			BiFemale: [737,1414,205,1145]
		},
		NV: {
			StraightMale: [1455,1711,213,900],
			StraightFemale: [238,1274,145,648],
			GayMale: [52,110,6,34],
			GayFemale: [17,44,7,44],
			BiMale: [27,50,4,30],
			BiFemale: [66,180,33,144]
		},
		NM: {
			StraightMale: [827,1048,142,572],
			StraightFemale: [161,804,128,451],
			GayMale: [50,85,7,31],
			GayFemale: [14,41,7,25],
			BiMale: [22,35,3,41],
			BiFemale: [37,115,20,131]
		},
		NJ: {
			StraightMale: [4066,4996,603,2465],
			StraightFemale: [932,4294,478,1785],
			GayMale: [225,344,33,129],
			GayFemale: [84,199,35,135],
			BiMale: [72,85,24,81],
			BiFemale: [142,359,57,358]
		},
		NH: {
			StraightMale: [966,1235,120,547],
			StraightFemale: [180,1103,121,530],
			GayMale: [53,74,11,20],
			GayFemale: [13,54,7,36],
			BiMale: [20,25,2,22],
			BiFemale: [55,141,22,115]
		},
		NE: {
			StraightMale: [762,1081,123,529],
			StraightFemale: [133,742,112,451],
			GayMale: [29,51,4,21],
			GayFemale: [15,35,3,25],
			BiMale: [13,25,5,29],
			BiFemale: [34,84,16,104]
		},
		ND: {
			StraightMale: [258,406,19,201],
			StraightFemale: [30,221,33,158],
			GayMale: [4,5,1,5],
			GayFemale: [2,13,1,3],
			BiMale: [7,9,2,4],
			BiFemale: [1,31,3,29]
		},
		NC: {
			StraightMale: [3780,5072,504,2487],
			StraightFemale: [797,4476,493,2198],
			GayMale: [224,350,29,125],
			GayFemale: [84,207,53,165],
			BiMale: [66,105,24,112],
			BiFemale: [162,475,87,443]
		},
		MT: {
			StraightMale: [390,490,46,273],
			StraightFemale: [67,369,48,244],
			GayMale: [13,17,0,4],
			GayFemale: [7,15,1,15],
			BiMale: [9,10,2,11],
			BiFemale: [11,47,5,46]
		},
		MS: {
			StraightMale: [557,837,88,447],
			StraightFemale: [108,598,78,395],
			GayMale: [18,47,5,25],
			GayFemale: [7,25,7,23],
			BiMale: [12,14,4,15],
			BiFemale: [23,80,9,73]
		},
		MO: {
			StraightMale: [3045,3915,440,2008],
			StraightFemale: [595,3236,415,1953],
			GayMale: [157,252,21,96],
			GayFemale: [51,155,34,129],
			BiMale: [63,103,15,91],
			BiFemale: [118,361,101,359]
		},
		MN: {
			StraightMale: [3525,4441,397,1828],
			StraightFemale: [673,3522,400,1693],
			GayMale: [179,278,21,99],
			GayFemale: [52,160,41,140],
			BiMale: [53,95,24,92],
			BiFemale: [162,446,94,357]
		},
		MI: {
			StraightMale: [5288,6877,663,3296],
			StraightFemale: [1072,5587,766,3301],
			GayMale: [275,479,39,194],
			GayFemale: [87,255,47,197],
			BiMale: [108,160,29,147],
			BiFemale: [224,628,141,600]
		},
		ME: {
			StraightMale: [666,874,111,484],
			StraightFemale: [151,827,111,529],
			GayMale: [43,57,4,23],
			GayFemale: [16,53,12,53],
			BiMale: [17,24,3,26],
			BiFemale: [57,112,19,116]
		},
		MD: {
			StraightMale: [3352,4166,451,1975],
			StraightFemale: [777,3349,364,1625],
			GayMale: [198,320,44,115],
			GayFemale: [77,185,33,159],
			BiMale: [53,97,19,90],
			BiFemale: [166,432,78,386]
		},
		MA: {
			StraightMale: [6654,6940,759,3146],
			StraightFemale: [2041,7783,756,3117],
			GayMale: [540,782,57,234],
			GayFemale: [177,517,91,351],
			BiMale: [150,191,33,167],
			BiFemale: [407,925,139,794]
		},
		LA: {
			StraightMale: [1328,1864,219,892],
			StraightFemale: [290,1483,180,888],
			GayMale: [70,130,17,62],
			GayFemale: [26,73,24,55],
			BiMale: [46,35,9,37],
			BiFemale: [85,165,47,154]
		},
		KY: {
			StraightMale: [1500,2262,212,1185],
			StraightFemale: [291,1712,217,1047],
			GayMale: [83,134,15,76],
			GayFemale: [20,58,9,65],
			BiMale: [34,42,8,34],
			BiFemale: [73,193,48,216]
		},
		KS: {
			StraightMale: [1358,1903,207,903],
			StraightFemale: [228,1369,182,779],
			GayMale: [40,111,4,35],
			GayFemale: [20,50,21,48],
			BiMale: [21,32,8,40],
			BiFemale: [57,155,39,160]
		},
		IN: {
			StraightMale: [2834,4038,449,2044],
			StraightFemale: [524,3219,427,1950],
			GayMale: [163,284,27,107],
			GayFemale: [52,125,39,138],
			BiMale: [64,87,25,87],
			BiFemale: [123,355,107,353]
		},
		IL: {
			StraightMale: [6989,8894,926,4287],
			StraightFemale: [1741,7509,808,3781],
			GayMale: [467,787,77,276],
			GayFemale: [139,389,56,254],
			BiMale: [148,225,28,182],
			BiFemale: [319,793,130,705]
		},
		ID: {
			StraightMale: [613,897,90,427],
			StraightFemale: [106,665,81,378],
			GayMale: [20,43,2,23],
			GayFemale: [4,25,4,15],
			BiMale: [8,17,3,18],
			BiFemale: [18,79,8,73]
		},
		IA: {
			StraightMale: [1244,1798,177,841],
			StraightFemale: [224,1410,184,852],
			GayMale: [48,107,12,36],
			GayFemale: [22,32,17,62],
			BiMale: [23,40,7,24],
			BiFemale: [58,164,23,162]
		},
		HI: {
			StraightMale: [539,562,50,246],
			StraightFemale: [76,392,23,171],
			GayMale: [27,45,7,15],
			GayFemale: [3,18,2,12],
			BiMale: [12,19,0,10],
			BiFemale: [15,44,8,29]
		},
		GU: {
			StraightMale: [4,17,3,5],
			StraightFemale: [4,12,0,11],
			GayMale: [0,1,0,0],
			GayFemale: [1,2,0,1],
			BiMale: [1,0,0,0],
			BiFemale: [1,0,0,3]
		},
		GA: {
			StraightMale: [4208,5728,640,2816],
			StraightFemale: [920,4733,531,2372],
			GayMale: [229,402,27,186],
			GayFemale: [87,242,39,184],
			BiMale: [98,150,20,96],
			BiFemale: [185,474,80,455]
		},
		FM: {
			StraightMale: [1,0,0,0],
			BiFemale: [0,1,0,0]
		},
		FL: {
			StraightMale: [8966,10987,1289,5652],
			StraightFemale: [1839,8949,1066,4424],
			GayMale: [451,795,72,316],
			GayFemale: [183,432,64,337],
			BiMale: [172,242,35,199],
			BiFemale: [410,1070,157,841]
		},
		DE: {
			StraightMale: [405,544,60,284],
			StraightFemale: [62,484,55,220],
			GayMale: [27,37,6,15],
			GayFemale: [5,20,6,20],
			BiMale: [8,13,1,8],
			BiFemale: [27,53,10,41]
		},
		DC: {
			StraightMale: [1008,692,81,285],
			StraightFemale: [438,1195,59,406],
			GayMale: [160,179,11,44],
			GayFemale: [31,70,6,44],
			BiMale: [30,23,2,13],
			BiFemale: [55,123,11,74]
		},
		CT: {
			StraightMale: [1927,2294,260,1086],
			StraightFemale: [423,2065,226,943],
			GayMale: [110,165,14,75],
			GayFemale: [43,111,9,90],
			BiMale: [35,55,8,45],
			BiFemale: [88,202,42,224]
		},
		CO: {
			StraightMale: [3744,4255,415,1884],
			StraightFemale: [695,3214,318,1463],
			GayMale: [131,207,21,99],
			GayFemale: [41,138,14,98],
			BiMale: [58,93,20,104],
			BiFemale: [152,410,78,375]
		},
		CA: {
			StraightMale: [25746,25867,2881,12755],
			StraightFemale: [6514,22975,2018,9525],
			GayMale: [1702,2599,221,909],
			GayFemale: [635,1378,214,944],
			BiMale: [502,664,111,597],
			BiFemale: [1253,2625,418,2272]
		},
		AZ: {
			StraightMale: [3801,4415,456,2203],
			StraightFemale: [699,3602,434,1669],
			GayMale: [173,280,25,126],
			GayFemale: [49,179,41,126],
			BiMale: [73,110,16,78],
			BiFemale: [146,426,82,334]
		},
		AS: {
			StraightMale: [1,1,0,1]
		},
		AR: {
			StraightMale: [787,1180,141,707],
			StraightFemale: [126,940,141,688],
			GayMale: [38,83,7,25],
			GayFemale: [15,40,9,43],
			BiMale: [19,24,7,30],
			BiFemale: [43,105,17,115]
		},
		AL: {
			StraightMale: [1290,1880,253,1129],
			StraightFemale: [251,1467,188,959],
			GayMale: [73,102,11,50],
			GayFemale: [14,61,18,58],
			BiMale: [38,47,4,45],
			BiFemale: [47,178,31,155]
		},
		AK: {
			StraightMale: [350,496,62,224],
			StraightFemale: [65,372,48,223],
			GayMale: [11,14,3,8],
			GayFemale: [8,17,5,17],
			BiMale: [5,14,3,14],
			BiFemale: [16,51,7,50]
		}

	},
	{
		question: 'Do you ever feel the need to get really drunk?',
		answers: ["Often","Sometimes","Rarely","Never"],
		WY: {
			StraightMale: [13,172,217,146],
			StraightFemale: [9,111,115,90],
			GayMale: [1,5,7,1],
			GayFemale: [1,2,8,4],
			BiMale: [0,5,2,7],
			BiFemale: [4,19,17,3]
		},
		WV: {
			StraightMale: [41,424,518,459],
			StraightFemale: [34,351,364,322],
			GayMale: [2,34,25,19],
			GayFemale: [1,22,18,9],
			BiMale: [2,11,19,18],
			BiFemale: [10,73,55,22]
		},
		WI: {
			StraightMale: [163,2196,2793,2080],
			StraightFemale: [100,1512,1828,1121],
			GayMale: [7,127,130,97],
			GayFemale: [4,84,115,62],
			BiMale: [4,62,84,49],
			BiFemale: [40,280,297,145]
		},
		WA: {
			StraightMale: [326,4025,5828,4416],
			StraightFemale: [222,2544,3587,2390],
			GayMale: [31,298,396,276],
			GayFemale: [26,206,293,181],
			BiMale: [15,136,211,148],
			BiFemale: [79,622,754,430]
		},
		VT: {
			StraightMale: [25,243,312,274],
			StraightFemale: [17,188,230,174],
			GayMale: [2,16,20,18],
			GayFemale: [1,12,15,17],
			BiMale: [1,6,18,13],
			BiFemale: [8,52,67,32]
		},
		VI: {
			StraightMale: [0,2,5,9],
			StraightFemale: [0,5,6,3],
			BiFemale: [0,0,1,0]
		},
		VA: {
			StraightMale: [257,3001,4171,3179],
			StraightFemale: [145,1955,2304,1745],
			GayMale: [21,198,248,180],
			GayFemale: [10,126,133,111],
			BiMale: [9,73,94,94],
			BiFemale: [42,376,354,230]
		},
		UT: {
			StraightMale: [62,753,965,1003],
			StraightFemale: [26,433,513,492],
			GayMale: [7,34,71,56],
			GayFemale: [3,35,30,17],
			BiMale: [0,21,33,20],
			BiFemale: [16,89,98,58]
		},
		TX: {
			StraightMale: [583,6980,9648,7628],
			StraightFemale: [366,4978,5982,4415],
			GayMale: [43,455,573,401],
			GayFemale: [30,302,365,203],
			BiMale: [22,189,232,182],
			BiFemale: [106,846,830,386]
		},
		TN: {
			StraightMale: [143,1576,2317,1942],
			StraightFemale: [91,1188,1453,1164],
			GayMale: [13,102,136,101],
			GayFemale: [12,82,69,54],
			BiMale: [4,52,59,55],
			BiFemale: [43,217,195,119]
		},
		SD: {
			StraightMale: [12,174,246,187],
			StraightFemale: [9,116,157,89],
			GayMale: [1,13,6,5],
			GayFemale: [1,4,10,2],
			BiMale: [0,4,6,4],
			BiFemale: [1,16,25,11]
		},
		SC: {
			StraightMale: [84,918,1372,1055],
			StraightFemale: [59,616,925,714],
			GayMale: [4,56,60,56],
			GayFemale: [2,57,56,27],
			BiMale: [1,21,29,22],
			BiFemale: [15,130,108,55]
		},
		RI: {
			StraightMale: [40,470,594,526],
			StraightFemale: [23,381,432,288],
			GayMale: [4,40,55,52],
			GayFemale: [1,38,36,26],
			BiMale: [0,13,21,10],
			BiFemale: [11,80,76,39]
		},
		PR: {
			StraightMale: [1,36,57,65],
			StraightFemale: [3,39,45,56],
			GayMale: [0,5,9,7],
			GayFemale: [0,1,1,2],
			BiMale: [0,1,1,2],
			BiFemale: [0,4,4,4]
		},
		PA: {
			StraightMale: [444,5109,6135,4636],
			StraightFemale: [316,3749,4091,2758],
			GayMale: [42,350,378,259],
			GayFemale: [23,269,270,165],
			BiMale: [21,138,158,121],
			BiFemale: [77,671,622,303]
		},
		OR: {
			StraightMale: [201,2374,3299,2434],
			StraightFemale: [143,1658,2229,1412],
			GayMale: [10,189,178,134],
			GayFemale: [10,181,197,111],
			BiMale: [13,93,153,77],
			BiFemale: [58,475,536,271]
		},
		OK: {
			StraightMale: [110,1346,1967,1521],
			StraightFemale: [65,911,1158,885],
			GayMale: [10,81,89,63],
			GayFemale: [4,61,65,34],
			BiMale: [2,28,60,39],
			BiFemale: [22,162,172,81]
		},
		OH: {
			StraightMale: [342,4214,5579,4157],
			StraightFemale: [237,2997,3489,2403],
			GayMale: [26,307,316,186],
			GayFemale: [21,173,213,122],
			BiMale: [14,135,131,89],
			BiFemale: [58,531,576,271]
		},
		NY: {
			StraightMale: [727,8371,9697,7417],
			StraightFemale: [607,7049,7233,4484],
			GayMale: [111,960,935,610],
			GayFemale: [51,513,553,283],
			BiMale: [19,248,246,223],
			BiFemale: [158,1084,1027,555]
		},
		NV: {
			StraightMale: [68,896,1311,1022],
			StraightFemale: [57,530,691,497],
			GayMale: [4,41,43,49],
			GayFemale: [3,36,33,17],
			BiMale: [2,27,41,16],
			BiFemale: [15,137,118,60]
		},
		NM: {
			StraightMale: [41,518,821,658],
			StraightFemale: [27,362,471,352],
			GayMale: [1,36,57,42],
			GayFemale: [1,21,26,22],
			BiMale: [1,30,36,17],
			BiFemale: [7,79,107,55]
		},
		NJ: {
			StraightMale: [219,2685,3605,2862],
			StraightFemale: [158,1991,2069,1570],
			GayMale: [19,190,203,147],
			GayFemale: [14,105,133,78],
			BiMale: [7,63,67,60],
			BiFemale: [48,272,266,143]
		},
		NH: {
			StraightMale: [45,629,872,718],
			StraightFemale: [27,446,593,424],
			GayMale: [3,36,44,31],
			GayFemale: [2,28,29,19],
			BiMale: [2,13,19,20],
			BiFemale: [6,104,81,59]
		},
		NE: {
			StraightMale: [54,580,721,574],
			StraightFemale: [19,363,449,320],
			GayMale: [1,25,26,29],
			GayFemale: [4,24,22,16],
			BiMale: [3,19,22,15],
			BiFemale: [7,80,76,36]
		},
		ND: {
			StraightMale: [14,216,269,192],
			StraightFemale: [5,108,120,90],
			GayMale: [1,5,1,3],
			GayFemale: [0,5,9,1],
			BiMale: [1,3,8,5],
			BiFemale: [1,22,23,8]
		},
		NC: {
			StraightMale: [195,2535,3449,2863],
			StraightFemale: [128,1799,2370,1820],
			GayMale: [13,168,204,147],
			GayFemale: [14,127,149,88],
			BiMale: [10,57,101,72],
			BiFemale: [41,346,371,184]
		},
		MT: {
			StraightMale: [21,252,369,285],
			StraightFemale: [16,173,227,177],
			GayMale: [1,8,6,9],
			GayFemale: [2,12,10,7],
			BiMale: [1,9,10,5],
			BiFemale: [4,31,43,18]
		},
		MS: {
			StraightMale: [38,386,577,486],
			StraightFemale: [18,284,347,295],
			GayMale: [4,22,27,23],
			GayFemale: [3,9,19,12],
			BiMale: [1,8,10,13],
			BiFemale: [8,57,50,20]
		},
		MO: {
			StraightMale: [183,2254,2793,2139],
			StraightFemale: [122,1636,1905,1254],
			GayMale: [11,124,157,112],
			GayFemale: [12,91,118,56],
			BiMale: [9,73,66,67],
			BiFemale: [46,271,298,147]
		},
		MN: {
			StraightMale: [164,2202,3303,2467],
			StraightFemale: [106,1587,2021,1366],
			GayMale: [11,145,174,127],
			GayFemale: [8,104,130,85],
			BiMale: [5,58,101,59],
			BiFemale: [22,311,366,165]
		},
		MI: {
			StraightMale: [289,3725,4874,3717],
			StraightFemale: [222,2718,3407,2193],
			GayMale: [17,237,288,210],
			GayFemale: [10,155,199,98],
			BiMale: [15,91,112,120],
			BiFemale: [65,484,470,251]
		},
		ME: {
			StraightMale: [33,421,657,555],
			StraightFemale: [21,357,469,402],
			GayMale: [1,26,33,35],
			GayFemale: [2,32,40,31],
			BiMale: [1,12,26,19],
			BiFemale: [22,67,102,63]
		},
		MD: {
			StraightMale: [190,2301,3005,2419],
			StraightFemale: [119,1564,1789,1368],
			GayMale: [12,168,212,151],
			GayFemale: [13,128,127,91],
			BiMale: [7,57,83,50],
			BiFemale: [33,354,316,171]
		},
		MA: {
			StraightMale: [393,4147,5357,4057],
			StraightFemale: [277,3648,4150,2692],
			GayMale: [31,418,428,319],
			GayFemale: [27,312,327,251],
			BiMale: [11,134,162,135],
			BiFemale: [73,698,694,438]
		},
		LA: {
			StraightMale: [98,983,1228,977],
			StraightFemale: [64,733,831,589],
			GayMale: [9,75,70,57],
			GayFemale: [5,40,53,37],
			BiMale: [5,32,29,31],
			BiFemale: [20,139,134,59]
		},
		KY: {
			StraightMale: [97,1107,1511,1248],
			StraightFemale: [73,798,915,750],
			GayMale: [7,75,82,70],
			GayFemale: [4,41,43,28],
			BiMale: [7,31,26,29],
			BiFemale: [18,175,144,76]
		},
		KS: {
			StraightMale: [74,1011,1328,1005],
			StraightFemale: [48,670,799,553],
			GayMale: [4,52,52,35],
			GayFemale: [3,45,42,30],
			BiMale: [3,24,32,26],
			BiFemale: [16,153,109,68]
		},
		IN: {
			StraightMale: [165,2127,2741,2236],
			StraightFemale: [123,1508,1883,1345],
			GayMale: [10,139,174,107],
			GayFemale: [8,95,113,49],
			BiMale: [4,73,74,55],
			BiFemale: [28,301,281,134]
		},
		IL: {
			StraightMale: [410,5088,6363,4596],
			StraightFemale: [278,3948,4164,2541],
			GayMale: [30,436,454,282],
			GayFemale: [21,257,241,135],
			BiMale: [17,138,161,124],
			BiFemale: [73,621,566,306]
		},
		ID: {
			StraightMale: [28,450,601,508],
			StraightFemale: [18,325,372,263],
			GayMale: [4,32,21,12],
			GayFemale: [1,11,19,7],
			BiMale: [3,14,7,9],
			BiFemale: [6,52,62,22]
		},
		IA: {
			StraightMale: [66,967,1281,882],
			StraightFemale: [39,740,819,532],
			GayMale: [6,51,58,34],
			GayFemale: [8,26,35,34],
			BiMale: [3,23,23,21],
			BiFemale: [10,131,128,75]
		},
		HI: {
			StraightMale: [23,256,429,385],
			StraightFemale: [9,151,204,166],
			GayMale: [1,29,25,20],
			GayFemale: [0,5,18,5],
			BiMale: [1,7,12,8],
			BiFemale: [3,27,26,15]
		},
		GU: {
			StraightMale: [0,10,5,6],
			StraightFemale: [1,4,6,7],
			GayMale: [0,0,1,0],
			GayFemale: [1,0,1,1],
			BiMale: [0,0,0,1],
			BiFemale: [0,1,0,1]
		},
		GA: {
			StraightMale: [222,2924,3921,3113],
			StraightFemale: [139,2027,2533,1949],
			GayMale: [19,172,225,190],
			GayFemale: [6,148,182,90],
			BiMale: [14,74,104,77],
			BiFemale: [37,350,357,169]
		},
		FM: {
			StraightMale: [0,1,0,0],
			BiFemale: [0,1,0,0]
		},
		FL: {
			StraightMale: [426,5493,7658,6783],
			StraightFemale: [277,3589,4814,3949],
			GayMale: [39,332,443,372],
			GayFemale: [19,236,277,222],
			BiMale: [23,134,189,153],
			BiFemale: [94,754,694,406]
		},
		DE: {
			StraightMale: [13,255,426,302],
			StraightFemale: [8,217,261,177],
			GayMale: [2,18,25,20],
			GayFemale: [0,16,15,9],
			BiMale: [0,8,9,10],
			BiFemale: [5,49,29,21]
		},
		DC: {
			StraightMale: [38,569,612,404],
			StraightFemale: [40,579,658,318],
			GayMale: [12,123,96,58],
			GayFemale: [5,48,34,29],
			BiMale: [3,17,16,15],
			BiFemale: [7,79,81,41]
		},
		CT: {
			StraightMale: [83,1269,1680,1395],
			StraightFemale: [60,901,1105,852],
			GayMale: [13,84,100,86],
			GayFemale: [7,58,65,55],
			BiMale: [6,37,46,20],
			BiFemale: [13,172,167,96]
		},
		CO: {
			StraightMale: [171,2236,3291,2448],
			StraightFemale: [102,1399,1876,1198],
			GayMale: [11,116,139,91],
			GayFemale: [4,83,91,50],
			BiMale: [8,59,92,64],
			BiFemale: [40,276,343,181]
		},
		CA: {
			StraightMale: [1180,14519,20287,16259],
			StraightFemale: [776,9901,12383,9118],
			GayMale: [112,1327,1491,1181],
			GayFemale: [64,785,970,623],
			BiMale: [35,440,575,458],
			BiFemale: [240,1830,2064,1164]
		},
		AZ: {
			StraightMale: [202,2255,3496,2653],
			StraightFemale: [116,1490,1954,1485],
			GayMale: [10,152,144,136],
			GayFemale: [9,99,115,85],
			BiMale: [7,60,72,76],
			BiFemale: [24,295,316,165]
		},
		AS: {
			StraightMale: [0,0,1,2]
		},
		AR: {
			StraightMale: [51,567,827,699],
			StraightFemale: [33,455,597,406],
			GayMale: [3,33,41,29],
			GayFemale: [6,31,30,11],
			BiMale: [1,25,22,16],
			BiFemale: [12,89,80,48]
		},
		AL: {
			StraightMale: [84,928,1282,1142],
			StraightFemale: [52,692,811,697],
			GayMale: [6,48,60,61],
			GayFemale: [4,49,41,21],
			BiMale: [2,32,39,27],
			BiFemale: [19,114,104,58]
		},
		AK: {
			StraightMale: [16,242,358,276],
			StraightFemale: [17,172,226,150],
			GayMale: [0,6,6,5],
			GayFemale: [2,5,16,11],
			BiMale: [1,12,12,8],
			BiFemale: [8,40,33,23]
		}

	},
	{
		question: 'Do you believe that men should be the heads of their households?',
		answers: ["Yes","No"],
		WY: {
			StraightMale: [177,204],
			StraightFemale: [89,106],
			GayMale: [2,8],
			GayFemale: [0,7],
			BiMale: [2,4],
			BiFemale: [7,21]
		},
		WV: {
			StraightMale: [523,472],
			StraightFemale: [360,372],
			GayMale: [11,33],
			GayFemale: [2,27],
			BiMale: [10,20],
			BiFemale: [33,74]
		},
		WI: {
			StraightMale: [1850,2980],
			StraightFemale: [1003,2131],
			GayMale: [39,185],
			GayFemale: [2,194],
			BiMale: [25,113],
			BiFemale: [100,440]
		},
		WA: {
			StraightMale: [4118,5387],
			StraightFemale: [2180,3701],
			GayMale: [112,489],
			GayFemale: [19,457],
			BiMale: [60,270],
			BiFemale: [193,1023]
		},
		VT: {
			StraightMale: [162,399],
			StraightFemale: [114,330],
			GayMale: [2,27],
			GayFemale: [3,28],
			BiMale: [1,24],
			BiFemale: [18,104]
		},
		VI: {
			StraightMale: [8,4],
			StraightFemale: [6,3],
			GayMale: [0,1],
			BiFemale: [0,0]
		},
		VA: {
			StraightMale: [3376,3570],
			StraightFemale: [1769,2417],
			GayMale: [89,294],
			GayFemale: [14,254],
			BiMale: [44,99],
			BiFemale: [137,542]
		},
		UT: {
			StraightMale: [949,1011],
			StraightFemale: [498,533],
			GayMale: [28,79],
			GayFemale: [2,49],
			BiMale: [18,26],
			BiFemale: [38,141]
		},
		TX: {
			StraightMale: [9266,7763],
			StraightFemale: [5571,5564],
			GayMale: [252,654],
			GayFemale: [45,570],
			BiMale: [112,288],
			BiFemale: [420,1061]
		},
		TN: {
			StraightMale: [2407,1811],
			StraightFemale: [1460,1212],
			GayMale: [59,152],
			GayFemale: [9,140],
			BiMale: [30,71],
			BiFemale: [111,286]
		},
		SD: {
			StraightMale: [173,218],
			StraightFemale: [115,132],
			GayMale: [5,8],
			GayFemale: [0,12],
			BiMale: [1,7],
			BiFemale: [13,26]
		},
		SC: {
			StraightMale: [1377,1012],
			StraightFemale: [898,788],
			GayMale: [32,69],
			GayFemale: [5,95],
			BiMale: [7,40],
			BiFemale: [63,165]
		},
		RI: {
			StraightMale: [430,695],
			StraightFemale: [238,565],
			GayMale: [11,75],
			GayFemale: [0,73],
			BiMale: [8,19],
			BiFemale: [37,123]
		},
		PR: {
			StraightMale: [55,57],
			StraightFemale: [35,57],
			GayMale: [2,9],
			GayFemale: [0,2],
			BiMale: [0,1],
			BiFemale: [1,9]
		},
		PA: {
			StraightMale: [4630,6384],
			StraightFemale: [2612,4962],
			GayMale: [126,495],
			GayFemale: [23,477],
			BiMale: [51,221],
			BiFemale: [207,1009]
		},
		OR: {
			StraightMale: [1909,3465],
			StraightFemale: [1263,2475],
			GayMale: [53,270],
			GayFemale: [13,318],
			BiMale: [28,184],
			BiFemale: [128,818]
		},
		OK: {
			StraightMale: [2077,1437],
			StraightFemale: [1239,911],
			GayMale: [63,89],
			GayFemale: [12,95],
			BiMale: [30,50],
			BiFemale: [95,208]
		},
		OH: {
			StraightMale: [4835,5058],
			StraightFemale: [2710,3606],
			GayMale: [122,362],
			GayFemale: [15,354],
			BiMale: [65,174],
			BiFemale: [241,744]
		},
		NY: {
			StraightMale: [6947,10899],
			StraightFemale: [3899,9982],
			GayMale: [267,1309],
			GayFemale: [16,986],
			BiMale: [106,382],
			BiFemale: [281,1693]
		},
		NV: {
			StraightMale: [1213,1076],
			StraightFemale: [616,671],
			GayMale: [25,60],
			GayFemale: [3,46],
			BiMale: [13,27],
			BiFemale: [61,176]
		},
		NM: {
			StraightMale: [688,798],
			StraightFemale: [326,542],
			GayMale: [21,75],
			GayFemale: [0,42],
			BiMale: [13,42],
			BiFemale: [46,137]
		},
		NJ: {
			StraightMale: [2911,3568],
			StraightFemale: [1469,2669],
			GayMale: [70,282],
			GayFemale: [10,214],
			BiMale: [29,98],
			BiFemale: [103,410]
		},
		NH: {
			StraightMale: [557,964],
			StraightFemale: [346,729],
			GayMale: [17,57],
			GayFemale: [0,56],
			BiMale: [4,21],
			BiFemale: [34,139]
		},
		NE: {
			StraightMale: [616,676],
			StraightFemale: [331,411],
			GayMale: [9,29],
			GayFemale: [5,33],
			BiMale: [5,26],
			BiFemale: [39,93]
		},
		ND: {
			StraightMale: [224,224],
			StraightFemale: [93,121],
			GayMale: [2,4],
			GayFemale: [0,10],
			BiMale: [3,5],
			BiFemale: [7,21]
		},
		NC: {
			StraightMale: [3212,2982],
			StraightFemale: [2047,2248],
			GayMale: [71,255],
			GayFemale: [13,269],
			BiMale: [44,116],
			BiFemale: [154,487]
		},
		MT: {
			StraightMale: [277,345],
			StraightFemale: [194,225],
			GayMale: [6,12],
			GayFemale: [4,19],
			BiMale: [5,13],
			BiFemale: [15,46]
		},
		MS: {
			StraightMale: [659,356],
			StraightFemale: [393,233],
			GayMale: [16,30],
			GayFemale: [5,22],
			BiMale: [12,16],
			BiFemale: [27,56]
		},
		MO: {
			StraightMale: [2357,2524],
			StraightFemale: [1475,1858],
			GayMale: [53,178],
			GayFemale: [8,191],
			BiMale: [32,101],
			BiFemale: [117,372]
		},
		MN: {
			StraightMale: [1985,3371],
			StraightFemale: [1036,2435],
			GayMale: [38,235],
			GayFemale: [6,206],
			BiMale: [25,113],
			BiFemale: [86,517]
		},
		MI: {
			StraightMale: [3890,4541],
			StraightFemale: [2364,3562],
			GayMale: [87,330],
			GayFemale: [11,297],
			BiMale: [63,170],
			BiFemale: [186,706]
		},
		ME: {
			StraightMale: [374,730],
			StraightFemale: [249,618],
			GayMale: [9,48],
			GayFemale: [2,66],
			BiMale: [5,21],
			BiFemale: [32,147]
		},
		MD: {
			StraightMale: [2327,3022],
			StraightFemale: [1228,2089],
			GayMale: [52,246],
			GayFemale: [9,240],
			BiMale: [23,93],
			BiFemale: [101,506]
		},
		MA: {
			StraightMale: [3186,6026],
			StraightFemale: [1848,6012],
			GayMale: [133,649],
			GayFemale: [14,681],
			BiMale: [42,229],
			BiFemale: [145,1163]
		},
		LA: {
			StraightMale: [1292,957],
			StraightFemale: [818,729],
			GayMale: [28,89],
			GayFemale: [5,83],
			BiMale: [15,41],
			BiFemale: [70,155]
		},
		KY: {
			StraightMale: [1415,1322],
			StraightFemale: [821,936],
			GayMale: [38,96],
			GayFemale: [2,74],
			BiMale: [9,47],
			BiFemale: [67,231]
		},
		KS: {
			StraightMale: [1093,1150],
			StraightFemale: [634,725],
			GayMale: [24,64],
			GayFemale: [4,70],
			BiMale: [15,37],
			BiFemale: [55,178]
		},
		IN: {
			StraightMale: [2441,2513],
			StraightFemale: [1532,1754],
			GayMale: [59,179],
			GayFemale: [10,159],
			BiMale: [34,87],
			BiFemale: [127,377]
		},
		IL: {
			StraightMale: [4861,6489],
			StraightFemale: [2607,5045],
			GayMale: [134,617],
			GayFemale: [17,497],
			BiMale: [62,236],
			BiFemale: [188,942]
		},
		ID: {
			StraightMale: [530,528],
			StraightFemale: [324,324],
			GayMale: [9,30],
			GayFemale: [3,24],
			BiMale: [8,11],
			BiFemale: [26,66]
		},
		IA: {
			StraightMale: [853,1187],
			StraightFemale: [513,875],
			GayMale: [18,76],
			GayFemale: [3,72],
			BiMale: [13,36],
			BiFemale: [41,188]
		},
		HI: {
			StraightMale: [332,368],
			StraightFemale: [130,216],
			GayMale: [11,36],
			GayFemale: [1,20],
			BiMale: [6,12],
			BiFemale: [9,51]
		},
		GU: {
			StraightMale: [8,5],
			StraightFemale: [5,4],
			GayMale: [0,1],
			GayFemale: [0,2],
			BiMale: [0,0]
		},
		GA: {
			StraightMale: [3965,3156],
			StraightFemale: [2539,2211],
			GayMale: [128,255],
			GayFemale: [17,286],
			BiMale: [54,131],
			BiFemale: [182,446]
		},
		FM: {
			StraightMale: [1,0]
		},
		FL: {
			StraightMale: [7552,6779],
			StraightFemale: [4176,4734],
			GayMale: [211,509],
			GayFemale: [39,502],
			BiMale: [108,220],
			BiFemale: [356,1030]
		},
		DE: {
			StraightMale: [327,389],
			StraightFemale: [180,292],
			GayMale: [16,24],
			GayFemale: [0,23],
			BiMale: [2,11],
			BiFemale: [14,45]
		},
		DC: {
			StraightMale: [358,717],
			StraightFemale: [232,907],
			GayMale: [30,119],
			GayFemale: [3,103],
			BiMale: [6,27],
			BiFemale: [12,143]
		},
		CT: {
			StraightMale: [1198,1784],
			StraightFemale: [706,1366],
			GayMale: [40,150],
			GayFemale: [10,129],
			BiMale: [10,57],
			BiFemale: [47,257]
		},
		CO: {
			StraightMale: [2397,3248],
			StraightFemale: [1223,1975],
			GayMale: [46,169],
			GayFemale: [10,134],
			BiMale: [29,119],
			BiFemale: [125,440]
		},
		CA: {
			StraightMale: [15928,19524],
			StraightFemale: [8261,14300],
			GayMale: [500,2041],
			GayFemale: [73,1733],
			BiMale: [182,748],
			BiFemale: [666,3000]
		},
		AZ: {
			StraightMale: [2908,3091],
			StraightFemale: [1526,2059],
			GayMale: [71,197],
			GayFemale: [11,200],
			BiMale: [41,88],
			BiFemale: [128,419]
		},
		AS: {
			StraightMale: [0,2]
		},
		AR: {
			StraightMale: [901,558],
			StraightFemale: [604,384],
			GayMale: [17,42],
			GayFemale: [4,35],
			BiMale: [12,31],
			BiFemale: [45,108]
		},
		AL: {
			StraightMale: [1494,932],
			StraightFemale: [940,650],
			GayMale: [26,76],
			GayFemale: [7,78],
			BiMale: [32,32],
			BiFemale: [72,146]
		},
		AK: {
			StraightMale: [258,278],
			StraightFemale: [166,186],
			GayMale: [4,12],
			GayFemale: [2,16],
			BiMale: [3,13],
			BiFemale: [17,52]
		}

	},
	{
		question: 'How often do you keep your promises?',
		answers: ["My word is my bond.  No exceptions.","Whenever possible","Usually","When convenient"],
		WY: {
			StraightMale: [538,441,30,6],
			StraightFemale: [258,292,22,4],
			GayMale: [16,15,5,2],
			GayFemale: [13,7,0,0],
			BiMale: [8,25,1,0],
			BiFemale: [40,40,4,1]
		},
		WV: {
			StraightMale: [1741,1232,126,18],
			StraightFemale: [1052,994,110,11],
			GayMale: [77,71,16,0],
			GayFemale: [49,40,5,1],
			BiMale: [47,43,5,1],
			BiFemale: [134,135,19,7]
		},
		WI: {
			StraightMale: [6706,6460,633,71],
			StraightFemale: [3332,5076,544,51],
			GayMale: [289,406,59,9],
			GayFemale: [201,267,23,6],
			BiMale: [157,222,34,2],
			BiFemale: [421,723,92,15]
		},
		WA: {
			StraightMale: [12670,12319,1022,145],
			StraightFemale: [6506,8786,916,96],
			GayMale: [708,949,90,7],
			GayFemale: [493,655,57,5],
			BiMale: [304,461,43,18],
			BiFemale: [986,1752,161,34]
		},
		VT: {
			StraightMale: [849,796,81,8],
			StraightFemale: [490,676,61,11],
			GayMale: [48,55,5,1],
			GayFemale: [43,58,3,1],
			BiMale: [33,51,3,0],
			BiFemale: [96,161,19,3]
		},
		VI: {
			StraightMale: [23,15,2,0],
			StraightFemale: [11,7,2,0],
			GayMale: [0,1,0,0],
			GayFemale: [1,0,0,0],
			BiMale: [0,1,0,0],
			BiFemale: [3,1,0,0]
		},
		VA: {
			StraightMale: [11264,8895,1048,133],
			StraightFemale: [5608,6486,799,89],
			GayMale: [522,568,69,11],
			GayFemale: [370,378,56,7],
			BiMale: [213,271,25,15],
			BiFemale: [741,970,111,30]
		},
		UT: {
			StraightMale: [2896,2457,242,28],
			StraightFemale: [1237,1533,171,25],
			GayMale: [119,145,21,1],
			GayFemale: [84,104,8,1],
			BiMale: [45,70,5,3],
			BiFemale: [166,300,31,10]
		},
		TX: {
			StraightMale: [28077,21069,2621,318],
			StraightFemale: [15042,15836,2169,216],
			GayMale: [1412,1583,217,28],
			GayFemale: [976,918,112,19],
			BiMale: [636,635,83,24],
			BiFemale: [1762,2306,315,87]
		},
		TN: {
			StraightMale: [6943,4837,517,59],
			StraightFemale: [3799,3636,436,47],
			GayMale: [328,385,47,10],
			GayFemale: [270,181,15,6],
			BiMale: [167,155,21,11],
			BiFemale: [503,546,69,10]
		},
		SD: {
			StraightMale: [614,579,73,12],
			StraightFemale: [315,406,56,4],
			GayMale: [12,26,4,1],
			GayFemale: [11,14,3,0],
			BiMale: [12,19,0,2],
			BiFemale: [51,67,9,1]
		},
		SC: {
			StraightMale: [4424,2962,300,49],
			StraightFemale: [2355,2403,292,20],
			GayMale: [181,172,22,2],
			GayFemale: [153,131,23,7],
			BiMale: [79,87,13,2],
			BiFemale: [267,307,34,12]
		},
		RI: {
			StraightMale: [1800,1353,179,22],
			StraightFemale: [991,1301,157,26],
			GayMale: [108,162,19,3],
			GayFemale: [115,100,8,0],
			BiMale: [40,50,7,0],
			BiFemale: [174,199,22,2]
		},
		PR: {
			StraightMale: [250,143,42,13],
			StraightFemale: [154,172,89,24],
			GayMale: [15,24,7,1],
			GayFemale: [5,3,1,2],
			BiMale: [4,10,1,0],
			BiFemale: [13,24,4,1]
		},
		PA: {
			StraightMale: [17494,14168,1609,181],
			StraightFemale: [9204,11753,1481,138],
			GayMale: [858,1176,136,18],
			GayFemale: [648,753,82,5],
			BiMale: [368,444,47,15],
			BiFemale: [1229,1744,195,48]
		},
		OR: {
			StraightMale: [7266,7101,614,81],
			StraightFemale: [3745,5747,540,58],
			GayMale: [378,549,63,3],
			GayFemale: [367,525,46,4],
			BiMale: [221,316,27,9],
			BiFemale: [629,1288,129,24]
		},
		OK: {
			StraightMale: [5654,4052,424,70],
			StraightFemale: [2902,2811,361,22],
			GayMale: [225,242,24,5],
			GayFemale: [172,124,18,1],
			BiMale: [131,118,19,5],
			BiFemale: [379,438,51,16]
		},
		OH: {
			StraightMale: [15822,12217,1333,146],
			StraightFemale: [8031,9292,1158,93],
			GayMale: [685,871,114,13],
			GayFemale: [541,496,55,7],
			BiMale: [358,393,39,14],
			BiFemale: [1059,1457,184,29]
		},
		NY: {
			StraightMale: [30412,25705,3814,511],
			StraightFemale: [18737,25623,4079,509],
			GayMale: [2302,3191,478,54],
			GayFemale: [1396,1630,271,29],
			BiMale: [624,834,129,41],
			BiFemale: [2160,3147,497,128]
		},
		NV: {
			StraightMale: [3959,2572,266,38],
			StraightFemale: [1798,1749,217,33],
			GayMale: [141,166,19,2],
			GayFemale: [97,81,12,4],
			BiMale: [90,71,12,3],
			BiFemale: [310,290,48,12]
		},
		NM: {
			StraightMale: [2134,1643,168,27],
			StraightFemale: [1068,1197,157,9],
			GayMale: [102,122,10,0],
			GayFemale: [66,69,4,0],
			BiMale: [58,75,14,3],
			BiFemale: [138,253,34,7]
		},
		NJ: {
			StraightMale: [10632,8251,1090,108],
			StraightFemale: [5842,6739,902,89],
			GayMale: [520,577,67,5],
			GayFemale: [388,347,52,3],
			BiMale: [195,221,37,6],
			BiFemale: [589,733,113,32]
		},
		NH: {
			StraightMale: [2278,1869,164,20],
			StraightFemale: [1359,1567,153,13],
			GayMale: [116,113,10,3],
			GayFemale: [78,97,4,0],
			BiMale: [55,59,3,2],
			BiFemale: [186,253,29,6]
		},
		NE: {
			StraightMale: [1963,1613,179,17],
			StraightFemale: [910,1141,127,11],
			GayMale: [69,75,8,1],
			GayFemale: [41,56,4,2],
			BiMale: [53,41,3,1],
			BiFemale: [108,191,20,7]
		},
		ND: {
			StraightMale: [648,609,70,6],
			StraightFemale: [279,362,37,3],
			GayMale: [19,25,5,0],
			GayFemale: [20,12,1,0],
			BiMale: [16,16,2,0],
			BiFemale: [27,52,5,2]
		},
		NC: {
			StraightMale: [10906,7747,844,113],
			StraightFemale: [6153,6477,814,82],
			GayMale: [493,598,66,12],
			GayFemale: [419,381,47,5],
			BiMale: [214,244,35,9],
			BiFemale: [756,936,103,30]
		},
		MT: {
			StraightMale: [971,809,74,8],
			StraightFemale: [477,587,52,5],
			GayMale: [34,28,8,0],
			GayFemale: [22,30,4,0],
			BiMale: [12,28,2,1],
			BiFemale: [66,89,11,2]
		},
		MS: {
			StraightMale: [1850,1223,145,19],
			StraightFemale: [1084,874,113,17],
			GayMale: [74,81,11,1],
			GayFemale: [68,46,5,0],
			BiMale: [38,45,3,2],
			BiFemale: [150,145,12,4]
		},
		MP: {
			StraightMale: [0,2,0,0]
		},
		MO: {
			StraightMale: [7556,5889,629,63],
			StraightFemale: [4263,4811,563,47],
			GayMale: [319,429,43,2],
			GayFemale: [270,268,29,1],
			BiMale: [184,202,26,3],
			BiFemale: [524,756,94,15]
		},
		MN: {
			StraightMale: [7157,7216,770,99],
			StraightFemale: [3417,5620,580,71],
			GayMale: [317,511,53,7],
			GayFemale: [247,312,27,4],
			BiMale: [143,230,33,7],
			BiFemale: [461,849,83,12]
		},
		MI: {
			StraightMale: [12824,10929,1130,110],
			StraightFemale: [7005,8616,980,87],
			GayMale: [558,767,113,15],
			GayFemale: [397,464,51,5],
			BiMale: [294,353,46,13],
			BiFemale: [873,1301,151,39]
		},
		ME: {
			StraightMale: [1655,1511,137,19],
			StraightFemale: [1057,1335,144,6],
			GayMale: [82,98,11,0],
			GayFemale: [79,98,8,1],
			BiMale: [51,46,9,3],
			BiFemale: [166,255,16,7]
		},
		MD: {
			StraightMale: [8122,6687,753,80],
			StraightFemale: [4040,5474,693,58],
			GayMale: [393,498,63,7],
			GayFemale: [334,337,44,5],
			BiMale: [160,198,34,8],
			BiFemale: [634,785,116,23]
		},
		MA: {
			StraightMale: [13785,12695,1400,157],
			StraightFemale: [8639,13410,1442,142],
			GayMale: [978,1438,177,23],
			GayFemale: [735,1110,118,15],
			BiMale: [308,448,52,14],
			BiFemale: [1064,1931,217,48]
		},
		LA: {
			StraightMale: [3920,2781,328,42],
			StraightFemale: [2115,2139,294,31],
			GayMale: [197,224,25,3],
			GayFemale: [164,128,18,1],
			BiMale: [80,91,7,6],
			BiFemale: [259,331,43,13]
		},
		KY: {
			StraightMale: [4541,3294,341,40],
			StraightFemale: [2509,2438,379,38],
			GayMale: [204,252,25,5],
			GayFemale: [129,106,12,1],
			BiMale: [116,83,14,5],
			BiFemale: [305,431,50,11]
		},
		KS: {
			StraightMale: [3490,2754,271,32],
			StraightFemale: [1659,1999,217,21],
			GayMale: [135,165,15,4],
			GayFemale: [91,91,12,2],
			BiMale: [63,86,8,4],
			BiFemale: [226,305,38,9]
		},
		IN: {
			StraightMale: [7924,6082,630,75],
			StraightFemale: [4151,4645,495,62],
			GayMale: [361,431,43,9],
			GayFemale: [284,232,32,1],
			BiMale: [168,219,29,7],
			BiFemale: [538,764,83,24]
		},
		IL: {
			StraightMale: [17066,14660,1711,210],
			StraightFemale: [9161,12208,1592,160],
			GayMale: [961,1368,186,20],
			GayFemale: [643,653,114,12],
			BiMale: [349,461,73,20],
			BiFemale: [1177,1629,218,49]
		},
		ID: {
			StraightMale: [1665,1307,126,22],
			StraightFemale: [852,901,106,11],
			GayMale: [54,70,7,1],
			GayFemale: [44,35,1,1],
			BiMale: [40,40,7,1],
			BiFemale: [96,143,18,2]
		},
		IA: {
			StraightMale: [3113,2823,280,31],
			StraightFemale: [1596,2307,243,27],
			GayMale: [112,190,20,2],
			GayFemale: [72,113,10,1],
			BiMale: [69,75,7,6],
			BiFemale: [209,352,36,11]
		},
		HI: {
			StraightMale: [1159,1043,104,17],
			StraightFemale: [460,601,85,9],
			GayMale: [54,71,12,1],
			GayFemale: [31,28,6,0],
			BiMale: [23,27,1,3],
			BiFemale: [57,89,11,3]
		},
		GU: {
			StraightMale: [27,29,2,0],
			StraightFemale: [23,23,5,2],
			GayMale: [1,1,1,0],
			GayFemale: [2,2,0,0],
			BiMale: [2,1,1,0],
			BiFemale: [3,1,1,0]
		},
		GA: {
			StraightMale: [12022,8533,1032,112],
			StraightFemale: [6855,6714,944,106],
			GayMale: [591,619,82,17],
			GayFemale: [458,423,46,8],
			BiMale: [267,279,39,16],
			BiFemale: [807,954,141,32]
		},
		FM: {
			StraightMale: [1,0,0,0],
			StraightFemale: [2,1,0,0],
			GayFemale: [0,1,0,0],
			BiFemale: [1,3,0,0]
		},
		FL: {
			StraightMale: [26257,17187,2012,269],
			StraightFemale: [13593,12718,1704,192],
			GayMale: [1212,1235,136,17],
			GayFemale: [923,680,106,9],
			BiMale: [521,522,80,24],
			BiFemale: [1739,2022,245,54]
		},
		DE: {
			StraightMale: [1065,822,94,12],
			StraightFemale: [621,677,88,4],
			GayMale: [59,70,5,1],
			GayFemale: [34,32,4,0],
			BiMale: [22,20,3,0],
			BiFemale: [84,95,15,6]
		},
		DC: {
			StraightMale: [1637,1769,227,24],
			StraightFemale: [1281,2308,313,28],
			GayMale: [232,340,42,5],
			GayFemale: [94,182,20,1],
			BiMale: [46,70,8,0],
			BiFemale: [124,257,38,10]
		},
		CT: {
			StraightMale: [4850,3822,450,57],
			StraightFemale: [2701,3133,384,34],
			GayMale: [243,318,34,2],
			GayFemale: [235,184,20,4],
			BiMale: [98,123,18,4],
			BiFemale: [349,419,50,19]
		},
		CO: {
			StraightMale: [8167,6504,593,63],
			StraightFemale: [3875,4594,487,59],
			GayMale: [297,342,39,5],
			GayFemale: [222,243,21,3],
			BiMale: [179,196,34,8],
			BiFemale: [536,782,71,29]
		},
		CA: {
			StraightMale: [55476,46807,5320,744],
			StraightFemale: [28334,36112,4980,567],
			GayMale: [3554,4406,587,75],
			GayFemale: [2360,2650,355,37],
			BiMale: [1221,1524,184,66],
			BiFemale: [3491,5568,724,153]
		},
		AZ: {
			StraightMale: [9273,6739,637,79],
			StraightFemale: [4604,4897,514,54],
			GayMale: [429,446,49,2],
			GayFemale: [296,290,27,6],
			BiMale: [193,180,31,10],
			BiFemale: [594,767,70,28]
		},
		AS: {
			StraightMale: [1,2,0,0],
			StraightFemale: [0,0,1,0]
		},
		AR: {
			StraightMale: [2451,1733,201,29],
			StraightFemale: [1401,1365,173,21],
			GayMale: [91,126,16,1],
			GayFemale: [98,66,9,1],
			BiMale: [63,67,5,1],
			BiFemale: [179,216,19,8]
		},
		AL: {
			StraightMale: [4170,2827,324,35],
			StraightFemale: [2347,2238,316,34],
			GayMale: [207,169,24,5],
			GayFemale: [134,135,16,1],
			BiMale: [95,110,16,7],
			BiFemale: [310,344,36,13]
		},
		AK: {
			StraightMale: [825,708,66,12],
			StraightFemale: [457,487,60,9],
			GayMale: [23,37,1,3],
			GayFemale: [21,32,2,1],
			BiMale: [22,23,3,2],
			BiFemale: [52,110,9,2]
		}

	},
	{
		question: 'Are you annoyed by people who are super logical?',
		answers: ["Yes","No"],
		WY: {
			StraightMale: [108,382],
			StraightFemale: [92,185],
			GayMale: [4,7],
			GayFemale: [2,14],
			BiMale: [5,12],
			BiFemale: [16,19]
		},
		WV: {
			StraightMale: [292,1044],
			StraightFemale: [310,618],
			GayMale: [28,49],
			GayFemale: [15,29],
			BiMale: [13,31],
			BiFemale: [48,92]
		},
		WI: {
			StraightMale: [1258,5100],
			StraightFemale: [1276,2575],
			GayMale: [94,265],
			GayFemale: [69,150],
			BiMale: [39,148],
			BiFemale: [223,450]
		},
		WA: {
			StraightMale: [2519,10885],
			StraightFemale: [2348,5175],
			GayMale: [263,657],
			GayFemale: [141,434],
			BiMale: [105,377],
			BiFemale: [569,1209]
		},
		VT: {
			StraightMale: [174,564],
			StraightFemale: [168,341],
			GayMale: [16,34],
			GayFemale: [9,25],
			BiMale: [5,34],
			BiFemale: [39,102]
		},
		VI: {
			StraightMale: [5,14],
			StraightFemale: [5,9],
			BiFemale: [1,0]
		},
		VA: {
			StraightMale: [1944,7516],
			StraightFemale: [1590,3578],
			GayMale: [182,414],
			GayFemale: [73,216],
			BiMale: [59,219],
			BiFemale: [291,611]
		},
		UT: {
			StraightMale: [500,1999],
			StraightFemale: [406,858],
			GayMale: [53,109],
			GayFemale: [21,50],
			BiMale: [14,52],
			BiFemale: [61,176]
		},
		TX: {
			StraightMale: [4156,17871],
			StraightFemale: [3969,9159],
			GayMale: [407,981],
			GayFemale: [188,533],
			BiMale: [127,429],
			BiFemale: [631,1272]
		},
		TN: {
			StraightMale: [1054,4082],
			StraightFemale: [978,2199],
			GayMale: [96,212],
			GayFemale: [48,141],
			BiMale: [38,120],
			BiFemale: [161,330]
		},
		SD: {
			StraightMale: [125,407],
			StraightFemale: [121,224],
			GayMale: [12,12],
			GayFemale: [4,12],
			BiMale: [2,10],
			BiFemale: [14,34]
		},
		SC: {
			StraightMale: [683,2328],
			StraightFemale: [615,1291],
			GayMale: [41,118],
			GayFemale: [40,71],
			BiMale: [9,60],
			BiFemale: [93,181]
		},
		RI: {
			StraightMale: [286,1106],
			StraightFemale: [279,635],
			GayMale: [57,72],
			GayFemale: [26,55],
			BiMale: [11,27],
			BiFemale: [60,125]
		},
		PR: {
			StraightMale: [35,122],
			StraightFemale: [61,78],
			GayMale: [8,12],
			GayFemale: [0,5],
			BiMale: [1,4],
			BiFemale: [3,12]
		},
		PA: {
			StraightMale: [2778,11139],
			StraightFemale: [2847,6037],
			GayMale: [251,632],
			GayFemale: [161,389],
			BiMale: [94,313],
			BiFemale: [492,1009]
		},
		OR: {
			StraightMale: [1454,5993],
			StraightFemale: [1384,3225],
			GayMale: [125,361],
			GayFemale: [116,293],
			BiMale: [76,225],
			BiFemale: [327,853]
		},
		OK: {
			StraightMale: [883,3345],
			StraightFemale: [833,1640],
			GayMale: [66,160],
			GayFemale: [41,89],
			BiMale: [28,85],
			BiFemale: [119,266]
		},
		OH: {
			StraightMale: [2502,9724],
			StraightFemale: [2521,4936],
			GayMale: [231,508],
			GayFemale: [106,314],
			BiMale: [70,280],
			BiFemale: [401,832]
		},
		NY: {
			StraightMale: [4615,18014],
			StraightFemale: [4834,10503],
			GayMale: [620,1547],
			GayFemale: [328,754],
			BiMale: [157,499],
			BiFemale: [798,1653]
		},
		NV: {
			StraightMale: [535,2355],
			StraightFemale: [474,1059],
			GayMale: [28,115],
			GayFemale: [21,55],
			BiMale: [24,54],
			BiFemale: [107,202]
		},
		NM: {
			StraightMale: [335,1439],
			StraightFemale: [323,711],
			GayMale: [36,84],
			GayFemale: [22,36],
			BiMale: [15,58],
			BiFemale: [58,169]
		},
		NJ: {
			StraightMale: [1643,6318],
			StraightFemale: [1414,3154],
			GayMale: [123,347],
			GayFemale: [64,190],
			BiMale: [42,143],
			BiFemale: [223,444]
		},
		NH: {
			StraightMale: [387,1541],
			StraightFemale: [390,793],
			GayMale: [25,75],
			GayFemale: [9,46],
			BiMale: [7,45],
			BiFemale: [80,153]
		},
		NE: {
			StraightMale: [381,1352],
			StraightFemale: [300,667],
			GayMale: [17,58],
			GayFemale: [16,44],
			BiMale: [9,36],
			BiFemale: [59,125]
		},
		ND: {
			StraightMale: [127,458],
			StraightFemale: [103,178],
			GayMale: [3,8],
			GayFemale: [0,8],
			BiMale: [8,7],
			BiFemale: [18,30]
		},
		NC: {
			StraightMale: [1650,6077],
			StraightFemale: [1538,3409],
			GayMale: [157,310],
			GayFemale: [73,220],
			BiMale: [48,176],
			BiFemale: [273,524]
		},
		MT: {
			StraightMale: [157,676],
			StraightFemale: [178,355],
			GayMale: [7,23],
			GayFemale: [9,21],
			BiMale: [5,18],
			BiFemale: [33,48]
		},
		MS: {
			StraightMale: [275,982],
			StraightFemale: [253,510],
			GayMale: [20,46],
			GayFemale: [9,27],
			BiMale: [8,20],
			BiFemale: [34,84]
		},
		MO: {
			StraightMale: [1379,5175],
			StraightFemale: [1314,2807],
			GayMale: [99,265],
			GayFemale: [68,170],
			BiMale: [52,128],
			BiFemale: [196,467]
		},
		MN: {
			StraightMale: [1453,5624],
			StraightFemale: [1385,2917],
			GayMale: [117,311],
			GayFemale: [80,189],
			BiMale: [52,166],
			BiFemale: [251,515]
		},
		MI: {
			StraightMale: [2217,8803],
			StraightFemale: [2293,4781],
			GayMale: [208,482],
			GayFemale: [110,272],
			BiMale: [83,258],
			BiFemale: [400,792]
		},
		ME: {
			StraightMale: [323,1134],
			StraightFemale: [348,693],
			GayMale: [24,59],
			GayFemale: [33,56],
			BiMale: [11,44],
			BiFemale: [81,148]
		},
		MD: {
			StraightMale: [1389,5615],
			StraightFemale: [1282,2764],
			GayMale: [125,364],
			GayFemale: [81,214],
			BiMale: [33,153],
			BiFemale: [274,515]
		},
		MA: {
			StraightMale: [2376,9809],
			StraightFemale: [2679,5861],
			GayMale: [275,755],
			GayFemale: [190,533],
			BiMale: [79,326],
			BiFemale: [531,1166]
		},
		LA: {
			StraightMale: [644,2238],
			StraightFemale: [578,1337],
			GayMale: [59,129],
			GayFemale: [29,81],
			BiMale: [23,65],
			BiFemale: [121,204]
		},
		KY: {
			StraightMale: [766,2660],
			StraightFemale: [765,1376],
			GayMale: [67,130],
			GayFemale: [24,78],
			BiMale: [19,68],
			BiFemale: [126,254]
		},
		KS: {
			StraightMale: [679,2352],
			StraightFemale: [554,1190],
			GayMale: [43,83],
			GayFemale: [31,69],
			BiMale: [26,65],
			BiFemale: [90,221]
		},
		IN: {
			StraightMale: [1376,5064],
			StraightFemale: [1327,2761],
			GayMale: [129,273],
			GayFemale: [59,147],
			BiMale: [48,143],
			BiFemale: [220,433]
		},
		IL: {
			StraightMale: [2796,11436],
			StraightFemale: [2778,6245],
			GayMale: [326,782],
			GayFemale: [155,406],
			BiMale: [92,330],
			BiFemale: [376,1025]
		},
		ID: {
			StraightMale: [292,1098],
			StraightFemale: [278,579],
			GayMale: [24,43],
			GayFemale: [5,25],
			BiMale: [5,26],
			BiFemale: [41,85]
		},
		IA: {
			StraightMale: [644,2275],
			StraightFemale: [632,1179],
			GayMale: [48,101],
			GayFemale: [23,66],
			BiMale: [9,63],
			BiFemale: [98,200]
		},
		HI: {
			StraightMale: [223,817],
			StraightFemale: [144,345],
			GayMale: [18,44],
			GayFemale: [7,21],
			BiMale: [8,17],
			BiFemale: [26,38]
		},
		GU: {
			StraightMale: [8,13],
			StraightFemale: [5,14],
			GayFemale: [3,0],
			BiMale: [0,2],
			BiFemale: [1,2]
		},
		GA: {
			StraightMale: [1687,7095],
			StraightFemale: [1763,3745],
			GayMale: [138,389],
			GayFemale: [83,252],
			BiMale: [61,179],
			BiFemale: [265,558]
		},
		FM: {
			StraightMale: [0,1],
			BiFemale: [0,0]
		},
		FL: {
			StraightMale: [3298,14134],
			StraightFemale: [2985,7285],
			GayMale: [305,731],
			GayFemale: [142,464],
			BiMale: [107,334],
			BiFemale: [531,1244]
		},
		DE: {
			StraightMale: [157,657],
			StraightFemale: [153,393],
			GayMale: [14,39],
			GayFemale: [7,27],
			BiMale: [8,16],
			BiFemale: [29,64]
		},
		DC: {
			StraightMale: [230,1219],
			StraightFemale: [330,961],
			GayMale: [65,189],
			GayFemale: [27,61],
			BiMale: [8,40],
			BiFemale: [43,134]
		},
		CT: {
			StraightMale: [750,3017],
			StraightFemale: [708,1641],
			GayMale: [76,175],
			GayFemale: [47,111],
			BiMale: [32,67],
			BiFemale: [135,297]
		},
		CO: {
			StraightMale: [1346,5797],
			StraightFemale: [1106,2709],
			GayMale: [94,242],
			GayFemale: [52,137],
			BiMale: [61,150],
			BiFemale: [245,500]
		},
		CA: {
			StraightMale: [8899,38547],
			StraightFemale: [8065,19453],
			GayMale: [998,2674],
			GayFemale: [491,1434],
			BiMale: [312,1105],
			BiFemale: [1472,3356]
		},
		AZ: {
			StraightMale: [1376,6168],
			StraightFemale: [1215,3034],
			GayMale: [108,326],
			GayFemale: [57,186],
			BiMale: [39,167],
			BiFemale: [201,500]
		},
		AS: {
			StraightMale: [0,2]
		},
		AR: {
			StraightMale: [444,1460],
			StraightFemale: [432,859],
			GayMale: [32,73],
			GayFemale: [17,46],
			BiMale: [13,54],
			BiFemale: [88,130]
		},
		AL: {
			StraightMale: [583,2344],
			StraightFemale: [590,1222],
			GayMale: [50,111],
			GayFemale: [26,59],
			BiMale: [26,64],
			BiFemale: [87,178]
		},
		AK: {
			StraightMale: [192,662],
			StraightFemale: [167,378],
			GayMale: [9,12],
			GayFemale: [15,12],
			BiMale: [10,25],
			BiFemale: [29,74]
		}

	},
	{
		question: 'Are you an adventurous eater? Do you like to try new foods and ethnic cuisines?',
		answers: ["Yes, all the time.","Yes, if it's not too strange.","On rare occasions/I don't know.","No, yuck."],
		WY: {
			StraightMale: [44,37,13,1],
			StraightFemale: [23,23,7,0],
			BiMale: [2,0,0,0],
			BiFemale: [1,7,2,0]
		},
		WV: {
			StraightMale: [104,89,33,8],
			StraightFemale: [48,86,32,3],
			GayMale: [4,7,2,1],
			GayFemale: [4,3,3,0],
			BiMale: [1,1,2,0],
			BiFemale: [11,14,3,0]
		},
		WI: {
			StraightMale: [537,454,184,32],
			StraightFemale: [273,335,120,28],
			GayMale: [35,32,14,4],
			GayFemale: [28,24,3,0],
			BiMale: [30,15,7,1],
			BiFemale: [78,58,21,3]
		},
		WA: {
			StraightMale: [1272,938,315,48],
			StraightFemale: [669,673,200,32],
			GayMale: [114,56,25,1],
			GayFemale: [64,40,10,0],
			BiMale: [58,38,10,1],
			BiFemale: [247,130,24,1]
		},
		VT: {
			StraightMale: [88,67,17,0],
			StraightFemale: [41,54,16,3],
			GayMale: [4,2,0,1],
			GayFemale: [3,1,0,0],
			BiMale: [5,3,1,0],
			BiFemale: [24,16,4,0]
		},
		VI: {
			StraightMale: [3,1,0,0],
			StraightFemale: [1,0,0,0]
		},
		VA: {
			StraightMale: [953,694,248,40],
			StraightFemale: [429,464,119,34],
			GayMale: [61,43,12,3],
			GayFemale: [32,36,2,0],
			BiMale: [34,15,3,2],
			BiFemale: [110,66,21,3]
		},
		UT: {
			StraightMale: [210,190,49,8],
			StraightFemale: [109,118,32,9],
			GayMale: [9,10,4,1],
			GayFemale: [2,7,0,1],
			BiMale: [8,5,2,0],
			BiFemale: [27,22,10,0]
		},
		TX: {
			StraightMale: [1976,1700,578,90],
			StraightFemale: [1012,1197,380,71],
			GayMale: [122,93,28,2],
			GayFemale: [64,52,19,5],
			BiMale: [66,35,18,1],
			BiFemale: [228,148,45,11]
		},
		TN: {
			StraightMale: [409,362,138,23],
			StraightFemale: [204,306,95,16],
			GayMale: [29,15,9,2],
			GayFemale: [12,19,5,2],
			BiMale: [9,7,5,1],
			BiFemale: [64,44,11,3]
		},
		SD: {
			StraightMale: [38,36,16,3],
			StraightFemale: [17,27,13,4],
			GayMale: [1,2,0,0],
			GayFemale: [1,1,0,0],
			BiMale: [1,1,0,0],
			BiFemale: [5,5,2,0]
		},
		SC: {
			StraightMale: [244,242,96,21],
			StraightFemale: [138,178,40,15],
			GayMale: [8,10,4,0],
			GayFemale: [13,10,6,1],
			BiMale: [4,9,2,0],
			BiFemale: [26,29,10,1]
		},
		RI: {
			StraightMale: [150,120,30,4],
			StraightFemale: [87,98,25,10],
			GayMale: [8,11,3,0],
			GayFemale: [5,14,1,1],
			BiMale: [6,3,0,0],
			BiFemale: [23,17,3,0]
		},
		PR: {
			StraightMale: [10,7,5,0],
			StraightFemale: [12,7,0,1],
			GayMale: [1,1,0,0],
			GayFemale: [0,1,0,0],
			BiFemale: [0,1,0,0]
		},
		PA: {
			StraightMale: [1286,1145,393,93],
			StraightFemale: [716,832,254,67],
			GayMale: [71,55,16,7],
			GayFemale: [54,43,9,0],
			BiMale: [49,25,10,3],
			BiFemale: [205,137,41,6]
		},
		OR: {
			StraightMale: [798,580,169,26],
			StraightFemale: [442,434,113,25],
			GayMale: [48,37,6,4],
			GayFemale: [55,33,7,1],
			BiMale: [51,17,13,2],
			BiFemale: [184,117,24,5]
		},
		OK: {
			StraightMale: [345,315,141,8],
			StraightFemale: [159,218,80,24],
			GayMale: [17,18,6,1],
			GayFemale: [14,11,2,0],
			BiMale: [9,9,3,0],
			BiFemale: [33,27,7,3]
		},
		OH: {
			StraightMale: [991,993,366,67],
			StraightFemale: [541,729,260,57],
			GayMale: [63,53,16,2],
			GayFemale: [34,34,11,3],
			BiMale: [36,20,13,0],
			BiFemale: [161,115,24,7]
		},
		NY: {
			StraightMale: [2251,1547,570,98],
			StraightFemale: [1384,1222,338,90],
			GayMale: [196,141,52,7],
			GayFemale: [114,79,17,5],
			BiMale: [74,47,18,3],
			BiFemale: [329,181,66,18]
		},
		NV: {
			StraightMale: [243,191,72,17],
			StraightFemale: [104,127,34,10],
			GayMale: [13,12,1,4],
			GayFemale: [4,6,3,0],
			BiMale: [8,4,5,0],
			BiFemale: [31,27,10,1]
		},
		NM: {
			StraightMale: [184,138,42,9],
			StraightFemale: [76,94,27,4],
			GayMale: [13,10,2,0],
			GayFemale: [5,4,1,0],
			BiMale: [12,5,1,0],
			BiFemale: [30,17,3,2]
		},
		NJ: {
			StraightMale: [758,637,245,51],
			StraightFemale: [382,414,160,45],
			GayMale: [36,38,11,3],
			GayFemale: [21,19,4,1],
			BiMale: [22,10,5,3],
			BiFemale: [74,63,17,2]
		},
		NH: {
			StraightMale: [211,202,74,12],
			StraightFemale: [113,113,34,11],
			GayMale: [10,5,3,0],
			GayFemale: [9,8,0,0],
			BiMale: [6,5,2,0],
			BiFemale: [21,23,3,1]
		},
		NE: {
			StraightMale: [135,145,47,9],
			StraightFemale: [68,90,28,3],
			GayMale: [4,4,1,0],
			GayFemale: [2,4,1,0],
			BiMale: [9,3,0,0],
			BiFemale: [23,9,5,2]
		},
		ND: {
			StraightMale: [50,55,11,2],
			StraightFemale: [16,23,8,2],
			GayMale: [0,1,0,0],
			GayFemale: [2,0,1,0],
			BiMale: [1,2,0,0],
			BiFemale: [8,3,0,0]
		},
		NC: {
			StraightMale: [697,591,207,27],
			StraightFemale: [373,459,137,31],
			GayMale: [29,44,11,3],
			GayFemale: [28,23,5,1],
			BiMale: [32,10,3,2],
			BiFemale: [101,60,21,3]
		},
		MT: {
			StraightMale: [64,68,15,4],
			StraightFemale: [36,51,13,3],
			GayMale: [1,2,0,0],
			GayFemale: [3,3,0,0],
			BiMale: [4,1,0,0],
			BiFemale: [21,9,1,0]
		},
		MS: {
			StraightMale: [98,89,37,3],
			StraightFemale: [35,66,31,11],
			GayMale: [4,5,2,0],
			GayFemale: [4,2,2,0],
			BiMale: [2,1,3,0],
			BiFemale: [11,4,5,0]
		},
		MO: {
			StraightMale: [559,447,180,28],
			StraightFemale: [303,368,124,23],
			GayMale: [24,25,8,1],
			GayFemale: [34,15,3,4],
			BiMale: [22,12,4,0],
			BiFemale: [69,56,14,3]
		},
		MN: {
			StraightMale: [642,512,186,32],
			StraightFemale: [386,390,114,20],
			GayMale: [46,32,7,0],
			GayFemale: [39,25,7,1],
			BiMale: [32,16,4,1],
			BiFemale: [104,61,20,3]
		},
		MI: {
			StraightMale: [894,898,327,76],
			StraightFemale: [529,710,231,51],
			GayMale: [67,57,14,4],
			GayFemale: [36,28,13,4],
			BiMale: [37,31,9,1],
			BiFemale: [116,99,44,7]
		},
		ME: {
			StraightMale: [129,118,47,8],
			StraightFemale: [85,107,36,4],
			GayMale: [6,6,0,0],
			GayFemale: [10,6,1,2],
			BiMale: [4,3,1,0],
			BiFemale: [34,17,11,4]
		},
		MD: {
			StraightMale: [760,553,198,31],
			StraightFemale: [363,378,113,33],
			GayMale: [46,34,14,1],
			GayFemale: [30,17,7,2],
			BiMale: [30,12,4,1],
			BiFemale: [95,70,19,2]
		},
		MA: {
			StraightMale: [1457,988,369,61],
			StraightFemale: [831,832,215,67],
			GayMale: [107,77,20,4],
			GayFemale: [69,56,29,2],
			BiMale: [55,21,8,0],
			BiFemale: [245,140,30,7]
		},
		LA: {
			StraightMale: [261,184,58,17],
			StraightFemale: [151,171,51,16],
			GayMale: [19,11,3,0],
			GayFemale: [10,13,2,0],
			BiMale: [8,4,4,0],
			BiFemale: [36,24,9,1]
		},
		KY: {
			StraightMale: [246,225,86,20],
			StraightFemale: [153,187,71,17],
			GayMale: [14,9,5,1],
			GayFemale: [9,5,6,0],
			BiMale: [9,1,1,1],
			BiFemale: [28,30,6,0]
		},
		KS: {
			StraightMale: [277,233,98,13],
			StraightFemale: [119,176,43,11],
			GayMale: [9,13,5,0],
			GayFemale: [14,11,3,0],
			BiMale: [5,9,6,0],
			BiFemale: [37,22,9,2]
		},
		IN: {
			StraightMale: [515,467,178,35],
			StraightFemale: [263,381,135,35],
			GayMale: [44,24,11,2],
			GayFemale: [18,19,6,0],
			BiMale: [25,9,4,0],
			BiFemale: [61,63,9,7]
		},
		IL: {
			StraightMale: [1223,980,406,88],
			StraightFemale: [798,799,258,52],
			GayMale: [105,71,21,1],
			GayFemale: [44,35,14,6],
			BiMale: [51,27,10,1],
			BiFemale: [178,103,44,5]
		},
		ID: {
			StraightMale: [98,90,40,8],
			StraightFemale: [59,72,28,3],
			GayMale: [7,8,1,0],
			GayFemale: [3,3,1,1],
			BiMale: [4,3,0,0],
			BiFemale: [12,10,3,1]
		},
		IA: {
			StraightMale: [199,198,73,17],
			StraightFemale: [112,145,52,14],
			GayMale: [17,6,3,1],
			GayFemale: [11,6,5,0],
			BiMale: [9,5,0,0],
			BiFemale: [27,29,4,2]
		},
		HI: {
			StraightMale: [94,64,17,1],
			StraightFemale: [40,41,6,1],
			GayMale: [11,4,0,0],
			GayFemale: [2,3,2,0],
			BiMale: [2,1,0,0],
			BiFemale: [9,6,1,0]
		},
		GU: {
			StraightFemale: [0,1,0,0]
		},
		GA: {
			StraightMale: [820,639,249,51],
			StraightFemale: [401,529,145,36],
			GayMale: [45,29,15,5],
			GayFemale: [29,33,10,0],
			BiMale: [27,12,9,0],
			BiFemale: [104,72,13,3]
		},
		FL: {
			StraightMale: [1521,1340,481,79],
			StraightFemale: [770,982,318,72],
			GayMale: [81,60,21,7],
			GayFemale: [69,57,15,1],
			BiMale: [51,27,15,3],
			BiFemale: [192,158,34,6]
		},
		DE: {
			StraightMale: [104,70,21,6],
			StraightFemale: [53,52,23,6],
			GayMale: [10,1,3,1],
			GayFemale: [1,6,1,1],
			BiMale: [1,0,0,0],
			BiFemale: [12,5,3,0]
		},
		DC: {
			StraightMale: [172,81,21,1],
			StraightFemale: [195,75,17,2],
			GayMale: [30,19,3,1],
			GayFemale: [12,11,0,0],
			BiMale: [6,1,1,0],
			BiFemale: [32,8,2,1]
		},
		CT: {
			StraightMale: [344,319,108,29],
			StraightFemale: [225,223,67,23],
			GayMale: [27,24,9,1],
			GayFemale: [9,21,4,2],
			BiMale: [10,10,2,0],
			BiFemale: [44,46,12,2]
		},
		CO: {
			StraightMale: [758,552,169,33],
			StraightFemale: [372,360,88,16],
			GayMale: [30,30,5,4],
			GayFemale: [14,18,7,1],
			BiMale: [34,16,4,1],
			BiFemale: [106,62,19,2]
		},
		CA: {
			StraightMale: [4699,3243,971,166],
			StraightFemale: [2571,2323,611,119],
			GayMale: [383,271,59,10],
			GayFemale: [211,171,46,11],
			BiMale: [200,83,37,3],
			BiFemale: [676,388,107,14]
		},
		AZ: {
			StraightMale: [680,561,176,36],
			StraightFemale: [347,405,148,30],
			GayMale: [36,28,10,0],
			GayFemale: [29,23,2,1],
			BiMale: [19,17,7,1],
			BiFemale: [99,65,19,1]
		},
		AS: {
			StraightMale: [0,1,0,0]
		},
		AR: {
			StraightMale: [140,138,55,9],
			StraightFemale: [71,120,35,8],
			GayMale: [9,6,3,0],
			GayFemale: [2,2,1,0],
			BiMale: [7,2,2,0],
			BiFemale: [22,12,5,2]
		},
		AL: {
			StraightMale: [224,206,88,11],
			StraightFemale: [119,164,46,16],
			GayMale: [13,9,5,1],
			GayFemale: [7,11,6,1],
			BiMale: [5,6,1,0],
			BiFemale: [29,22,6,0]
		},
		AK: {
			StraightMale: [74,55,15,2],
			StraightFemale: [43,42,21,2],
			GayMale: [2,1,0,0],
			GayFemale: [1,4,0,0],
			BiMale: [7,1,0,0],
			BiFemale: [19,5,2,0]
		}

	},
	{
		question: 'Are you happy with your life?',
		answers: ["Yes","No","Most of the time"],
		WY: {
			StraightMale: [568,45,554],
			StraightFemale: [275,29,385],
			GayMale: [17,1,26],
			GayFemale: [9,0,16],
			BiMale: [18,0,21],
			BiFemale: [27,3,58]
		},
		WV: {
			StraightMale: [1477,273,1735],
			StraightFemale: [827,136,1529],
			GayMale: [72,13,104],
			GayFemale: [30,6,73],
			BiMale: [37,12,60],
			BiFemale: [112,26,200]
		},
		WI: {
			StraightMale: [6984,839,7646],
			StraightFemale: [3783,345,5894],
			GayMale: [307,52,471],
			GayFemale: [185,22,322],
			BiMale: [170,27,259],
			BiFemale: [448,110,878]
		},
		WA: {
			StraightMale: [14065,1391,14185],
			StraightFemale: [7822,572,10151],
			GayMale: [836,78,1008],
			GayFemale: [510,54,745],
			BiMale: [381,71,495],
			BiFemale: [1238,203,2015]
		},
		VT: {
			StraightMale: [789,108,997],
			StraightFemale: [544,64,771],
			GayMale: [39,8,77],
			GayFemale: [44,6,51],
			BiMale: [34,6,52],
			BiFemale: [88,23,201]
		},
		VI: {
			StraightMale: [25,3,16],
			StraightFemale: [8,1,17],
			GayMale: [1,0,0],
			BiMale: [0,0,1],
			BiFemale: [4,0,1]
		},
		VA: {
			StraightMale: [11877,1171,10750],
			StraightFemale: [6077,496,7735],
			GayMale: [552,60,699],
			GayFemale: [333,34,486],
			BiMale: [267,60,292],
			BiFemale: [769,131,1221]
		},
		UT: {
			StraightMale: [2989,301,3001],
			StraightFemale: [1302,116,1891],
			GayMale: [153,15,170],
			GayFemale: [79,12,127],
			BiMale: [57,11,90],
			BiFemale: [206,35,329]
		},
		TX: {
			StraightMale: [29533,2494,25517],
			StraightFemale: [16306,1204,19151],
			GayMale: [1601,144,1812],
			GayFemale: [935,76,1145],
			BiMale: [612,114,780],
			BiFemale: [1893,327,2736]
		},
		TN: {
			StraightMale: [6347,727,6511],
			StraightFemale: [3449,342,5062],
			GayMale: [321,63,444],
			GayFemale: [209,32,275],
			BiMale: [164,36,195],
			BiFemale: [441,81,721]
		},
		SD: {
			StraightMale: [646,90,702],
			StraightFemale: [314,45,559],
			GayMale: [22,2,28],
			GayFemale: [9,0,25],
			BiMale: [11,2,25],
			BiFemale: [47,12,80]
		},
		SC: {
			StraightMale: [4100,380,3890],
			StraightFemale: [2256,197,3085],
			GayMale: [175,26,221],
			GayFemale: [126,27,173],
			BiMale: [81,15,109],
			BiFemale: [247,46,397]
		},
		RI: {
			StraightMale: [1733,174,1723],
			StraightFemale: [1082,80,1484],
			GayMale: [133,16,168],
			GayFemale: [85,8,135],
			BiMale: [49,11,55],
			BiFemale: [136,21,283]
		},
		PR: {
			StraightMale: [257,38,198],
			StraightFemale: [208,26,190],
			GayMale: [19,9,23],
			GayFemale: [5,0,8],
			BiMale: [11,0,8],
			BiFemale: [19,3,25]
		},
		PA: {
			StraightMale: [16597,2075,17654],
			StraightFemale: [9546,1105,14183],
			GayMale: [933,103,1243],
			GayFemale: [609,69,851],
			BiMale: [366,90,486],
			BiFemale: [1150,241,2117]
		},
		OR: {
			StraightMale: [7647,805,8256],
			StraightFemale: [4674,376,6189],
			GayMale: [460,50,580],
			GayFemale: [442,48,500],
			BiMale: [256,47,355],
			BiFemale: [866,107,1397]
		},
		OK: {
			StraightMale: [5458,520,5319],
			StraightFemale: [2773,284,3783],
			GayMale: [241,29,302],
			GayFemale: [126,9,207],
			BiMale: [135,31,165],
			BiFemale: [391,48,568]
		},
		OH: {
			StraightMale: [14683,1821,15629],
			StraightFemale: [7826,878,11762],
			GayMale: [703,117,1037],
			GayFemale: [451,67,676],
			BiMale: [327,94,459],
			BiFemale: [994,218,1809]
		},
		NY: {
			StraightMale: [30993,3427,29382],
			StraightFemale: [21685,1913,26893],
			GayMale: [2781,278,3126],
			GayFemale: [1313,142,1842],
			BiMale: [668,148,915],
			BiFemale: [2276,439,3509]
		},
		NV: {
			StraightMale: [3827,350,3332],
			StraightFemale: [1795,162,2214],
			GayMale: [157,15,187],
			GayFemale: [94,11,122],
			BiMale: [90,16,100],
			BiFemale: [270,43,420]
		},
		NM: {
			StraightMale: [2178,216,1964],
			StraightFemale: [1156,100,1432],
			GayMale: [107,14,140],
			GayFemale: [65,1,93],
			BiMale: [66,5,88],
			BiFemale: [189,26,255]
		},
		NJ: {
			StraightMale: [10524,1052,10045],
			StraightFemale: [6138,505,7754],
			GayMale: [517,56,660],
			GayFemale: [290,40,453],
			BiMale: [177,54,278],
			BiFemale: [548,118,926]
		},
		NH: {
			StraightMale: [2139,252,2354],
			StraightFemale: [1414,110,1841],
			GayMale: [106,15,144],
			GayFemale: [72,11,115],
			BiMale: [50,10,83],
			BiFemale: [191,32,294]
		},
		NE: {
			StraightMale: [1935,238,2090],
			StraightFemale: [1000,83,1467],
			GayMale: [73,12,106],
			GayFemale: [39,5,87],
			BiMale: [47,13,52],
			BiFemale: [105,21,258]
		},
		ND: {
			StraightMale: [724,93,738],
			StraightFemale: [316,30,445],
			GayMale: [19,4,24],
			GayFemale: [16,0,19],
			BiMale: [12,4,18],
			BiFemale: [28,6,67]
		},
		NC: {
			StraightMale: [10394,1027,9856],
			StraightFemale: [6112,506,8049],
			GayMale: [520,56,654],
			GayFemale: [337,44,523],
			BiMale: [210,47,305],
			BiFemale: [748,114,1159]
		},
		MT: {
			StraightMale: [917,106,1060],
			StraightFemale: [515,49,729],
			GayMale: [39,9,40],
			GayFemale: [19,3,40],
			BiMale: [19,2,28],
			BiFemale: [52,13,131]
		},
		MS: {
			StraightMale: [1709,181,1681],
			StraightFemale: [950,107,1323],
			GayMale: [60,17,110],
			GayFemale: [51,11,65],
			BiMale: [33,7,55],
			BiFemale: [134,14,196]
		},
		MP: {
			StraightMale: [0,0,2]
		},
		MO: {
			StraightMale: [7330,890,7793],
			StraightFemale: [4296,393,6315],
			GayMale: [342,38,488],
			GayFemale: [250,22,350],
			BiMale: [175,50,255],
			BiFemale: [524,121,938]
		},
		MN: {
			StraightMale: [8362,770,7848],
			StraightFemale: [4775,322,5843],
			GayMale: [402,49,521],
			GayFemale: [250,23,361],
			BiMale: [183,46,246],
			BiFemale: [582,94,923]
		},
		MI: {
			StraightMale: [12472,1497,13779],
			StraightFemale: [7265,749,10697],
			GayMale: [615,93,881],
			GayFemale: [368,49,581],
			BiMale: [301,73,444],
			BiFemale: [882,166,1618]
		},
		ME: {
			StraightMale: [1590,249,1907],
			StraightFemale: [1066,136,1650],
			GayMale: [85,15,119],
			GayFemale: [78,7,126],
			BiMale: [49,15,66],
			BiFemale: [143,48,309]
		},
		MD: {
			StraightMale: [8264,880,7923],
			StraightFemale: [4713,388,6027],
			GayMale: [461,56,544],
			GayFemale: [318,28,437],
			BiMale: [188,45,215],
			BiFemale: [613,107,1015]
		},
		MA: {
			StraightMale: [14732,1466,13978],
			StraightFemale: [11111,676,13162],
			GayMale: [1243,125,1324],
			GayFemale: [832,79,1104],
			BiMale: [370,69,473],
			BiFemale: [1200,227,2129]
		},
		LA: {
			StraightMale: [3785,359,3597],
			StraightFemale: [2117,207,2785],
			GayMale: [192,23,271],
			GayFemale: [126,12,184],
			BiMale: [79,25,109],
			BiFemale: [247,52,446]
		},
		KY: {
			StraightMale: [3990,554,4611],
			StraightFemale: [2291,309,3495],
			GayMale: [215,38,273],
			GayFemale: [97,16,163],
			BiMale: [82,16,139],
			BiFemale: [298,55,537]
		},
		KS: {
			StraightMale: [3453,426,3622],
			StraightFemale: [1767,160,2574],
			GayMale: [135,14,193],
			GayFemale: [71,13,141],
			BiMale: [81,20,96],
			BiFemale: [229,50,411]
		},
		IN: {
			StraightMale: [7290,921,8249],
			StraightFemale: [4038,462,6201],
			GayMale: [368,46,528],
			GayFemale: [215,29,337],
			BiMale: [172,45,268],
			BiFemale: [510,107,962]
		},
		IL: {
			StraightMale: [17818,1821,17198],
			StraightFemale: [10643,863,13623],
			GayMale: [1194,120,1374],
			GayFemale: [612,66,801],
			BiMale: [409,80,507],
			BiFemale: [1158,204,1982]
		},
		ID: {
			StraightMale: [1678,204,1691],
			StraightFemale: [911,61,1190],
			GayMale: [64,7,92],
			GayFemale: [37,2,51],
			BiMale: [35,10,53],
			BiFemale: [97,11,183]
		},
		IA: {
			StraightMale: [3089,407,3591],
			StraightFemale: [1795,213,2784],
			GayMale: [140,13,201],
			GayFemale: [93,9,113],
			BiMale: [76,17,96],
			BiFemale: [228,44,412]
		},
		HI: {
			StraightMale: [1367,116,1186],
			StraightFemale: [600,51,674],
			GayMale: [60,6,85],
			GayFemale: [34,2,37],
			BiMale: [37,3,28],
			BiFemale: [77,10,93]
		},
		GU: {
			StraightMale: [36,2,26],
			StraightFemale: [27,5,32],
			GayMale: [1,0,2],
			GayFemale: [2,1,2],
			BiMale: [1,1,2],
			BiFemale: [3,0,3]
		},
		GA: {
			StraightMale: [12117,1087,10442],
			StraightFemale: [7040,531,8332],
			GayMale: [618,74,706],
			GayFemale: [375,40,542],
			BiMale: [293,40,323],
			BiFemale: [813,103,1203]
		},
		FM: {
			StraightMale: [2,0,0],
			StraightFemale: [3,0,1],
			GayFemale: [0,0,1],
			BiFemale: [1,0,2]
		},
		FL: {
			StraightMale: [25532,2096,21404],
			StraightFemale: [13734,1014,15746],
			GayMale: [1276,144,1395],
			GayFemale: [734,93,984],
			BiMale: [533,92,640],
			BiFemale: [1783,261,2400]
		},
		DE: {
			StraightMale: [1012,112,999],
			StraightFemale: [602,58,852],
			GayMale: [65,3,81],
			GayFemale: [29,6,47],
			BiMale: [23,2,36],
			BiFemale: [76,13,141]
		},
		DC: {
			StraightMale: [2126,141,1636],
			StraightFemale: [1968,104,2001],
			GayMale: [325,16,314],
			GayFemale: [133,8,161],
			BiMale: [61,6,64],
			BiFemale: [194,25,223]
		},
		CT: {
			StraightMale: [4755,519,4623],
			StraightFemale: [2699,240,3697],
			GayMale: [250,42,327],
			GayFemale: [183,23,248],
			BiMale: [101,21,153],
			BiFemale: [307,62,572]
		},
		CO: {
			StraightMale: [8831,643,7601],
			StraightFemale: [4568,279,5113],
			GayMale: [365,26,387],
			GayFemale: [210,16,286],
			BiMale: [220,37,240],
			BiFemale: [669,64,879]
		},
		CA: {
			StraightMale: [61117,5207,51979],
			StraightFemale: [34716,2420,38271],
			GayMale: [4216,381,4555],
			GayFemale: [2487,196,2820],
			BiMale: [1449,243,1598],
			BiFemale: [4306,629,6009]
		},
		AZ: {
			StraightMale: [9413,793,8425],
			StraightFemale: [5002,359,5722],
			GayMale: [459,60,529],
			GayFemale: [281,25,363],
			BiMale: [196,42,243],
			BiFemale: [607,95,941]
		},
		AS: {
			StraightMale: [1,1,2],
			StraightFemale: [1,0,0]
		},
		AR: {
			StraightMale: [2160,321,2550],
			StraightFemale: [1292,171,2032],
			GayMale: [98,15,157],
			GayFemale: [67,9,118],
			BiMale: [68,15,84],
			BiFemale: [165,34,306]
		},
		AL: {
			StraightMale: [3887,427,3871],
			StraightFemale: [2191,231,2993],
			GayMale: [179,37,229],
			GayFemale: [107,21,161],
			BiMale: [104,19,123],
			BiFemale: [258,56,446]
		},
		AK: {
			StraightMale: [931,81,924],
			StraightFemale: [506,47,683],
			GayMale: [26,9,37],
			GayFemale: [31,2,37],
			BiMale: [22,7,33],
			BiFemale: [81,15,120]
		}

	},
	{
		question: 'How important is religion/God in your life?',
		answers: ["Extremely important","Somewhat important","Not very important","Not at all important"],
		WY: {
			StraightMale: [83,179,143,147],
			StraightFemale: [70,107,75,66],
			GayMale: [3,9,4,3],
			GayFemale: [1,3,7,1],
			BiMale: [1,6,1,8],
			BiFemale: [6,18,14,14]
		},
		WV: {
			StraightMale: [308,605,362,400],
			StraightFemale: [340,458,192,166],
			GayMale: [18,31,16,15],
			GayFemale: [3,22,13,19],
			BiMale: [9,14,11,12],
			BiFemale: [21,61,43,50]
		},
		WI: {
			StraightMale: [945,2502,2066,2238],
			StraightFemale: [845,1865,1230,1060],
			GayMale: [43,117,118,169],
			GayFemale: [29,90,84,101],
			BiMale: [26,66,54,82],
			BiFemale: [57,240,189,269]
		},
		WA: {
			StraightMale: [1656,3985,4124,5825],
			StraightFemale: [1624,2837,2263,2613],
			GayMale: [98,288,310,415],
			GayFemale: [87,182,197,270],
			BiMale: [57,132,109,225],
			BiFemale: [161,472,469,746]
		},
		VT: {
			StraightMale: [79,227,298,359],
			StraightFemale: [94,179,187,197],
			GayMale: [4,16,20,29],
			GayFemale: [8,19,19,26],
			BiMale: [1,13,12,17],
			BiFemale: [10,34,37,80]
		},
		VI: {
			StraightMale: [3,3,5,3],
			StraightFemale: [3,2,1,2],
			BiFemale: [0,1,0,1]
		},
		VA: {
			StraightMale: [1705,3895,2967,3380],
			StraightFemale: [1673,2601,1486,1425],
			GayMale: [88,219,195,242],
			GayFemale: [69,145,121,147],
			BiMale: [41,91,63,108],
			BiFemale: [139,339,251,322]
		},
		UT: {
			StraightMale: [524,919,754,927],
			StraightFemale: [418,531,359,325],
			GayMale: [21,48,40,47],
			GayFemale: [14,35,35,24],
			BiMale: [16,22,12,24],
			BiFemale: [26,82,86,106]
		},
		TX: {
			StraightMale: [5568,9935,6391,7152],
			StraightFemale: [5455,6460,3169,2794],
			GayMale: [308,601,461,483],
			GayFemale: [186,397,275,285],
			BiMale: [105,228,159,231],
			BiFemale: [331,797,578,756]
		},
		TN: {
			StraightMale: [1499,2376,1336,1357],
			StraightFemale: [1442,1611,636,481],
			GayMale: [73,146,86,103],
			GayFemale: [52,93,62,70],
			BiMale: [37,66,36,51],
			BiFemale: [75,217,133,164]
		},
		SD: {
			StraightMale: [123,253,162,138],
			StraightFemale: [110,171,90,57],
			GayMale: [2,13,12,6],
			GayFemale: [0,5,2,7],
			BiMale: [3,9,2,4],
			BiFemale: [13,24,19,13]
		},
		SC: {
			StraightMale: [889,1541,858,846],
			StraightFemale: [905,1036,416,327],
			GayMale: [33,75,41,45],
			GayFemale: [39,56,45,44],
			BiMale: [9,30,15,26],
			BiFemale: [53,116,82,89]
		},
		RI: {
			StraightMale: [159,522,505,612],
			StraightFemale: [177,434,387,348],
			GayMale: [23,56,50,55],
			GayFemale: [8,40,36,40],
			BiMale: [3,15,12,24],
			BiFemale: [13,70,65,79]
		},
		PR: {
			StraightMale: [44,69,35,45],
			StraightFemale: [48,86,39,31],
			GayMale: [5,10,1,7],
			GayFemale: [1,1,1,2],
			BiMale: [0,3,1,0],
			BiFemale: [2,2,4,2]
		},
		PA: {
			StraightMale: [2248,5767,5030,5656],
			StraightFemale: [2269,4491,2956,2733],
			GayMale: [115,300,366,451],
			GayFemale: [89,219,277,262],
			BiMale: [47,141,123,158],
			BiFemale: [169,536,481,689]
		},
		OR: {
			StraightMale: [990,2219,2438,3602],
			StraightFemale: [911,1776,1473,1673],
			GayMale: [62,148,160,257],
			GayFemale: [48,144,157,226],
			BiMale: [42,75,79,148],
			BiFemale: [115,315,324,538]
		},
		OK: {
			StraightMale: [1160,2053,1078,1096],
			StraightFemale: [1117,1345,484,348],
			GayMale: [48,94,65,48],
			GayFemale: [29,69,52,43],
			BiMale: [24,37,39,32],
			BiFemale: [62,171,97,125]
		},
		OH: {
			StraightMale: [2410,5340,4106,4267],
			StraightFemale: [2217,3901,2130,1736],
			GayMale: [101,299,279,291],
			GayFemale: [78,166,180,186],
			BiMale: [50,109,105,141],
			BiFemale: [157,481,403,525]
		},
		NY: {
			StraightMale: [3161,8409,9053,11144],
			StraightFemale: [3413,7811,6679,6632],
			GayMale: [290,877,1092,1247],
			GayFemale: [138,478,551,653],
			BiMale: [84,207,195,303],
			BiFemale: [264,782,893,1243]
		},
		NV: {
			StraightMale: [444,1173,952,1116],
			StraightFemale: [397,772,435,456],
			GayMale: [16,51,46,64],
			GayFemale: [18,35,33,33],
			BiMale: [10,34,20,34],
			BiFemale: [40,106,96,127]
		},
		NM: {
			StraightMale: [372,665,533,652],
			StraightFemale: [269,455,299,249],
			GayMale: [20,47,36,43],
			GayFemale: [10,20,26,18],
			BiMale: [9,27,19,31],
			BiFemale: [30,90,69,75]
		},
		NJ: {
			StraightMale: [1183,3260,3095,3390],
			StraightFemale: [1149,2701,1775,1448],
			GayMale: [72,185,206,211],
			GayFemale: [38,148,117,122],
			BiMale: [30,58,77,78],
			BiFemale: [90,232,204,268]
		},
		NH: {
			StraightMale: [208,610,729,940],
			StraightFemale: [180,537,486,476],
			GayMale: [16,37,45,63],
			GayFemale: [5,31,25,43],
			BiMale: [6,15,11,30],
			BiFemale: [17,83,85,96]
		},
		NE: {
			StraightMale: [305,704,531,513],
			StraightFemale: [284,535,241,194],
			GayMale: [8,25,24,28],
			GayFemale: [6,23,22,20],
			BiMale: [10,17,10,12],
			BiFemale: [17,60,48,57]
		},
		ND: {
			StraightMale: [117,251,179,162],
			StraightFemale: [84,152,77,60],
			GayMale: [2,5,9,3],
			GayFemale: [3,4,4,4],
			BiMale: [1,9,5,3],
			BiFemale: [5,12,9,23]
		},
		NC: {
			StraightMale: [2099,3611,2273,2460],
			StraightFemale: [2192,2565,1168,1055],
			GayMale: [103,212,174,157],
			GayFemale: [70,151,124,145],
			BiMale: [42,87,52,79],
			BiFemale: [149,292,246,304]
		},
		MT: {
			StraightMale: [121,348,240,284],
			StraightFemale: [127,220,151,141],
			GayMale: [2,5,7,10],
			GayFemale: [1,7,10,13],
			BiMale: [1,5,10,7],
			BiFemale: [5,29,20,27]
		},
		MS: {
			StraightMale: [481,596,315,292],
			StraightFemale: [480,381,118,94],
			GayMale: [12,29,24,15],
			GayFemale: [11,31,13,13],
			BiMale: [14,9,7,14],
			BiFemale: [29,62,32,37]
		},
		MO: {
			StraightMale: [1270,2512,1912,2061],
			StraightFemale: [1271,2054,977,911],
			GayMale: [60,132,136,133],
			GayFemale: [35,126,83,113],
			BiMale: [29,60,54,65],
			BiFemale: [78,264,182,267]
		},
		MN: {
			StraightMale: [1145,2698,2244,2483],
			StraightFemale: [1020,1977,1296,1168],
			GayMale: [52,165,129,188],
			GayFemale: [36,103,89,118],
			BiMale: [22,55,51,81],
			BiFemale: [88,249,220,319]
		},
		MI: {
			StraightMale: [1912,4472,3607,3855],
			StraightFemale: [1969,3427,1942,1735],
			GayMale: [85,244,249,307],
			GayFemale: [54,189,144,166],
			BiMale: [54,111,97,120],
			BiFemale: [133,406,343,483]
		},
		ME: {
			StraightMale: [141,468,543,622],
			StraightFemale: [174,470,378,352],
			GayMale: [13,36,30,38],
			GayFemale: [8,29,31,38],
			BiMale: [8,13,17,27],
			BiFemale: [20,77,71,98]
		},
		MD: {
			StraightMale: [1179,2589,2400,2819],
			StraightFemale: [1245,1941,1267,1248],
			GayMale: [60,159,169,199],
			GayFemale: [48,122,115,144],
			BiMale: [26,61,64,82],
			BiFemale: [84,278,212,305]
		},
		MA: {
			StraightMale: [1103,3588,4530,6237],
			StraightFemale: [1249,3623,3648,3516],
			GayMale: [137,378,456,575],
			GayFemale: [84,251,349,393],
			BiMale: [48,118,136,204],
			BiFemale: [146,449,544,826]
		},
		LA: {
			StraightMale: [853,1389,809,775],
			StraightFemale: [836,910,433,348],
			GayMale: [36,76,68,61],
			GayFemale: [33,69,35,39],
			BiMale: [19,33,21,22],
			BiFemale: [57,120,75,121]
		},
		KY: {
			StraightMale: [886,1696,970,956],
			StraightFemale: [852,1131,511,404],
			GayMale: [49,84,63,62],
			GayFemale: [25,47,34,34],
			BiMale: [15,44,21,30],
			BiFemale: [62,148,97,121]
		},
		KS: {
			StraightMale: [554,1236,869,973],
			StraightFemale: [506,835,447,365],
			GayMale: [25,63,45,43],
			GayFemale: [18,34,45,41],
			BiMale: [9,36,16,27],
			BiFemale: [30,88,76,119]
		},
		IN: {
			StraightMale: [1416,2840,1812,1960],
			StraightFemale: [1263,2082,989,745],
			GayMale: [66,150,141,142],
			GayFemale: [40,112,83,71],
			BiMale: [35,67,45,64],
			BiFemale: [76,264,183,233]
		},
		IL: {
			StraightMale: [2342,5527,4844,5667],
			StraightFemale: [2281,4470,2991,2755],
			GayMale: [155,399,425,496],
			GayFemale: [79,196,216,259],
			BiMale: [39,131,116,169],
			BiFemale: [157,475,458,618]
		},
		ID: {
			StraightMale: [248,522,447,492],
			StraightFemale: [204,367,254,214],
			GayMale: [8,20,16,14],
			GayFemale: [1,14,10,15],
			BiMale: [4,8,9,16],
			BiFemale: [11,45,38,46]
		},
		IA: {
			StraightMale: [478,1175,948,966],
			StraightFemale: [463,908,503,437],
			GayMale: [15,47,51,55],
			GayFemale: [12,40,31,32],
			BiMale: [10,24,14,20],
			BiFemale: [29,95,84,147]
		},
		HI: {
			StraightMale: [159,346,329,340],
			StraightFemale: [127,216,138,133],
			GayMale: [10,23,25,27],
			GayFemale: [4,13,14,10],
			BiMale: [6,9,6,8],
			BiFemale: [16,28,20,31]
		},
		GU: {
			StraightMale: [1,10,4,2],
			StraightFemale: [7,7,4,3],
			GayMale: [0,0,0,0],
			GayFemale: [0,0,0,1],
			BiMale: [0,0,1,0],
			BiFemale: [0,2,1,2]
		},
		GA: {
			StraightMale: [2409,3936,2580,2724],
			StraightFemale: [2644,2815,1245,1071],
			GayMale: [101,231,183,202],
			GayFemale: [91,193,145,118],
			BiMale: [49,83,67,93],
			BiFemale: [171,362,229,282]
		},
		FM: {
			StraightFemale: [0,0,1,0]
		},
		FL: {
			StraightMale: [3923,7742,6027,6442],
			StraightFemale: [3708,5558,3030,2605],
			GayMale: [184,465,346,423],
			GayFemale: [146,300,230,303],
			BiMale: [86,176,150,171],
			BiFemale: [236,603,598,749]
		},
		DE: {
			StraightMale: [156,319,280,367],
			StraightFemale: [141,262,175,155],
			GayMale: [7,22,24,23],
			GayFemale: [5,13,16,6],
			BiMale: [3,5,7,6],
			BiFemale: [19,40,25,32]
		},
		DC: {
			StraightMale: [187,449,530,744],
			StraightFemale: [334,586,555,633],
			GayMale: [33,120,117,119],
			GayFemale: [19,46,31,50],
			BiMale: [7,14,11,39],
			BiFemale: [25,50,81,77]
		},
		CT: {
			StraightMale: [479,1445,1546,1655],
			StraightFemale: [475,1203,902,799],
			GayMale: [43,97,122,122],
			GayFemale: [24,95,78,63],
			BiMale: [7,27,32,50],
			BiFemale: [45,137,128,188]
		},
		CO: {
			StraightMale: [1105,2597,2300,2742],
			StraightFemale: [989,1784,1079,1155],
			GayMale: [50,107,111,122],
			GayFemale: [30,88,90,72],
			BiMale: [30,49,61,67],
			BiFemale: [97,247,232,254]
		},
		CA: {
			StraightMale: [7227,16316,16517,21532],
			StraightFemale: [6849,12162,9685,10289],
			GayMale: [519,1368,1437,1874],
			GayFemale: [331,914,860,1057],
			BiMale: [177,409,400,718],
			BiFemale: [532,1523,1568,2260]
		},
		AZ: {
			StraightMale: [1224,2755,2375,2951],
			StraightFemale: [1174,1894,1232,1212],
			GayMale: [70,161,146,154],
			GayFemale: [37,108,82,126],
			BiMale: [26,64,69,73],
			BiFemale: [75,233,223,294]
		},
		AS: {
			StraightMale: [0,0,1,1]
		},
		AR: {
			StraightMale: [576,837,431,477],
			StraightFemale: [541,596,257,167],
			GayMale: [21,42,29,34],
			GayFemale: [13,36,22,24],
			BiMale: [11,14,17,24],
			BiFemale: [39,75,40,65]
		},
		AL: {
			StraightMale: [965,1411,735,722],
			StraightFemale: [1039,922,367,261],
			GayMale: [43,75,46,41],
			GayFemale: [27,53,41,26],
			BiMale: [25,32,26,21],
			BiFemale: [72,136,78,75]
		},
		AK: {
			StraightMale: [124,270,248,261],
			StraightFemale: [111,179,148,147],
			GayMale: [1,11,7,12],
			GayFemale: [5,11,6,12],
			BiMale: [3,8,15,12],
			BiFemale: [7,22,35,40]
		}

	},
	{
		question: 'If you don&#39;t do anything at all for an entire day, how does that make you feel?',
		answers: ["Good","Bad"],
		WY: {
			StraightMale: [12,16],
			StraightFemale: [3,9],
			GayMale: [0,1],
			BiMale: [1,2],
			BiFemale: [1,2]
		},
		WV: {
			StraightMale: [25,75],
			StraightFemale: [16,47],
			GayMale: [0,4],
			GayFemale: [0,2],
			BiMale: [1,1],
			BiFemale: [5,8]
		},
		WI: {
			StraightMale: [122,354],
			StraightFemale: [73,186],
			GayMale: [9,15],
			GayFemale: [4,18],
			BiMale: [4,13],
			BiFemale: [20,49]
		},
		WA: {
			StraightMale: [312,690],
			StraightFemale: [162,386],
			GayMale: [22,59],
			GayFemale: [11,41],
			BiMale: [13,33],
			BiFemale: [61,125]
		},
		VT: {
			StraightMale: [16,40],
			StraightFemale: [7,29],
			GayMale: [1,3],
			GayFemale: [0,2],
			BiMale: [0,4],
			BiFemale: [3,7]
		},
		VI: {
			StraightMale: [1,1],
			StraightFemale: [0,0]
		},
		VA: {
			StraightMale: [212,503],
			StraightFemale: [116,286],
			GayMale: [14,32],
			GayFemale: [7,20],
			BiMale: [2,14],
			BiFemale: [23,56]
		},
		UT: {
			StraightMale: [42,134],
			StraightFemale: [12,63],
			GayMale: [2,6],
			GayFemale: [2,3],
			BiMale: [2,4],
			BiFemale: [9,16]
		},
		TX: {
			StraightMale: [468,1084],
			StraightFemale: [282,634],
			GayMale: [36,76],
			GayFemale: [22,46],
			BiMale: [14,34],
			BiFemale: [32,115]
		},
		TN: {
			StraightMale: [99,229],
			StraightFemale: [57,113],
			GayMale: [2,16],
			GayFemale: [3,14],
			BiMale: [5,5],
			BiFemale: [11,27]
		},
		SD: {
			StraightMale: [16,25],
			StraightFemale: [11,15],
			GayMale: [2,0],
			GayFemale: [0,1],
			BiFemale: [1,2]
		},
		SC: {
			StraightMale: [70,171],
			StraightFemale: [29,92],
			GayMale: [3,6],
			GayFemale: [5,6],
			BiMale: [2,0],
			BiFemale: [4,16]
		},
		RI: {
			StraightMale: [20,76],
			StraightFemale: [19,52],
			GayMale: [1,12],
			GayFemale: [0,4],
			BiMale: [0,5],
			BiFemale: [2,12]
		},
		PR: {
			StraightMale: [1,6],
			StraightFemale: [6,4],
			GayMale: [0,0],
			GayFemale: [1,0],
			BiMale: [1,0]
		},
		PA: {
			StraightMale: [294,792],
			StraightFemale: [178,464],
			GayMale: [22,45],
			GayFemale: [8,40],
			BiMale: [9,33],
			BiFemale: [45,107]
		},
		OR: {
			StraightMale: [163,423],
			StraightFemale: [88,241],
			GayMale: [11,43],
			GayFemale: [12,25],
			BiMale: [12,18],
			BiFemale: [36,82]
		},
		OK: {
			StraightMale: [93,182],
			StraightFemale: [51,110],
			GayMale: [2,12],
			GayFemale: [2,8],
			BiMale: [1,3],
			BiFemale: [9,19]
		},
		OH: {
			StraightMale: [247,579],
			StraightFemale: [143,347],
			GayMale: [14,31],
			GayFemale: [10,31],
			BiMale: [10,20],
			BiFemale: [40,77]
		},
		NY: {
			StraightMale: [367,1260],
			StraightFemale: [248,821],
			GayMale: [41,133],
			GayFemale: [28,68],
			BiMale: [12,42],
			BiFemale: [55,174]
		},
		NV: {
			StraightMale: [74,139],
			StraightFemale: [54,69],
			GayMale: [4,8],
			GayFemale: [2,6],
			BiMale: [2,6],
			BiFemale: [10,14]
		},
		NM: {
			StraightMale: [40,85],
			StraightFemale: [13,52],
			GayMale: [1,7],
			GayFemale: [0,1],
			BiMale: [5,4],
			BiFemale: [4,16]
		},
		NJ: {
			StraightMale: [180,430],
			StraightFemale: [86,246],
			GayMale: [12,19],
			GayFemale: [6,18],
			BiMale: [4,11],
			BiFemale: [14,43]
		},
		NH: {
			StraightMale: [40,110],
			StraightFemale: [24,55],
			GayMale: [5,5],
			GayFemale: [1,6],
			BiMale: [1,7],
			BiFemale: [6,17]
		},
		NE: {
			StraightMale: [38,93],
			StraightFemale: [20,54],
			GayMale: [2,3],
			GayFemale: [0,5],
			BiMale: [1,5],
			BiFemale: [5,13]
		},
		ND: {
			StraightMale: [12,34],
			StraightFemale: [9,13],
			GayFemale: [1,0],
			BiMale: [0,3],
			BiFemale: [0,6]
		},
		NC: {
			StraightMale: [142,360],
			StraightFemale: [85,229],
			GayMale: [12,18],
			GayFemale: [9,18],
			BiMale: [8,16],
			BiFemale: [14,56]
		},
		MT: {
			StraightMale: [20,31],
			StraightFemale: [10,19],
			GayFemale: [0,4],
			BiMale: [2,1],
			BiFemale: [1,5]
		},
		MS: {
			StraightMale: [30,46],
			StraightFemale: [13,34],
			GayMale: [1,1],
			GayFemale: [0,3],
			BiMale: [1,2],
			BiFemale: [3,2]
		},
		MO: {
			StraightMale: [132,311],
			StraightFemale: [73,220],
			GayMale: [8,22],
			GayFemale: [6,11],
			BiMale: [6,13],
			BiFemale: [23,37]
		},
		MN: {
			StraightMale: [169,374],
			StraightFemale: [87,241],
			GayMale: [9,20],
			GayFemale: [1,18],
			BiMale: [4,10],
			BiFemale: [16,59]
		},
		MI: {
			StraightMale: [259,560],
			StraightFemale: [133,350],
			GayMale: [17,31],
			GayFemale: [5,29],
			BiMale: [10,19],
			BiFemale: [28,79]
		},
		ME: {
			StraightMale: [42,76],
			StraightFemale: [20,55],
			GayMale: [1,2],
			GayFemale: [2,6],
			BiMale: [1,2],
			BiFemale: [8,15]
		},
		MD: {
			StraightMale: [151,428],
			StraightFemale: [88,235],
			GayMale: [10,33],
			GayFemale: [9,24],
			BiMale: [3,13],
			BiFemale: [18,54]
		},
		MA: {
			StraightMale: [266,707],
			StraightFemale: [166,478],
			GayMale: [14,58],
			GayFemale: [13,40],
			BiMale: [11,31],
			BiFemale: [45,156]
		},
		LA: {
			StraightMale: [67,124],
			StraightFemale: [51,84],
			GayMale: [2,7],
			GayFemale: [5,9],
			BiMale: [2,3],
			BiFemale: [7,21]
		},
		KY: {
			StraightMale: [62,158],
			StraightFemale: [45,91],
			GayMale: [5,8],
			GayFemale: [3,8],
			BiMale: [4,5],
			BiFemale: [7,22]
		},
		KS: {
			StraightMale: [68,150],
			StraightFemale: [39,93],
			GayMale: [2,4],
			GayFemale: [5,8],
			BiMale: [9,3],
			BiFemale: [13,22]
		},
		IN: {
			StraightMale: [153,314],
			StraightFemale: [61,166],
			GayMale: [5,21],
			GayFemale: [3,19],
			BiMale: [7,11],
			BiFemale: [14,42]
		},
		IL: {
			StraightMale: [303,733],
			StraightFemale: [196,457],
			GayMale: [25,47],
			GayFemale: [11,38],
			BiMale: [14,23],
			BiFemale: [36,100]
		},
		ID: {
			StraightMale: [21,64],
			StraightFemale: [11,41],
			GayMale: [0,4],
			GayFemale: [0,2],
			BiMale: [0,1],
			BiFemale: [4,16]
		},
		IA: {
			StraightMale: [66,147],
			StraightFemale: [29,106],
			GayMale: [0,9],
			GayFemale: [3,4],
			BiMale: [1,9],
			BiFemale: [3,21]
		},
		HI: {
			StraightMale: [27,45],
			StraightFemale: [13,24],
			GayMale: [3,2],
			GayFemale: [1,1],
			BiFemale: [2,5]
		},
		GU: {
			StraightFemale: [0,2]
		},
		GA: {
			StraightMale: [194,415],
			StraightFemale: [111,266],
			GayMale: [6,26],
			GayFemale: [3,25],
			BiMale: [7,9],
			BiFemale: [20,51]
		},
		FL: {
			StraightMale: [351,808],
			StraightFemale: [210,465],
			GayMale: [18,52],
			GayFemale: [18,40],
			BiMale: [8,14],
			BiFemale: [46,119]
		},
		DE: {
			StraightMale: [27,31],
			StraightFemale: [17,22],
			GayMale: [3,1],
			GayFemale: [3,2],
			BiMale: [0,0],
			BiFemale: [4,8]
		},
		DC: {
			StraightMale: [23,90],
			StraightFemale: [22,62],
			GayMale: [5,18],
			GayFemale: [1,3],
			BiMale: [1,6],
			BiFemale: [3,7]
		},
		CT: {
			StraightMale: [80,199],
			StraightFemale: [50,116],
			GayMale: [4,18],
			GayFemale: [6,14],
			BiMale: [4,5],
			BiFemale: [8,33]
		},
		CO: {
			StraightMale: [150,334],
			StraightFemale: [85,213],
			GayMale: [5,15],
			GayFemale: [5,11],
			BiMale: [8,13],
			BiFemale: [22,50]
		},
		CA: {
			StraightMale: [884,2562],
			StraightFemale: [553,1474],
			GayMale: [64,194],
			GayFemale: [41,119],
			BiMale: [43,96],
			BiFemale: [130,335]
		},
		AZ: {
			StraightMale: [135,336],
			StraightFemale: [80,194],
			GayMale: [8,20],
			GayFemale: [5,19],
			BiMale: [7,14],
			BiFemale: [18,39]
		},
		AS: {
			StraightMale: [1,1]
		},
		AR: {
			StraightMale: [46,78],
			StraightFemale: [18,59],
			GayMale: [1,4],
			GayFemale: [1,3],
			BiMale: [4,1],
			BiFemale: [7,15]
		},
		AL: {
			StraightMale: [70,126],
			StraightFemale: [36,82],
			GayMale: [5,6],
			GayFemale: [4,6],
			BiMale: [1,4],
			BiFemale: [4,16]
		},
		AK: {
			StraightMale: [16,40],
			StraightFemale: [12,20],
			GayMale: [0,4],
			GayFemale: [0,2],
			BiMale: [0,4],
			BiFemale: [3,7]
		}

	},
	{
		question: 'Which best represents your opinion of same-sex relationships?',
		answers: ["Girl-on-girl is okay, but guy-on-guy is wrong.","Guy-on-guy is okay, but girl-on-girl is wrong.","All same-sex relationships are wrong.","It's all fine by me."],
		WY: {
			StraightMale: [201,1,189,527],
			StraightFemale: [24,2,114,392],
			GayMale: [1,0,0,35],
			GayFemale: [0,0,0,19],
			BiMale: [2,0,1,28],
			BiFemale: [4,0,0,73]
		},
		WV: {
			StraightMale: [579,6,640,1580],
			StraightFemale: [60,12,554,1294],
			GayMale: [0,1,0,154],
			GayFemale: [1,0,1,87],
			BiMale: [0,0,2,84],
			BiFemale: [31,0,1,251]
		},
		WI: {
			StraightMale: [2169,24,1786,8735],
			StraightFemale: [222,35,979,6818],
			GayMale: [1,7,6,707],
			GayFemale: [6,0,1,477],
			BiMale: [7,4,1,385],
			BiFemale: [57,0,6,1122]
		},
		WA: {
			StraightMale: [3209,23,2605,18587],
			StraightFemale: [711,39,1630,12648],
			GayMale: [1,14,5,1685],
			GayFemale: [13,0,2,1179],
			BiMale: [3,7,9,801],
			BiFemale: [100,1,14,2751]
		},
		VT: {
			StraightMale: [206,2,144,1249],
			StraightFemale: [20,0,95,1005],
			GayMale: [0,2,0,106],
			GayFemale: [1,0,0,100],
			BiMale: [0,0,1,82],
			BiFemale: [7,0,1,259]
		},
		VI: {
			StraightMale: [11,0,10,15],
			StraightFemale: [0,0,6,13],
			GayMale: [0,0,0,1],
			BiMale: [1,0,0,0],
			BiFemale: [2,0,0,0]
		},
		VA: {
			StraightMale: [3239,24,2831,13350],
			StraightFemale: [314,37,1825,9444],
			GayMale: [3,10,2,1109],
			GayFemale: [10,1,3,775],
			BiMale: [8,2,7,489],
			BiFemale: [109,2,13,1657]
		},
		UT: {
			StraightMale: [921,6,865,3356],
			StraightFemale: [83,14,527,2021],
			GayMale: [0,10,0,258],
			GayFemale: [10,0,0,176],
			BiMale: [1,2,1,111],
			BiFemale: [29,2,2,444]
		},
		TX: {
			StraightMale: [8622,76,8037,30741],
			StraightFemale: [1281,99,5930,22480],
			GayMale: [7,41,17,3045],
			GayFemale: [39,0,12,1907],
			BiMale: [13,11,13,1232],
			BiFemale: [286,3,31,3919]
		},
		TN: {
			StraightMale: [2173,16,2686,6297],
			StraightFemale: [239,22,2013,4746],
			GayMale: [0,8,1,717],
			GayFemale: [9,0,0,444],
			BiMale: [7,3,5,319],
			BiFemale: [87,1,8,962]
		},
		SD: {
			StraightMale: [267,1,215,657],
			StraightFemale: [28,5,150,514],
			GayMale: [0,1,0,38],
			GayFemale: [0,0,0,28],
			BiMale: [0,1,0,29],
			BiFemale: [8,0,0,110]
		},
		SC: {
			StraightMale: [1488,8,1491,3978],
			StraightFemale: [152,12,1201,3094],
			GayMale: [0,7,1,338],
			GayFemale: [5,0,2,291],
			BiMale: [1,0,3,161],
			BiFemale: [35,0,3,542]
		},
		RI: {
			StraightMale: [437,5,249,2391],
			StraightFemale: [55,5,154,2063],
			GayMale: [0,1,0,286],
			GayFemale: [0,0,0,218],
			BiMale: [1,0,0,92],
			BiFemale: [17,0,1,362]
		},
		PR: {
			StraightMale: [62,1,92,198],
			StraightFemale: [14,4,105,227],
			GayMale: [1,1,1,38],
			GayFemale: [0,1,0,9],
			BiMale: [1,1,0,11],
			BiFemale: [1,1,1,34]
		},
		PA: {
			StraightMale: [5039,41,3833,21680],
			StraightFemale: [612,75,2477,17289],
			GayMale: [2,27,10,2060],
			GayFemale: [23,0,3,1415],
			BiMale: [10,1,9,805],
			BiFemale: [177,0,17,2917]
		},
		OR: {
			StraightMale: [1694,18,1323,11094],
			StraightFemale: [208,13,950,8164],
			GayMale: [0,14,2,944],
			GayFemale: [10,0,6,912],
			BiMale: [2,4,5,563],
			BiFemale: [60,1,5,1994]
		},
		OK: {
			StraightMale: [2077,16,2078,5076],
			StraightFemale: [250,17,1589,3516],
			GayMale: [1,3,2,451],
			GayFemale: [10,1,0,294],
			BiMale: [2,0,7,238],
			BiFemale: [95,0,7,736]
		},
		OH: {
			StraightMale: [4797,35,4566,17459],
			StraightFemale: [668,70,2813,13123],
			GayMale: [1,22,6,1580],
			GayFemale: [22,0,3,1041],
			BiMale: [8,7,9,708],
			BiFemale: [160,1,22,2414]
		},
		NY: {
			StraightMale: [7648,94,5250,41875],
			StraightFemale: [1026,204,3398,39693],
			GayMale: [12,82,37,5639],
			GayFemale: [53,4,20,3118],
			BiMale: [26,11,15,1454],
			BiFemale: [216,8,29,5336]
		},
		NV: {
			StraightMale: [1115,5,768,4352],
			StraightFemale: [118,11,402,2865],
			GayMale: [0,9,4,296],
			GayFemale: [3,0,1,181],
			BiMale: [1,1,0,160],
			BiFemale: [52,1,4,570]
		},
		NM: {
			StraightMale: [581,5,480,2600],
			StraightFemale: [63,12,250,1881],
			GayMale: [0,2,2,216],
			GayFemale: [3,0,0,131],
			BiMale: [0,3,0,140],
			BiFemale: [19,1,1,392]
		},
		NJ: {
			StraightMale: [2855,27,1807,13684],
			StraightFemale: [417,47,1193,10625],
			GayMale: [3,7,7,1108],
			GayFemale: [11,0,3,748],
			BiMale: [5,2,5,418],
			BiFemale: [58,1,7,1336]
		},
		NH: {
			StraightMale: [624,4,348,2973],
			StraightFemale: [71,7,237,2496],
			GayMale: [0,3,0,230],
			GayFemale: [0,0,1,176],
			BiMale: [0,1,1,102],
			BiFemale: [21,0,2,432]
		},
		NE: {
			StraightMale: [610,4,558,2262],
			StraightFemale: [59,9,380,1506],
			GayMale: [0,4,0,142],
			GayFemale: [3,0,0,99],
			BiMale: [2,0,1,82],
			BiFemale: [19,0,2,290]
		},
		ND: {
			StraightMale: [275,2,211,715],
			StraightFemale: [21,9,105,476],
			GayMale: [0,0,1,46],
			GayFemale: [1,0,0,30],
			BiMale: [0,0,0,29],
			BiFemale: [1,0,1,80]
		},
		NC: {
			StraightMale: [3424,21,3281,11134],
			StraightFemale: [391,40,2749,8856],
			GayMale: [3,16,7,1111],
			GayFemale: [11,0,2,813],
			BiMale: [6,5,5,459],
			BiFemale: [118,0,11,1604]
		},
		MT: {
			StraightMale: [323,2,257,1128],
			StraightFemale: [31,4,209,768],
			GayMale: [0,2,0,62],
			GayFemale: [2,0,0,51],
			BiMale: [3,0,0,38],
			BiFemale: [16,0,1,142]
		},
		MS: {
			StraightMale: [641,3,825,1412],
			StraightFemale: [96,7,676,1048],
			GayMale: [1,1,1,153],
			GayFemale: [5,0,0,109],
			BiMale: [0,1,1,82],
			BiFemale: [36,0,4,252]
		},
		MP: {
			StraightMale: [1,0,0,1],
			StraightFemale: [0,0,0,1]
		},
		MO: {
			StraightMale: [2360,12,2190,8319],
			StraightFemale: [298,34,1709,6689],
			GayMale: [1,17,4,727],
			GayFemale: [4,0,2,548],
			BiMale: [3,3,2,379],
			BiFemale: [85,1,3,1222]
		},
		MN: {
			StraightMale: [2043,21,1795,10144],
			StraightFemale: [194,11,998,7607],
			GayMale: [2,8,2,833],
			GayFemale: [4,0,0,575],
			BiMale: [0,2,2,379],
			BiFemale: [53,1,6,1299]
		},
		MI: {
			StraightMale: [4089,19,3450,15280],
			StraightFemale: [430,56,2396,12202],
			GayMale: [2,19,7,1380],
			GayFemale: [8,0,4,865],
			BiMale: [10,8,5,644],
			BiFemale: [114,4,16,2115]
		},
		ME: {
			StraightMale: [462,3,329,2277],
			StraightFemale: [45,10,264,2003],
			GayMale: [0,2,2,178],
			GayFemale: [2,0,0,178],
			BiMale: [2,2,2,97],
			BiFemale: [19,1,2,407]
		},
		MD: {
			StraightMale: [2116,21,1725,10473],
			StraightFemale: [203,32,1137,7812],
			GayMale: [1,10,7,895],
			GayFemale: [7,0,0,687],
			BiMale: [5,2,10,364],
			BiFemale: [51,0,11,1420]
		},
		MA: {
			StraightMale: [2770,28,1576,21808],
			StraightFemale: [296,42,967,20574],
			GayMale: [0,18,9,2495],
			GayFemale: [13,1,7,1932],
			BiMale: [5,9,8,756],
			BiFemale: [76,0,11,3080]
		},
		LA: {
			StraightMale: [1307,13,1277,3820],
			StraightFemale: [140,17,1002,2930],
			GayMale: [1,4,2,414],
			GayFemale: [6,1,2,294],
			BiMale: [2,1,6,164],
			BiFemale: [31,0,5,567]
		},
		KY: {
			StraightMale: [1408,13,1555,4430],
			StraightFemale: [160,17,1275,3297],
			GayMale: [1,12,3,436],
			GayFemale: [4,0,0,230],
			BiMale: [2,0,1,190],
			BiFemale: [57,1,7,674]
		},
		KS: {
			StraightMale: [1127,5,918,3885],
			StraightFemale: [130,11,621,2693],
			GayMale: [0,9,2,283],
			GayFemale: [2,0,0,191],
			BiMale: [3,2,4,139],
			BiFemale: [31,0,4,510]
		},
		IN: {
			StraightMale: [2474,17,2436,8463],
			StraightFemale: [276,30,1823,6235],
			GayMale: [1,16,7,787],
			GayFemale: [9,1,1,504],
			BiMale: [7,0,5,376],
			BiFemale: [100,0,7,1219]
		},
		IL: {
			StraightMale: [4868,45,3598,22380],
			StraightFemale: [487,87,2253,18156],
			GayMale: [0,26,8,2398],
			GayFemale: [13,1,3,1357],
			BiMale: [8,6,12,832],
			BiFemale: [120,3,12,2799]
		},
		ID: {
			StraightMale: [561,7,518,1767],
			StraightFemale: [83,6,314,1255],
			GayMale: [1,4,1,119],
			GayFemale: [2,0,0,74],
			BiMale: [2,1,2,70],
			BiFemale: [19,3,3,225]
		},
		IA: {
			StraightMale: [1092,3,879,3657],
			StraightFemale: [112,12,623,2987],
			GayMale: [1,5,2,303],
			GayFemale: [3,0,2,179],
			BiMale: [5,2,1,133],
			BiFemale: [37,0,4,532]
		},
		HI: {
			StraightMale: [371,2,229,1492],
			StraightFemale: [30,8,121,881],
			GayMale: [0,2,0,134],
			GayFemale: [1,0,0,61],
			BiMale: [3,1,0,44],
			BiFemale: [6,0,0,147]
		},
		GU: {
			StraightMale: [10,0,8,27],
			StraightFemale: [3,0,9,34],
			GayMale: [0,0,0,3],
			GayFemale: [1,0,0,3],
			BiMale: [0,0,0,3],
			BiFemale: [0,0,0,5]
		},
		GA: {
			StraightMale: [3682,40,3754,12235],
			StraightFemale: [425,46,3117,9365],
			GayMale: [2,15,8,1227],
			GayFemale: [18,0,4,884],
			BiMale: [10,6,9,531],
			BiFemale: [137,2,12,1682]
		},
		FM: {
			StraightMale: [0,0,1,0],
			StraightFemale: [0,0,0,3],
			GayFemale: [0,0,0,1],
			BiFemale: [0,0,0,3]
		},
		FL: {
			StraightMale: [7717,76,6205,27259],
			StraightFemale: [859,111,4411,19575],
			GayMale: [4,30,13,2425],
			GayFemale: [27,0,7,1617],
			BiMale: [17,6,14,1027],
			BiFemale: [290,4,28,3516]
		},
		DE: {
			StraightMale: [273,1,220,1316],
			StraightFemale: [39,3,177,1006],
			GayMale: [1,0,0,130],
			GayFemale: [1,0,0,67],
			BiMale: [1,0,0,45],
			BiFemale: [11,0,1,183]
		},
		DC: {
			StraightMale: [294,2,241,2875],
			StraightFemale: [30,5,193,3461],
			GayMale: [1,4,4,586],
			GayFemale: [2,0,1,297],
			BiMale: [0,1,1,120],
			BiFemale: [7,0,2,416]
		},
		CT: {
			StraightMale: [1273,6,746,6339],
			StraightFemale: [115,17,462,5053],
			GayMale: [0,4,1,573],
			GayFemale: [6,0,4,417],
			BiMale: [2,0,1,214],
			BiFemale: [32,0,4,775]
		},
		CO: {
			StraightMale: [2074,16,1684,10420],
			StraightFemale: [207,20,1056,6894],
			GayMale: [1,10,5,645],
			GayFemale: [5,1,4,468],
			BiMale: [6,4,4,384],
			BiFemale: [80,1,7,1295]
		},
		CA: {
			StraightMale: [12804,140,9648,77456],
			StraightFemale: [1644,198,6045,56124],
			GayMale: [10,88,29,8177],
			GayFemale: [62,2,12,5162],
			BiMale: [27,22,17,2771],
			BiFemale: [356,9,49,9156]
		},
		AZ: {
			StraightMale: [2511,15,2005,10784],
			StraightFemale: [301,30,1201,7537],
			GayMale: [1,10,3,877],
			GayFemale: [5,0,3,593],
			BiMale: [5,2,2,376],
			BiFemale: [82,3,9,1310]
		},
		AS: {
			StraightMale: [0,0,0,3],
			StraightFemale: [0,0,0,1]
		},
		AR: {
			StraightMale: [932,9,991,2049],
			StraightFemale: [118,10,835,1652],
			GayMale: [0,2,1,221],
			GayFemale: [3,0,0,160],
			BiMale: [1,0,2,124],
			BiFemale: [39,1,5,342]
		},
		AL: {
			StraightMale: [1418,14,1695,3455],
			StraightFemale: [173,19,1446,2645],
			GayMale: [1,7,5,365],
			GayFemale: [7,0,1,261],
			BiMale: [1,3,5,205],
			BiFemale: [68,0,8,570]
		},
		AK: {
			StraightMale: [262,5,211,995],
			StraightFemale: [35,1,136,736],
			GayMale: [0,0,1,55],
			GayFemale: [3,0,0,52],
			BiMale: [1,0,0,49],
			BiFemale: [8,0,0,160]
		}

	},
	{
		question: 'If someone was being rude to your partner, would you openly stand up for them?',
		answers: ["Yes.","No.","It depends on the situation."],
		WY: {
			StraightMale: [334,1,33],
			StraightFemale: [127,0,50],
			GayMale: [8,0,1],
			GayFemale: [5,0,3],
			BiMale: [7,0,0],
			BiFemale: [20,0,8]
		},
		WV: {
			StraightMale: [855,3,129],
			StraightFemale: [464,1,193],
			GayMale: [41,1,7],
			GayFemale: [30,0,2],
			BiMale: [24,0,5],
			BiFemale: [75,1,18]
		},
		WI: {
			StraightMale: [4380,7,674],
			StraightFemale: [1996,3,915],
			GayMale: [227,0,40],
			GayFemale: [164,0,41],
			BiMale: [108,0,37],
			BiFemale: [340,2,157]
		},
		WA: {
			StraightMale: [8587,10,1567],
			StraightFemale: [3887,11,1766],
			GayMale: [536,2,146],
			GayFemale: [382,1,122],
			BiMale: [256,0,86],
			BiFemale: [797,0,403]
		},
		VT: {
			StraightMale: [536,0,103],
			StraightFemale: [267,1,138],
			GayMale: [27,0,7],
			GayFemale: [29,0,7],
			BiMale: [22,0,2],
			BiFemale: [69,0,41]
		},
		VI: {
			StraightMale: [11,0,2],
			StraightFemale: [4,0,3],
			BiFemale: [1,0,0]
		},
		VA: {
			StraightMale: [6471,13,916],
			StraightFemale: [2740,9,1173],
			GayMale: [348,0,90],
			GayFemale: [220,0,45],
			BiMale: [127,1,31],
			BiFemale: [460,0,165]
		},
		UT: {
			StraightMale: [1730,3,221],
			StraightFemale: [692,0,248],
			GayMale: [96,0,16],
			GayFemale: [49,0,4],
			BiMale: [32,0,8],
			BiFemale: [137,0,37]
		},
		TX: {
			StraightMale: [15601,28,2138],
			StraightFemale: [7397,14,2855],
			GayMale: [799,0,185],
			GayFemale: [507,1,81],
			BiMale: [323,0,83],
			BiFemale: [1042,3,365]
		},
		TN: {
			StraightMale: [3746,6,485],
			StraightFemale: [1812,5,692],
			GayMale: [193,0,49],
			GayFemale: [128,0,24],
			BiMale: [95,0,17],
			BiFemale: [281,0,90]
		},
		SD: {
			StraightMale: [312,1,64],
			StraightFemale: [173,0,57],
			GayMale: [13,0,2],
			GayFemale: [9,0,3],
			BiMale: [7,0,2],
			BiFemale: [32,0,3]
		},
		SC: {
			StraightMale: [2182,1,287],
			StraightFemale: [1106,2,424],
			GayMale: [91,0,21],
			GayFemale: [85,0,16],
			BiMale: [45,0,5],
			BiFemale: [158,0,53]
		},
		RI: {
			StraightMale: [1058,4,157],
			StraightFemale: [512,1,230],
			GayMale: [87,0,21],
			GayFemale: [71,0,15],
			BiMale: [25,1,8],
			BiFemale: [102,0,42]
		},
		PR: {
			StraightMale: [82,0,15],
			StraightFemale: [48,3,30],
			GayMale: [8,0,0],
			GayFemale: [2,0,0],
			BiMale: [1,0,1],
			BiFemale: [5,0,2]
		},
		PA: {
			StraightMale: [10291,17,1476],
			StraightFemale: [5092,10,1980],
			GayMale: [553,1,140],
			GayFemale: [429,1,92],
			BiMale: [227,2,64],
			BiFemale: [836,1,285]
		},
		OR: {
			StraightMale: [5033,6,995],
			StraightFemale: [2442,2,1183],
			GayMale: [286,0,78],
			GayFemale: [293,0,79],
			BiMale: [185,0,52],
			BiFemale: [617,3,292]
		},
		OK: {
			StraightMale: [3090,4,356],
			StraightFemale: [1384,3,525],
			GayMale: [121,0,32],
			GayFemale: [95,1,15],
			BiMale: [64,1,17],
			BiFemale: [217,0,62]
		},
		OH: {
			StraightMale: [9355,17,1252],
			StraightFemale: [4225,7,1703],
			GayMale: [439,1,110],
			GayFemale: [298,1,55],
			BiMale: [189,0,39],
			BiFemale: [679,2,238]
		},
		NY: {
			StraightMale: [16609,47,2708],
			StraightFemale: [8839,39,4119],
			GayMale: [1472,2,389],
			GayFemale: [779,0,212],
			BiMale: [405,1,99],
			BiFemale: [1335,2,552]
		},
		NV: {
			StraightMale: [2028,3,254],
			StraightFemale: [862,5,294],
			GayMale: [69,1,18],
			GayFemale: [39,0,9],
			BiMale: [32,1,6],
			BiFemale: [166,0,49]
		},
		NM: {
			StraightMale: [1340,2,195],
			StraightFemale: [586,3,222],
			GayMale: [89,0,18],
			GayFemale: [40,0,6],
			BiMale: [49,0,12],
			BiFemale: [124,0,45]
		},
		NJ: {
			StraightMale: [6054,11,859],
			StraightFemale: [2737,6,1103],
			GayMale: [295,0,86],
			GayFemale: [209,0,34],
			BiMale: [101,0,29],
			BiFemale: [362,0,133]
		},
		NH: {
			StraightMale: [1438,3,196],
			StraightFemale: [702,3,307],
			GayMale: [51,1,25],
			GayFemale: [37,0,14],
			BiMale: [25,0,3],
			BiFemale: [122,0,47]
		},
		NE: {
			StraightMale: [1203,1,176],
			StraightFemale: [505,1,183],
			GayMale: [32,0,11],
			GayFemale: [33,0,6],
			BiMale: [26,0,4],
			BiFemale: [98,0,28]
		},
		ND: {
			StraightMale: [404,0,72],
			StraightFemale: [148,1,52],
			GayMale: [6,0,1],
			GayFemale: [7,0,2],
			BiMale: [8,0,1],
			BiFemale: [15,0,12]
		},
		NC: {
			StraightMale: [5710,10,738],
			StraightFemale: [2787,4,1180],
			GayMale: [285,3,71],
			GayFemale: [213,1,44],
			BiMale: [145,0,33],
			BiFemale: [444,3,154]
		},
		MT: {
			StraightMale: [574,1,84],
			StraightFemale: [276,0,103],
			GayMale: [12,0,3],
			GayFemale: [22,0,2],
			BiMale: [17,0,5],
			BiFemale: [37,0,24]
		},
		MS: {
			StraightMale: [864,3,103],
			StraightFemale: [417,1,142],
			GayMale: [35,0,10],
			GayFemale: [21,0,6],
			BiMale: [16,0,5],
			BiFemale: [62,0,16]
		},
		MO: {
			StraightMale: [4464,10,597],
			StraightFemale: [2207,6,909],
			GayMale: [219,1,50],
			GayFemale: [151,1,27],
			BiMale: [106,0,32],
			BiFemale: [331,2,125]
		},
		MN: {
			StraightMale: [4934,7,839],
			StraightFemale: [2187,7,1079],
			GayMale: [234,0,84],
			GayFemale: [192,0,41],
			BiMale: [114,0,32],
			BiFemale: [408,0,169]
		},
		MI: {
			StraightMale: [7793,13,1140],
			StraightFemale: [3966,11,1511],
			GayMale: [418,0,88],
			GayFemale: [254,1,62],
			BiMale: [193,1,41],
			BiFemale: [633,0,207]
		},
		ME: {
			StraightMale: [1022,3,161],
			StraightFemale: [566,2,238],
			GayMale: [45,0,7],
			GayFemale: [50,0,21],
			BiMale: [22,0,11],
			BiFemale: [131,0,46]
		},
		MD: {
			StraightMale: [4956,5,761],
			StraightFemale: [2145,0,1021],
			GayMale: [280,0,81],
			GayFemale: [185,0,53],
			BiMale: [107,0,24],
			BiFemale: [409,0,164]
		},
		MA: {
			StraightMale: [9008,12,1555],
			StraightFemale: [5057,7,2449],
			GayMale: [707,1,181],
			GayFemale: [558,0,155],
			BiMale: [227,0,55],
			BiFemale: [898,0,377]
		},
		LA: {
			StraightMale: [1998,1,242],
			StraightFemale: [1009,3,397],
			GayMale: [100,0,31],
			GayFemale: [71,0,15],
			BiMale: [47,0,11],
			BiFemale: [156,1,54]
		},
		KY: {
			StraightMale: [2416,3,320],
			StraightFemale: [1136,2,460],
			GayMale: [114,0,30],
			GayFemale: [70,0,10],
			BiMale: [47,0,4],
			BiFemale: [190,0,80]
		},
		KS: {
			StraightMale: [2054,6,277],
			StraightFemale: [901,3,350],
			GayMale: [75,0,17],
			GayFemale: [56,0,20],
			BiMale: [35,0,11],
			BiFemale: [136,1,63]
		},
		IN: {
			StraightMale: [4387,1,622],
			StraightFemale: [2224,5,862],
			GayMale: [214,0,60],
			GayFemale: [145,0,29],
			BiMale: [102,0,21],
			BiFemale: [357,1,114]
		},
		IL: {
			StraightMale: [10210,19,1578],
			StraightFemale: [5059,18,2096],
			GayMale: [679,0,179],
			GayFemale: [394,0,92],
			BiMale: [232,0,66],
			BiFemale: [781,0,280]
		},
		ID: {
			StraightMale: [928,0,123],
			StraightFemale: [447,1,156],
			GayMale: [36,0,11],
			GayFemale: [23,0,3],
			BiMale: [13,0,2],
			BiFemale: [69,0,16]
		},
		IA: {
			StraightMale: [1858,4,284],
			StraightFemale: [904,2,398],
			GayMale: [69,0,21],
			GayFemale: [56,0,9],
			BiMale: [43,1,6],
			BiFemale: [157,0,68]
		},
		HI: {
			StraightMale: [615,0,108],
			StraightFemale: [195,0,119],
			GayMale: [34,0,13],
			GayFemale: [16,0,2],
			BiMale: [16,0,3],
			BiFemale: [36,0,13]
		},
		GU: {
			StraightMale: [9,0,0],
			StraightFemale: [5,0,2],
			GayMale: [0,0,1],
			GayFemale: [1,0,1],
			BiMale: [1,0,0]
		},
		GA: {
			StraightMale: [6349,8,851],
			StraightFemale: [3115,8,1260],
			GayMale: [338,0,64],
			GayFemale: [262,0,43],
			BiMale: [145,1,38],
			BiFemale: [436,0,165]
		},
		FM: {
			StraightMale: [1,0,0]
		},
		FL: {
			StraightMale: [13241,30,1635],
			StraightFemale: [6040,26,2246],
			GayMale: [686,0,144],
			GayFemale: [447,2,89],
			BiMale: [290,1,50],
			BiFemale: [972,4,318]
		},
		DE: {
			StraightMale: [656,1,80],
			StraightFemale: [312,0,135],
			GayMale: [41,0,9],
			GayFemale: [17,0,7],
			BiMale: [10,0,5],
			BiFemale: [43,0,18]
		},
		DC: {
			StraightMale: [1012,2,185],
			StraightFemale: [701,3,371],
			GayMale: [156,0,35],
			GayFemale: [69,0,23],
			BiMale: [34,0,4],
			BiFemale: [99,0,41]
		},
		CT: {
			StraightMale: [2829,7,436],
			StraightFemale: [1394,6,586],
			GayMale: [173,0,41],
			GayFemale: [124,0,13],
			BiMale: [57,0,14],
			BiFemale: [230,0,79]
		},
		CO: {
			StraightMale: [5215,3,775],
			StraightFemale: [2143,6,845],
			GayMale: [193,1,42],
			GayFemale: [129,0,29],
			BiMale: [122,0,35],
			BiFemale: [384,4,176]
		},
		CA: {
			StraightMale: [32597,46,5544],
			StraightFemale: [14466,51,6841],
			GayMale: [2266,8,600],
			GayFemale: [1471,5,364],
			BiMale: [810,4,229],
			BiFemale: [2499,6,1051]
		},
		AZ: {
			StraightMale: [5418,7,745],
			StraightFemale: [2432,9,964],
			GayMale: [235,0,62],
			GayFemale: [170,0,47],
			BiMale: [106,0,29],
			BiFemale: [406,0,122]
		},
		AS: {
			StraightMale: [1,0,1]
		},
		AR: {
			StraightMale: [1248,1,164],
			StraightFemale: [645,1,260],
			GayMale: [42,0,17],
			GayFemale: [32,0,8],
			BiMale: [34,0,7],
			BiFemale: [101,1,39]
		},
		AL: {
			StraightMale: [2115,2,257],
			StraightFemale: [1017,4,372],
			GayMale: [94,0,20],
			GayFemale: [62,0,14],
			BiMale: [59,1,9],
			BiFemale: [140,0,50]
		},
		AK: {
			StraightMale: [493,2,79],
			StraightFemale: [232,0,107],
			GayMale: [9,0,3],
			GayFemale: [19,0,3],
			BiMale: [19,0,2],
			BiFemale: [55,0,16]
		}

	},	
	{
		question: 'And finally, what&#39;s your relationship with marijuana?',
		answers: ["I smoke regularly","I smoke occasionally","I smoked in the past, but no longer","Never"],
		WY: {
			StraightMale: [63,137,468,440],
			StraightFemale: [22,83,256,313],
			GayMale: [5,6,18,15],
			GayFemale: [2,3,9,13],
			BiMale: [6,8,12,12],
			BiFemale: [10,24,32,26]
		},
		WV: {
			StraightMale: [238,483,1271,1376],
			StraightFemale: [93,269,856,1147],
			GayMale: [15,34,54,85],
			GayFemale: [4,24,43,40],
			BiMale: [6,18,37,44],
			BiFemale: [39,81,123,98]
		},
		WI: {
			StraightMale: [866,2312,5578,6264],
			StraightFemale: [314,1286,3298,4671],
			GayMale: [43,159,255,355],
			GayFemale: [39,118,192,184],
			BiMale: [28,96,120,193],
			BiFemale: [114,379,484,446]
		},
		WA: {
			StraightMale: [1986,5046,11162,10795],
			StraightFemale: [957,2904,6551,7261],
			GayMale: [115,414,588,807],
			GayFemale: [101,299,520,406],
			BiMale: [89,218,308,310],
			BiFemale: [347,863,1204,982]
		},
		VT: {
			StraightMale: [192,390,637,599],
			StraightFemale: [72,261,436,495],
			GayMale: [13,24,45,49],
			GayFemale: [12,26,35,39],
			BiMale: [11,19,39,19],
			BiFemale: [45,84,90,77]
		},
		VI: {
			StraightMale: [4,5,12,15],
			StraightFemale: [1,5,7,12],
			GayMale: [0,0,1,0],
			GayFemale: [1,0,0,0],
			BiMale: [0,1,0,0],
			BiFemale: [1,1,1,2]
		},
		VA: {
			StraightMale: [1086,2674,8801,10463],
			StraightFemale: [442,1595,4503,7136],
			GayMale: [54,216,376,675],
			GayFemale: [59,167,289,311],
			BiMale: [40,108,203,268],
			BiFemale: [215,461,700,699]
		},
		UT: {
			StraightMale: [291,724,2157,2903],
			StraightFemale: [111,338,996,1721],
			GayMale: [13,44,110,179],
			GayFemale: [14,42,78,79],
			BiMale: [12,26,50,68],
			BiFemale: [43,117,206,202]
		},
		TX: {
			StraightMale: [3411,8043,20879,22952],
			StraightFemale: [1561,4399,11822,16862],
			GayMale: [208,609,1049,1580],
			GayFemale: [194,434,819,691],
			BiMale: [130,284,494,550],
			BiFemale: [549,1197,1573,1453]
		},
		TN: {
			StraightMale: [891,1753,5007,5354],
			StraightFemale: [330,988,3000,4018],
			GayMale: [59,129,263,356],
			GayFemale: [33,124,200,161],
			BiMale: [33,77,129,152],
			BiFemale: [141,260,437,367]
		},
		SD: {
			StraightMale: [93,143,514,651],
			StraightFemale: [41,103,299,438],
			GayMale: [2,6,21,25],
			GayFemale: [3,7,15,10],
			BiMale: [0,7,15,17],
			BiFemale: [21,24,46,53]
		},
		SC: {
			StraightMale: [485,1074,3181,3276],
			StraightFemale: [207,570,1796,2619],
			GayMale: [18,79,156,166],
			GayFemale: [30,69,128,100],
			BiMale: [13,28,70,82],
			BiFemale: [72,148,246,189]
		},
		RI: {
			StraightMale: [281,675,1223,1307],
			StraightFemale: [147,509,870,954],
			GayMale: [28,60,100,135],
			GayFemale: [24,63,66,69],
			BiMale: [8,27,36,36],
			BiFemale: [42,139,122,123]
		},
		PR: {
			StraightMale: [15,43,109,280],
			StraightFemale: [14,30,50,304],
			GayMale: [1,4,15,32],
			GayFemale: [0,5,1,8],
			BiMale: [0,2,3,9],
			BiFemale: [1,12,10,16]
		},
		PA: {
			StraightMale: [2304,5583,13043,14102],
			StraightFemale: [1003,3557,7925,10995],
			GayMale: [142,466,713,980],
			GayFemale: [105,379,555,476],
			BiMale: [86,186,303,351],
			BiFemale: [372,947,1147,1039]
		},
		OR: {
			StraightMale: [1469,3558,6177,5255],
			StraightFemale: [633,2135,3966,4071],
			GayMale: [113,286,301,373],
			GayFemale: [97,276,375,221],
			BiMale: [86,159,219,179],
			BiFemale: [305,704,798,568]
		},
		OK: {
			StraightMale: [619,1265,4246,4710],
			StraightFemale: [239,601,2287,3280],
			GayMale: [32,87,201,228],
			GayFemale: [23,57,149,125],
			BiMale: [23,52,114,128],
			BiFemale: [94,217,387,281]
		},
		OH: {
			StraightMale: [1986,4467,11639,12956],
			StraightFemale: [821,2357,6684,9534],
			GayMale: [127,336,561,804],
			GayFemale: [95,269,442,368],
			BiMale: [91,182,285,314],
			BiFemale: [318,687,1023,933]
		},
		NY: {
			StraightMale: [3873,12026,20924,23218],
			StraightFemale: [1982,9928,15293,19378],
			GayMale: [388,1670,1787,2193],
			GayFemale: [259,939,1140,947],
			BiMale: [152,418,439,614],
			BiFemale: [624,1708,1915,1773]
		},
		NV: {
			StraightMale: [423,1066,3022,2713],
			StraightFemale: [158,469,1510,1785],
			GayMale: [25,56,115,160],
			GayFemale: [17,30,113,65],
			BiMale: [22,42,78,73],
			BiFemale: [66,173,259,234]
		},
		NM: {
			StraightMale: [281,623,1649,1611],
			StraightFemale: [106,406,1029,984],
			GayMale: [18,48,78,119],
			GayFemale: [10,27,61,55],
			BiMale: [11,27,52,60],
			BiFemale: [50,105,165,149]
		},
		NJ: {
			StraightMale: [1207,3399,7234,8775],
			StraightFemale: [535,2010,4423,6462],
			GayMale: [66,233,361,576],
			GayFemale: [67,182,284,258],
			BiMale: [40,98,156,212],
			BiFemale: [145,443,468,494]
		},
		NH: {
			StraightMale: [351,743,1691,1826],
			StraightFemale: [158,473,1128,1409],
			GayMale: [17,55,67,124],
			GayFemale: [14,49,70,67],
			BiMale: [12,31,39,45],
			BiFemale: [56,135,185,151]
		},
		NE: {
			StraightMale: [228,508,1518,1908],
			StraightFemale: [93,248,830,1276],
			GayMale: [12,33,49,91],
			GayFemale: [12,18,53,49],
			BiMale: [10,17,38,46],
			BiFemale: [35,75,135,109]
		},
		ND: {
			StraightMale: [60,157,496,778],
			StraightFemale: [27,80,235,432],
			GayMale: [4,9,13,17],
			GayFemale: [3,2,13,13],
			BiMale: [3,8,14,15],
			BiFemale: [8,25,37,27]
		},
		NC: {
			StraightMale: [1217,2943,8029,8267],
			StraightFemale: [527,1677,4807,6769],
			GayMale: [77,206,372,581],
			GayFemale: [74,213,329,277],
			BiMale: [42,114,179,205],
			BiFemale: [194,472,699,585]
		},
		MT: {
			StraightMale: [153,343,811,702],
			StraightFemale: [50,177,461,550],
			GayMale: [7,14,29,27],
			GayFemale: [8,15,25,11],
			BiMale: [6,13,15,18],
			BiFemale: [19,48,64,49]
		},
		MS: {
			StraightMale: [178,407,1317,1489],
			StraightFemale: [61,210,755,1181],
			GayMale: [13,23,54,96],
			GayFemale: [8,20,53,38],
			BiMale: [10,15,24,45],
			BiFemale: [34,73,140,102]
		},
		MP: {
			StraightMale: [0,0,1,1]
		},
		MO: {
			StraightMale: [945,2267,5906,6360],
			StraightFemale: [476,1262,3597,5045],
			GayMale: [40,138,283,401],
			GayFemale: [55,130,228,200],
			BiMale: [44,105,142,181],
			BiFemale: [167,373,529,466]
		},
		MN: {
			StraightMale: [932,2590,6293,6609],
			StraightFemale: [370,1533,3655,4919],
			GayMale: [58,188,295,423],
			GayFemale: [47,138,230,232],
			BiMale: [42,79,160,160],
			BiFemale: [157,393,547,514]
		},
		MI: {
			StraightMale: [1728,4296,10192,10722],
			StraightFemale: [704,2628,6131,8442],
			GayMale: [97,302,487,741],
			GayFemale: [75,223,376,319],
			BiMale: [47,184,267,273],
			BiFemale: [329,645,857,807]
		},
		ME: {
			StraightMale: [287,680,1308,1333],
			StraightFemale: [142,484,955,1156],
			GayMale: [20,54,53,92],
			GayFemale: [18,52,71,71],
			BiMale: [8,32,39,38],
			BiFemale: [61,146,143,133]
		},
		MD: {
			StraightMale: [880,2382,5951,7370],
			StraightFemale: [370,1352,3547,5306],
			GayMale: [49,176,315,528],
			GayFemale: [50,165,272,292],
			BiMale: [51,98,126,183],
			BiFemale: [176,443,543,532]
		},
		MA: {
			StraightMale: [1961,6060,10222,10625],
			StraightFemale: [1023,4683,8023,9505],
			GayMale: [165,588,777,1104],
			GayFemale: [127,587,672,593],
			BiMale: [83,249,277,299],
			BiFemale: [389,1120,1077,1010]
		},
		LA: {
			StraightMale: [459,1017,2840,3093],
			StraightFemale: [216,636,1629,2416],
			GayMale: [32,100,145,199],
			GayFemale: [30,71,133,99],
			BiMale: [23,48,60,85],
			BiFemale: [77,178,262,221]
		},
		KY: {
			StraightMale: [511,1204,3298,3749],
			StraightFemale: [268,695,1984,2881],
			GayMale: [33,102,138,248],
			GayFemale: [27,68,106,96],
			BiMale: [21,49,72,100],
			BiFemale: [85,218,310,277]
		},
		KS: {
			StraightMale: [422,926,2787,3162],
			StraightFemale: [189,503,1520,2116],
			GayMale: [18,58,107,157],
			GayFemale: [15,60,81,82],
			BiMale: [15,39,69,76],
			BiFemale: [87,142,240,216]
		},
		IN: {
			StraightMale: [948,2276,6068,6596],
			StraightFemale: [427,1164,3648,4950],
			GayMale: [56,158,316,424],
			GayFemale: [57,121,226,184],
			BiMale: [30,95,166,172],
			BiFemale: [164,417,498,459]
		},
		IL: {
			StraightMale: [2192,5806,12745,14572],
			StraightFemale: [944,3722,8015,11017],
			GayMale: [178,573,783,1088],
			GayFemale: [119,349,476,483],
			BiMale: [89,197,294,365],
			BiFemale: [365,870,1054,970]
		},
		ID: {
			StraightMale: [206,473,1386,1399],
			StraightFemale: [71,273,748,944],
			GayMale: [5,27,52,72],
			GayFemale: [5,17,36,22],
			BiMale: [8,18,33,41],
			BiFemale: [19,68,109,80]
		},
		IA: {
			StraightMale: [375,959,2495,3137],
			StraightFemale: [179,489,1515,2409],
			GayMale: [15,71,108,163],
			GayFemale: [14,40,74,84],
			BiMale: [15,37,53,70],
			BiFemale: [59,153,220,232]
		},
		HI: {
			StraightMale: [115,327,1008,1043],
			StraightFemale: [48,180,413,648],
			GayMale: [6,31,45,80],
			GayFemale: [5,14,31,22],
			BiMale: [5,12,22,27],
			BiFemale: [14,38,58,60]
		},
		GU: {
			StraightMale: [2,7,25,27],
			StraightFemale: [2,10,15,27],
			GayMale: [0,1,0,3],
			GayFemale: [1,0,2,2],
			BiMale: [0,0,1,1],
			BiFemale: [1,3,2,1]
		},
		GA: {
			StraightMale: [1332,3202,8632,9396],
			StraightFemale: [485,1752,5041,7625],
			GayMale: [80,252,455,590],
			GayFemale: [73,186,374,352],
			BiMale: [61,126,206,236],
			BiFemale: [205,510,656,699]
		},
		FM: {
			StraightMale: [0,0,1,1],
			StraightFemale: [0,0,1,1],
			GayFemale: [0,0,0,1],
			BiFemale: [0,0,1,0]
		},
		FL: {
			StraightMale: [3158,7252,17317,19009],
			StraightFemale: [1229,3772,9619,13782],
			GayMale: [182,471,834,1295],
			GayFemale: [172,358,632,614],
			BiMale: [114,233,381,459],
			BiFemale: [536,1041,1422,1288]
		},
		DE: {
			StraightMale: [133,283,812,841],
			StraightFemale: [52,186,518,657],
			GayMale: [5,29,34,69],
			GayFemale: [6,18,37,25],
			BiMale: [7,11,16,27],
			BiFemale: [19,43,71,88]
		},
		DC: {
			StraightMale: [165,634,1348,1442],
			StraightFemale: [89,655,1316,1688],
			GayMale: [25,117,221,264],
			GayFemale: [21,69,94,85],
			BiMale: [6,26,48,44],
			BiFemale: [39,118,133,132]
		},
		CT: {
			StraightMale: [539,1603,3619,3853],
			StraightFemale: [247,939,2290,2797],
			GayMale: [36,123,174,271],
			GayFemale: [35,95,169,139],
			BiMale: [24,50,84,91],
			BiFemale: [97,268,289,275]
		},
		CO: {
			StraightMale: [1204,2862,6571,5874],
			StraightFemale: [468,1554,3571,3857],
			GayMale: [50,154,272,282],
			GayFemale: [46,119,188,157],
			BiMale: [38,110,152,175],
			BiFemale: [175,370,576,449]
		},
		CA: {
			StraightMale: [7997,22639,40821,42933],
			StraightFemale: [3379,13828,23986,30690],
			GayMale: [542,2093,2765,3672],
			GayFemale: [468,1484,1880,1616],
			BiMale: [351,805,999,1025],
			BiFemale: [1267,3137,3378,3009]
		},
		AZ: {
			StraightMale: [1102,2571,7082,7135],
			StraightFemale: [411,1304,3986,4849],
			GayMale: [48,191,343,455],
			GayFemale: [61,141,253,200],
			BiMale: [39,93,159,180],
			BiFemale: [192,376,550,492]
		},
		AS: {
			StraightMale: [0,0,0,4],
			StraightFemale: [0,0,1,0]
		},
		AR: {
			StraightMale: [338,657,1879,1980],
			StraightFemale: [157,406,1209,1608],
			GayMale: [27,67,63,112],
			GayFemale: [21,33,91,60],
			BiMale: [12,37,56,62],
			BiFemale: [65,105,178,136]
		},
		AL: {
			StraightMale: [414,995,3077,3283],
			StraightFemale: [185,506,1726,2661],
			GayMale: [29,46,123,228],
			GayFemale: [16,61,113,95],
			BiMale: [15,38,92,90],
			BiFemale: [81,153,241,248]
		},
		AK: {
			StraightMale: [126,285,795,695],
			StraightFemale: [90,179,441,466],
			GayMale: [6,13,23,25],
			GayFemale: [5,17,25,24],
			BiMale: [8,14,20,23],
			BiFemale: [30,51,64,73]
		}

	}
];

Array.prototype.sum = function () {
	for (var i = 0, sum = 0; i < this.length; i++)
		sum += this[i];
	return sum;
}

var MatchGraphController = Class.create ({
	
	m_signup_data:			{},
	m_location_experience:	null,
	m_location_good:		false,
	m_match_data:			{},
	
	m_data:				null,
	m_answers:			{},
	m_last_answer:		null,
	m_position:			0,
	m_gentation:		'StraightMale',
	m_user_location:	null,
	m_state_data: {
		AL: {name: 'Alabama',			biggest_city: 'Birmingham',		locid: '4225532', points: 0},
		AK: {name: 'Alaska',			biggest_city: 'Anchorage',		locid: '4202461', points: 0},
		AZ: {name: 'Arizona',			biggest_city: 'Phoenix',		locid: '4282217', points: 0},
		AR: {name: 'Arkansas',			biggest_city: 'Little Rock',	locid: '4322192', points: 0},
		CA: {name: 'California',		biggest_city: 'Los Angeles',	locid: '4233989', points: 0},
		CO: {name: 'Colorado',			biggest_city: 'Denver',			locid: '4257106', points: 0},
		CT: {name: 'Connecticut',		biggest_city: 'Bridgeport',		locid: '4259202', points: 0},
		DE: {name: 'Delaware',			biggest_city: 'Wilmington',		locid: '4261526', points: 0},
		FL: {name: 'Florida',			biggest_city: 'Jacksonville',	locid: '4267568', points: 0},
		GA: {name: 'Georgia',			biggest_city: 'Atlanta',		locid: '4272798', points: 0},
		HI: {name: 'Hawaii',			biggest_city: 'Honolulu',		locid: '4274338', points: 0},
		ID: {name: 'Idaho',				biggest_city: 'Boise',			locid: '4275807', points: 0},
		IL: {name: 'Illinois',			biggest_city: 'Chicago',		locid: '4279080', points: 0},
		IN: {name: 'Indiana',			biggest_city: 'Indianapolis',	locid: '4282800', points: 0},
		IA: {name: 'Iowa',				biggest_city: 'Des Moines',		locid: '4285091', points: 0},
		KS: {name: 'Kansas',			biggest_city: 'Wichita',		locid: '4285594', points: 0},
		KY: {name: 'Kentucky',			biggest_city: 'Louisville',		locid: '4290676', points: 0},
		LA: {name: 'Louisiana',			biggest_city: 'New Orleans',	locid: '4229577', points: 0},
		ME: {name: 'Maine',				biggest_city: 'Portland',		locid: '4296637', points: 0},
		MD: {name: 'Maryland',			biggest_city: 'Baltimore',		locid: '4302723', points: 0},
		MA: {name: 'Massachusetts',		biggest_city: 'Boston',			locid: '4305532', points: 0},
		MI: {name: 'Michigan',			biggest_city: 'Detroit',		locid: '4228588', points: 0},
		MN: {name: 'Minnesota',			biggest_city: 'Minneapolis',	locid: '4309353', points: 0},
		MS: {name: 'Mississippi',		biggest_city: 'Jackson',		locid: '4313841', points: 0},
		MO: {name: 'Missouri',			biggest_city: 'Kansas City',	locid: '4318132', points: 0},
		MT: {name: 'Montana',			biggest_city: 'Billings',		locid: '4321279', points: 0},
		NE: {name: 'Nebraska',			biggest_city: 'Omaha',			locid: '4322581', points: 0},
		NV: {name: 'Nevada',			biggest_city: 'Las Vegas',		locid: '4322810', points: 0},
		NH: {name: 'New Hampshire',		biggest_city: 'Manchester',		locid: '4324100', points: 0},
		NJ: {name: 'New Jersey',		biggest_city: 'Newark',			locid: '4325924', points: 0},
		NM: {name: 'New Mexico',		biggest_city: 'Albuquerque',	locid: '4329145', points: 0},
		NY: {name: 'New York',			biggest_city: 'New York',		locid: '4335338', points: 0},
		NC: {name: 'North Carolina',	biggest_city: 'Charlotte',		locid: '4156292', points: 0},
		ND: {name: 'North Dakota',		biggest_city: 'Fargo',			locid: '4158639', points: 0},
		OH: {name: 'Ohio',				biggest_city: 'Columbus',		locid: '4166593', points: 0},
		OK: {name: 'Oklahoma',			biggest_city: 'Oklahoma City',	locid: '4168588', points: 0},
		OR: {name: 'Oregon',			biggest_city: 'Portland',		locid: '4169518', points: 0},
		PA: {name: 'Pennsylvania',		biggest_city: 'Philadelphia',	locid: '4180252', points: 0},
		RI: {name: 'Rhode Island',		biggest_city: 'Providence',		locid: '4181392', points: 0},
		SC: {name: 'South Carolina',	biggest_city: 'Columbia',		locid: '4185236', points: 0},
		SD: {name: 'South Dakota',		biggest_city: 'Sioux Falls',	locid: '4187954', points: 0},
		TN: {name: 'Tennessee',			biggest_city: 'Memphis',		locid: '4194655', points: 0},
		TX: {name: 'Texas',				biggest_city: 'Houston',		locid: '4200880', points: 0},
		UT: {name: 'Utah',				biggest_city: 'Salt Lake City',	locid: '4207755', points: 0},
		VA: {name: 'Virginia',			biggest_city: 'Virginia Beach',	locid: '4214914', points: 0},
		VT: {name: 'Vermont',			biggest_city: 'Burlington',		locid: '4207755', points: 0},
		WA: {name: 'Washington',		biggest_city: 'Seattle',		locid: '4216696', points: 0},
		WV: {name: 'West Virginia',		biggest_city: 'Charleston',		locid: '4221825', points: 0},
		WI: {name: 'Wisconsin',			biggest_city: 'Milwaukee',		locid: '4225281', points: 0},
		WY: {name: 'Wyoming',			biggest_city: 'Cheyenne',		locid: '4226349', points: 0}
	},
	
	m_cht:		't',
	m_chtm:		'usa',
	m_chs:		'440x220',
	//m_chco:	'FFFFFF,d60000,f3f698,00dd00',
	m_chco:		'ffffff,bb0000,ffffff,00bb00',
	//m_chf:	'bg,s,fcfcfc',
	m_chf:		'bg,s,f6f6f6',
	m_chld:		'',
	m_chd:		't:',
	
	initialize: function (data) {
		this.m_data = data;
		this.drawMap ();
		var res = '', answers = this.m_data[this.m_position].answers;
		for (i = 0; i < answers.length; i++) {
			res += '<li><a href="#" onclick="MatchGrapher.answer(' + i + '); return false;">' + answers[i] + '</a></li>';
		}
		$('question_text').update ((this.m_position+1) + ': ' + this.m_data[this.m_position].question);
		$('question_answers').update (res);
		if (SCREENNAME == '')
			this.createLocationExperience ();
		else
			this.getUserGentation ();
	},
	
	createLocationExperience: function () {
		this.m_location_experience = new OkLocation ({
			debug:					false,
			dest_div:				'location_input',
			loc_id_input_name:		'locid', 
			query_input_name:		'lquery',
			cb_success:				this.locationGood,
			cb_error:				this.locationBad,
			cb_reset:				this.locationReset
		});
		this.observeLocation ();
	},
	
	locationGood: function (oklocation_instance) {
		MatchGrapher.m_location_good = true;
		if ($('not_found').visible()) $('not_found').fade ({duration: 0.25});
		if (!$('continue').visible()) setTimeout ("$('continue').appear ({duration: 0.25});", 400);
	},
	
	locationBad: function (oklocation_instance) {
		MatchGrapher.m_location_good = false;
		if (oklocation_instance.Status == 'pulldown')
			$('not_found_text').update ('We found multiple matches.  Please choose one.');
		else
			$('not_found_text').update ('We couldn\'t find this location.  Please try again.');
		if ($('continue').visible()) $('continue').fade ({duration: 0.25});
		if (!$('not_found').visible ()) setTimeout ("$('not_found').appear ({duration: 0.25});", 400);
	},
	
	locationReset: function (oklocation_instance) {
		$('current_location').appear ({from: $('current_location').getOpacity(), to: 1.0, duration: 0.25});
		if ($('not_found').visible()) $('not_found').fade ({duration: 0.25});
		if ($('continue').visible()) $('continue').fade ({duration: 0.25});
		MatchGrapher.observeLocation ();
	},
	
	observeLocation: function () {
		var location_input = $('location_input').select('input').first();
		location_input.observe ('focus', function () {
			if (this.value.blank () && !(BrowserDetect.browser == 'Explorer'))
				$('current_location').fade ({from: $('current_location').getOpacity(), to: 0.4, duration: 0.25});
			if (!this.value.blank && !$('continue').visible())
				$('continue').appear ({duration: 0.25});
		});
		location_input.observe ('blur', function () {
			if (this.value.blank ()) {
				$('current_location').appear ({from: $('current_location').getOpacity(), to: 1.0, duration: 0.25});
				if ($('continue').visible())
					$('continue').fade ({duration: 0.25});
			}
		});
		location_input.observe ('keyup', function () {
			if (this.value.blank () && $('continue').visible ()) {
				$('current_location').appear ({from: $('current_location').getOpacity(), to: 1.0, duration: 0.25});
				$('continue').fade ({duration: 0.25});
			}
			else if (!this.value.blank() && !$('continue').visible()) {
				if (!(BrowserDetect.browser == 'Explorer'))
					$('current_location').fade ({from: $('current_location').getOpacity(), to: 0.4, duration: 0.25});
				$('continue').appear ({duration: 0.25});
			}
		});
	},
	
	getUserGentation: function () {
		new Ajax.Request ('/rjs/userinfo', {
			parameters: {
				u: SCREENNAME,
				template: 'userinfo/ajax.html'
			},
			onSuccess: function (transport) {
				var response = transport.responseText.evalJSON ();
				switch (response.gender) {
					case 'M': var gender = 'Male'; break;
					case 'F': var gender = 'Female'; break;
				}
				switch (response.sexpref) {
					case 'Straight': 	var orientation = 'Straight'; break;
					case 'Gay':			var orientation = 'Gay'; break;
					case 'Bisexual':	var orientation = 'Bi'; break;
				}
				MatchGrapher.m_gentation = orientation + gender;
			}
		});
	},

	// Each time a question is answered, points from 0 to (100/num questions) are given
	// to each state.  The points are given in order of lowest percent agreement to highest
	// percent agreement.
	//
	// Problems with this function/approach:
	//  - drawMap (); cannot be called at any time
	//
	calculateStatePoints: function () {
		if (this.m_position) {
			var state_array = [],
				question_data = this.m_data[this.m_position];
			for (var state in question_data) {
				if (this.m_state_data[state]) {
					state_array.push (question_data[state]);
					state_array[state_array.length-1].state = state;
				}
			}
			// The try is for IE6, which seems to fail inexplicably somewhere in
			// this sort for certian questions
			try {
				state_array.sort(function(a, b){
					if (!a[MatchGrapher.m_gentation] || !b[MatchGrapher.m_gentation]) 
						return 0;
					var a_fraction = a[MatchGrapher.m_gentation][MatchGrapher.m_last_answer] / a[MatchGrapher.m_gentation].sum();
					var b_fraction = b[MatchGrapher.m_gentation][MatchGrapher.m_last_answer] / b[MatchGrapher.m_gentation].sum();
					return a_fraction - b_fraction;
				});
			}
			catch (error) { /* Do nothing */ }
			for (var i = 0; i < state_array.length; i++) {
				this.m_state_data[state_array[i].state].points += (i/state_array.length) * (100/this.m_data.length);
				//console.log (state_array[i].state + ': points: ' + this.m_state_data[state_array[i].state].points + ', i: ' + i + ', state_array.length: ' + state_array.length + ', this.m_data.length: ' + this.m_data.length);
			}
		}
	},
	
	// We want to make sure that we're using the maximum color gradient, so take
	// the state points and scale them so that they range
	// from 0 to (100/num_questions) * current_question_number
	scaleStatePoints: function () {
		var min = null, max = null;
		for (var state in this.m_state_data) {
			if (min == null || this.m_state_data[state].points < min) {
				min = this.m_state_data[state].points;
			}
			if (max == null || this.m_state_data[state].points > max) max = this.m_state_data[state].points;
		}
		var difference = max - min;
		var possible = this.m_position * (100/this.m_data.length);
		var scale = difference == 0 ? 0 : possible / difference;
		for (var state in this.m_state_data) {
			var scaled_points = (this.m_state_data[state].points - min) * scale;
			this.m_state_data[state].scaled = scaled_points + 50 - (difference * scale / 2);
		}	
	},
	
	// Use the scaled points to generate a string for the chart data
	generateGraphString: function () {
		this.calculateStatePoints ();
		this.scaleStatePoints ();
		var states = '', values = '';
		for (state in this.m_state_data) {
			states += state;
			values += this.m_state_data[state].scaled.round () + ',';
		}
		this.m_chld = states;
		this.m_chd = 't:' + values.substr(0, values.length - 1);
	},
	
	// Do NOT call this outside of actually answering a question.  It will double
	// points for the last question answered.
	drawMap: function () {
		this.generateGraphString ();
		var src = 'http://chart.apis.google.com/chart?'
			+ 'cht=' + this.m_cht
			+ '&chtm=' + this.m_chtm
			+ '&chs=' + this.m_chs
			+ '&chco=' + this.m_chco
			+ '&chf=' + this.m_chf
			+ '&chld=' + this.m_chld
			+ '&chd=' + this.m_chd
		$('match_graph').writeAttribute('src', src).show();
	},
	
	answer: function (i) {
		this.m_last_answer = i;
		this.moveQuestion ('next');
		this.drawMap ();
	},
	
	moveQuestion: function (direction) {
		if (this.m_position == this.m_data.length - 1 && direction == 'next') {
			this.finish ();
		}
		else if (this.m_position == 0 && direction == 'previous') {
			return;
		}
		else {
			this.m_position += direction == 'next' ? 1 : -1;
			var res = '', answers = this.m_data[this.m_position].answers;
			for (i = 0; i < answers.length; i++) {
				res += '<li><a href="#" onclick="MatchGrapher.answer(' + i + '); return false;">' + answers[i] + '</a></li>';
			}
			$('question_text').update ((this.m_position+1) + ': ' + this.m_data[this.m_position].question);
			$('question_answers').update (res);
			if (SCREENNAME == '') {
				switch (this.m_position) {
					case 3:
						$('question_wrap', 'gentation_wrap').invoke ('toggle');
						break;
					case 5:
						util.updateStats ('match map - questions answered - 5', 1, 'count', '06Ek7omeZffmkVFUWyLi5HMMvAE=');
						break;
					case 6:
						$('question_wrap', 'status_wrap').invoke ('toggle');
						break;
					case 9:
						$('question_wrap', 'location_wrap').invoke ('toggle');
						break;
					case 10:
						util.updateStats ('match map - questions answered - 10', 1, 'count', '/R83+qW26MhQSXOVbUjbQZq20w4=');
						break;
					case 12:
						$('question_wrap', 'birthday_wrap').invoke ('toggle');
						break;
					case 15:
						util.updateStats ('match map - questions answered - 15', 1, 'count', 'i8N0QnXsrMmR+N1OtUAGS0oTEZ0=');
						break;
				}				
				if (this.m_position == 5 && !$('match_area').visible ()) {
					this.showMatches ();
				}
				else if (this.m_position > 5 && this.m_position % 4 == 0) {
					this.generateMatches ();
				}
			}
		}
	},
	
	checkGentation: function () {
		var orientation = $F('orientation'), gender = $F('gender');
		 if (orientation != '0' && gender != '0') {
			this.m_gentation = orientation + gender;
			switch (orientation) {
				case 'Straight':	this.m_signup_data.orientation = 1;
				case 'Gay':			this.m_signup_data.orientation = 2;
				case 'Bi':			this.m_signup_data.orientation = 3;
			}
			switch (gender) {
				case 'Male':		this.m_signup_data.gender = 1;
				case 'Female':		this.m_signup_data.gender = 2;
			}
		 	$('question_wrap', 'gentation_wrap').invoke ('toggle');
		 }
	},
	
	checkStatus: function () {
		if ($F('status') != '0') {
			this.m_signup_data.status = $F('status');
			$('question_wrap', 'status_wrap').invoke ('toggle');
		}
	},
	
	checkLocation: function (location_case) {
		switch (location_case) {
			case 'current':
				$('question_wrap', 'location_wrap').invoke ('toggle');
				break;
			case 'new':
				if (this.m_location_good) {
					this.m_signup_data.lquery = $F('lquery');
					this.m_signup_data.locid = $F('locid');
					$('location').update ($F('lquery'));
					$('question_wrap', 'location_wrap').invoke ('toggle');
				}
				else {
					return false;
				}
				break;
		}
	},
	
	checkBirthday: function () {
		if ($F('birthmonth') != '0' && $F('birthday') != '0' && $F('birthyear') != '0') {
			this.m_signup_data.birthmonth = $F('birthmonth');
			this.m_signup_data.birthday = $F('birthday');
			this.m_signup_data.birthyear = $F('birthyear');
			$('question_wrap', 'birthday_wrap').invoke('toggle');
		}
	},
	
	checkSignup: function (location_case) {
		if (!$('final').visible() && $F('email').length && $F('screenname').length && $F('signup_password').length)
			$('final').show();
	},
	
	showMatches: function () {
		if (BrowserDetect.browser == 'Explorer')
			$('question_area').addClassName ('left_align');
		else
			$('question_area').morph ('margin-left: 30px; width: 340px;');
		setTimeout ("$('match_area').appear ();", 1100);
		this.generateMatches ();
	},
	
	generateMatches: function (last) {
		var gentation = 63, num_matches = last ? 5 : 3;
		switch (this.m_gentation) {
			case 'StraightMale':		var gentation = 34; break;
			case 'StraightFemale':		var gentation = 17; break;
			case 'GayMale':				var gentation = 20; break;
			case 'GayFemale':			var gentation = 40; break;
		}
		new MatchCall ({
			filters: [{name: 'radius', values: [100]}, {name: 'require_photo', values: [1]}, {name: 'gentation', values: [gentation]}],
			sorts: [{name: "personality", weight: 5}, {name: "random", weight: 10}, {name: "login", weight: 5}, {name: "distance", weight: 10}],
			count: 30,
			onSuccess: function (transport) {
				var users = transport.responseText.evalJSON().match_list, res = '';
				if (!MatchGrapher.m_user_location)
					MatchGrapher.getUserLocation (users);
				for (var i = 0; i < num_matches; i++) {
					res += 	'<div class="user clearfix">';
					if (last)
						res += '<a class="img" href="#" onclick="MatchGrapher.toggleSignup(); return false;">'
					else
						res += '<a class="img" href="/signup?entry=/signup/paths/original/1.html" target="_blank">'
					res += '<img src="http://cdn.okcimg.com/php/load_okc_image.php/images/82x82/82x82/' + users[i].thumbnail_filepath + '" alt="An image of ' + users[i].username + '" title="OkCupid user ' + users[i].username + '" width="82" height="82"/></a><p class="aso">'
					if (last)
						res += '<a href="#" onclick="MatchGrapher.toggleSignup(); return false;">'
					else
						res += '<a href="/signup?entry=/signup/paths/original/1.html" target="_blank">'
					res += '<span class="user">' + users[i].username + '</span><span class="dash">&mdash;</span>' + users[i].age + ' / ' + (users[i].gender == 'f' ? 'female' : 'male') + '</a></p><p class="desc">' + users[i].uber_description.substr(0,90) + '...</p></div>'
				}
				last ? $('last_matches').update(res) : $('matches').update (res);
			}
		});
	},
	
	// Take an array of users and figure out what the current user's
	// location is by finding the most common location in that set
	getUserLocation: function (users) {
		var locations = {}, locids = {};
		for (var i = 0; i < users.length; i++) {
			if (!locations[users[i].location]) {
				locations[users[i].location] = 1;
				locids[users[i].location] = users[i].locid;
			}
			else {
				locations[users[i].location] += 1;
			}
		}
		var max_count = 0, max_location = '', max_locid = '';
		for (var location in locations) {
			if (locations[location] > max_count) {
				max_count = locations[location];
				max_location = location;
				max_locid = locids[location];
			}
		}
		$('location', 'user_location').invoke ('update', max_location);
		this.m_signup_data.lquery = max_location;
		this.m_signup_data.locid = max_locid;
		this.m_user_location = max_location;
	},
	
	finish: function () {
		var state_array = [];
		for (var state in this.m_state_data) {
			state_array.push (this.m_state_data[state]);
		}
		state_array.sort (function (a, b) {return b.points - a.points;});
		var gentation_match = this.gentationToNumber (this.m_gentation);
		for (var i = 0, res = ''; i < 5; i++) {
			if (SCREENNAME == '')
				res += '<li><a href="#" onclick="MatchGrapher.toggleSignup(\'' + state_array[i].locid + '\', \'' + state_array[i].biggest_city + ', ' + state_array[i].name + '\'); return false;">' + state_array[i].name + '</a></li>';
			else
				res += '<li><a href="/match?locid=' + state_array[i].locid + '&lquery=' + state_array[i].biggest_city + '&filter1=0,' + gentation_match + '&filter2=2,18,99&filter3=3,25&filter4=5,315360000&filter5=1,1&filter6=7,1">' + state_array[i].name + '</a></li>';
		}
		$('best_matches').update (res);
		state_array.sort (function (a, b) {return a.points - b.points;});
		for (var i = 0, res = ''; i < 5; i++) {
			if (SCREENNAME == '')
				res += '<li><a href="#" onclick="MatchGrapher.toggleSignup(\'' + state_array[i].locid + '\', \'' + state_array[i].biggest_city + ', ' + state_array[i].name + '\'); return false;">' + state_array[i].name + '</a></li>';
			else
				res += '<li><a href="/match?locid=' + state_array[i].locid + '&lquery=' + state_array[i].biggest_city + '&filter1=0,' + gentation_match + '&filter2=2,18,99&filter3=3,25&filter4=5,315360000&filter5=1,1&filter6=7,1">' + state_array[i].name + '</a></li>';
		}
		$('worst_matches').update (res);
		if (SCREENNAME == '') {
			$('curious').show ();
			Effect.multiple(['match_area', 'question_area'], Effect.DropOut)
			setTimeout("$('finished').appear();", 1500)
		}
		else {
			$('question_area').fade ();
			setTimeout ("$('finished').appear();", 1100);
		}
		if (SCREENNAME == '')
			this.generateMatches (true);
		util.updateStats ('match map - questions answered - 20', 1, 'count', 'O/EVwNMAA0XZNeoMSHk1890w2X4=');
	},
	
	toggleSignup: function (locid, lquery) {
		if (locid && lquery) {
			this.m_match_data.locid = locid;
			this.m_match_data.lquery = lquery;
		}
		else {
			this.m_match_data.locid = this.m_signup_data.locid;
			this.m_match_data.lquery = this.m_signup_data.lquery;
		}
		if ($('finished').visible()) {
			$('finished').fade ({duration:0.5});
			setTimeout ("$('signup').appear ({duration:0.5});", 600);
		}
		else {
			$('signup').fade ({duration:0.5});
			setTimeout ("$('finished').appear ({duration:0.5});", 600);
		}
	},
	
	signup: function () {
		// The rest of the signup vars
		this.m_signup_data.email				= $F('email');
		this.m_signup_data.email2				= $F('email');
		this.m_signup_data.screenname			= $F('screenname');
		this.m_signup_data.password				= $F('signup_password');
		this.m_signup_data.captcha_key			= $F('captcha_key');
		this.m_signup_data.captcha_input		= $F('captcha_input');
		this.m_signup_data.testcheck			= '1';
		this.m_signup_data.opento				= '1';
		
		var gentation_match = this.gentationToNumber (this.m_gentation);
		
		// Vars for websrv
		this.m_signup_data.corrections_page		= '/signup/paths/common/corrections.html';
		this.m_signup_data.success_redirect		= '/match?locid=' + this.m_match_data.locid + '&lquery=' + this.m_match_data.lquery + '&filter1=0,' + gentation_match + '&filter2=2,18,99&filter3=3,25&filter4=5,315360000&filter5=1,1&filter6=7,1&cf=match_map';
		this.m_signup_data.path_nickname		= 'match_map';
		this.m_signup_data.cf					= 'match_map';	
		
		var signup_form = new Element ('form', {action: '/signup', method: 'post'});
		for (var key in this.m_signup_data) {
			signup_form.appendChild (new Element ('input', {type: 'hidden', name: key, value: this.m_signup_data[key]}));
		}
		
		$(document.body).appendChild (signup_form);
		signup_form.submit ();
	},
	
	gentationToNumber: function (gentation) {
		switch (gentation) {
			case 'StraightMale':	return 34; break;	// Girls who like guys
			case 'StraightFemale':	return 17; break;	// Guys who like girls
			case 'GayMale':			return 20; break;	// Guys who like guys
			case 'GayFemale':		return 40; break;	// Girls who like girls
			case 'BiMale':			return 54; break;	// Both who like bi guys
			case 'BiFemale':		return 57; break;	// Both who like bi girls
		}
	}
});






// USE success_redirect INSTEAD OF success_page

/*
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'corrections_page', value: '/signup/paths/common/corrections.html'}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'success_page', value: '/match/match.html'}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'lquery', value: this.m_match_data.lquery}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'locid', value: this.m_match_data.locid}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'path_nickname', value: 'match_map'}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'cf', value: 'match_map'}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'testcheck', value: '1'}));
signup_form.appendChild (new Element ('input', {type: 'hidden', name: 'opento', value: '1'}));
*/



// old calculateStatePoints method:
// Every state gets (100/num_questions) points per agreement with the user
// the maximum is 100 (all in agreement), min is 0 (no agreements)

/*
for (var state in this.m_state_data) {
	this.m_state_data[state].points = 0;
}
for (var i = 0; i < this.m_position; i++) {
	var question_data = this.m_data[i];
	for (var state in question_data) {
		if (this.m_state_data[state]) {
			if (question_data[state][this.m_gentation]) {
				// Find which index has the highest count
				var gentation_data = question_data[state][this.m_gentation];
				for (var j = 0, min_index = 0, min_val = 0; j < question_data.answers.length; j++) {
					if (gentation_data[j] > min_val) {
						min_index = j;
						min_val = gentation_data[j];
					}
				}
				if (min_index == question_data.user_answer) {
					this.m_state_data[state].points += 100 / this.m_data.length;
				}
			}
			else {
				this.m_state_data[state].points += (100/this.m_data.length)/2;
			}
		}
	}
}
*/







 
AUTOCORE_SELF_CHECK.pop();
	
addNewCoresToCookie(["0", "1", "3", "4", "5", "6", "8", "9", "18", "23", "24", "25", "27", "28", "29", "32", "33", "35", "38", "40", "42", "71"], "0b4e60a8"); 
