/*var Fort = window.Fort || {};

Object.extend(Form.Element.Methods, { check: function(element) { element = $(element); element.checked = true; return element; }, uncheck: function(element) { element = $(element); element.checked = false; return element; } });
Object.extend(Form.Methods, { check: function(form, name) { $(form).getInputs('checkbox', (name ? name : null)).invoke('check'); }, uncheck: function(form, name) { $(form).getInputs('checkbox', (name ? name : null)).invoke('uncheck'); } });
Element.addMethods();

Fort.go = function(location) {
  document.location = location;
};

Fort.toggle = function() {
  $A(arguments).each(Element.toggle);
};


Fort.editComment = function(cId) {
  Fort.toggle('cId_t' + cId, 'cId_e' + cId);
};

Fort.confirm = function(message) {
  return !!confirm(message);
};

Fort.pmCheck = function(check) {
  $('pmform')[(check != false ? '' : 'un') + 'check']();
};

Fort.addBB = function(element, tag, endtag) {
  element = $(element);
  element.focus();
  if(Object.isUndefined(endtag)) endtag = tag;
  tag = '[' + tag +']';
  endtag = '[/' + endtag +']';
  if (document.selection) {
    var oRange = document.selection.createRange();
    var numLen = oRange.text.length;
    oRange.text = tag + oRange.text + endtag ;
    return false;
  }
  else if (element.setSelectionRange) {
    var selStart = element.selectionStart, selEnd = element.selectionEnd;
    element.value = element.value.substring(0, selStart) + tag + element.value.substring(selStart, selEnd) + endtag + element.value.substring(selEnd);
    element.setSelectionRange(selStart + tag.length, selEnd + tag.length);
  }
  else {
    element.value += tag + endtag;
  }
};

Fort.selectCode = function(a) {
  // Get ID of code block
  var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
  if (window.getSelection) { // Not IE
    var s = window.getSelection();
    if (s.setBaseAndExtent) { // Safari
      s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
    }
    else { // Firefox and Opera
      var r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
    }
  }
  else if (document.getSelection) { // Some older browsers
    var s = document.getSelection();
    var r = document.createRange();
    r.selectNodeContents(e);
    s.removeAllRanges();
    s.addRange(r);
  }
  else if (document.selection) { // IE
    var r = document.body.createTextRange();
    r.moveToElementText(e);
    r.select();
  }
};

Fort.Scroller = Class.create({
  initialize: function(element) {
    this.element = element;
    this.links = [];
    this.counter = 0;
    this.link;
    document.observe('dom:loaded', this.onDomLoad.bindAsEventListener(this));
  },
  onDomLoad: function() {
    this.element = $(this.element);
    this.title = this.element.firstDescendant().innerHTML;
    this.element.select('ul li a').each(function(item, index){
      this.links[index] = new Element('a', { href: item.href }).update(item.innerHTML);
    }, this);
    this.updateLink();
    this.link.show();
    window.setInterval(this.rotateLink.bindAsEventListener(this), 3000);
  },
  updateLink: function() {
    if(this.counter > this.links.length - 1) this.counter = 0;
    this.link = this.links[this.counter++];
    this.link.hide();
    this.element.update(this.title + ' | ');
    this.element.insert(this.link);
  },
  rotateLink: function() {
    var duration = 0.5;
    this.link.fade({
      duration: duration,
      afterFinish: function() {
        this.updateLink();
        this.link.appear({ duration: duration });
      }.bind(this)
    });
  }
});

Fort.News = Class.create({
  initialize: function(options) {
    this.options = {
      delay: 10,
      transition: 0.5,
      controls: true,
      autoPlay: false
    };
    Object.extend(this.options, options || {});
    this.news = [];
    this.counter = 0;
    this.timer = null;
    this.playing = this.options.autoPlay;
    this.container = new Element('div');
    this.post = new Element('div');
    this.container.update(this.post);
    document.observe('dom:loaded', this.onDomLoad.bindAsEventListener(this));
  },
  onDomLoad: function() {
    var news = $$('.newsAll');
    news.each(function(item, index) {
      this.news[index] = item;
      this.amount++;
    }, this);
    news[0].insert({ before: this.container });
    news.invoke('remove');
    $$('.navigation').invoke('remove');
    this._updatePost(0);
    if (this.options.autoPlay == true) this.play();
    this.post.show();
    if (this.options.controls == true) this.controls();
  },
  _change: function(direction) {
    this.post.fade({
      duration: this.options.transition,
      afterFinish: function() {
        this._updatePost(direction);
        this.post.appear({ duration: this.options.transition });
      }.bind(this)
    });
  },
  _updatePost: function(direction) {
    this.counter = this.counter + direction;
    if (direction === 1 && this.counter > this.news.length - 1) this.counter = 0;
    if (direction === -1 && this.counter < 0) this.counter = this.news.length - 1;
    this.post.update(this.news[this.counter]).hide();
  },
  controls: function() {
    this.playControl = new Element('a', { href: 'javascript:void(0);' }).
      observe('click', this.togglePlay.bindAsEventListener(this)).
      update((this.options.autoPlay == true ? 'Pause' : 'Play'));
    this.container.insert(new Element('div', { align: 'center' }).
      insert(new Element('a', { href: 'javascript:void(0);' }).
        update('Previous').
        observe('click', this.previous.bindAsEventListener(this))).
      insert('&nbsp;').
      insert(this.playControl).
      insert('&nbsp;').
      insert(new Element('a', { href: 'javascript:void(0);' }).
        update('Next').
        observe('click', this.next.bindAsEventListener(this))));
  },
  next: function() {
    this._change(1);
    if (this.playing == true) this.restartTimer();
  },
  previous: function() {
    this._change(-1);
    if (this.playing == true) this.restartTimer();
  },
  play: function() {
    this.timer = window.setInterval(this.next.bindAsEventListener(this), this.options.delay * 1000);
    this.playControl.update('Pause');
    this.playing = true;
  },
  pause: function() {
    clearInterval(this.timer);
    this.timer = null;
    this.playControl.update('Play');
    this.playing = false;
  },
  restartTimer: function() {
    clearInterval(this.timer);
    this.timer = null;
    this.timer = window.setInterval(this.next.bindAsEventListener(this), this.options.delay * 1000);
    this.playing = true;
  },
  togglePlay: function() {
    this[(this.playing ==true ? 'pause' : 'play')]();
  }
});

Fort.altFlag = function(img) {
  img.src = '../images/flags/ziflag.png';
  img.onerror = '';
  return true;
};

Fort.altNewsImage = function(img) {
  img.src = 'http://www.zeroidentity.org/beta/images/icons/icon%20(34).png';
  img.onerror = '';
  return true;
};

Fort.altMedal = function(img) {
  img.src = '../images/medals/trophy.png';
  img.onerror = '';
  return true;

};

Fort.altAvatar = function(img) {
  img.src = '../images/unknown.png';
  img.onerror = '';
  return true;

};

Fort.toggleDiff = function() {
  var option = $F('difficulty'), elements = $$('.diff-easy', '.diff-easymod', '.diff-mod', '.diff-hardmod', '.diff-hard');
  if (option == 'diff-all') {
    elements.invoke('show');
    $('diff-null').hide();
  }
  else {
    var partition = elements.partition(function(item) {
      return item.hasClassName(option);
    });
    partition[1].invoke('hide');
    partition[0].invoke('show');
    $('diff-null')[partition[0].size() < 1 ? 'show' : 'hide']();
  }
};
  
Fort.removeInput = function(x) {
	if (x.value == "Username") x.value = '';
	
	if(x.value =="Password" && x.name == "password") {
		x.type = 'password';
		x.value = '';
		
	}
};

Fort.addInput = function(x) {
	if (x.name == "username" && x.value == "") x.value = 'Username';
	
	if(x.name == "password") {
		x.type = 'text';
		x.value = 'Password';

	}
};


var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "190";



document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;*/

takeMeTo = function(url)
{
	window.location = url;
}
