




var env= {
	debug : true,
	avbl : ['sv', 'tr', 'en'],
	ie : /msie/i.test(navigator.userAgent),		
	gk : /gecko/i.test(navigator.userAgent),
	ff : /firefox/i.test(navigator.userAgent),
	sf : /safari/i.test(navigator.userAgent),	
	ax : typeof(ActiveXObject) == 'function'	
}

env.lang=(new RegExp(navigator.userLanguage,'i').test(env.avbl))? navigator.userLanguage : 'en';

String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g,'');
};

String.prototype.fill = function(i,c) {
	str = this; c = c || ' '; for (i=i; str.length<i; str+=c){}; 
	return str;
};

String.prototype.stripHTML = function() {
	return this.replace(/<.*?>/g, '');
};





if (env.ff) {

	Node.prototype.setCapture = function() {
	};

	Node.prototype.releaseCapture = function() {
	};

	Node.prototype.fireEvent = function(eType) {
		var e = document.createEvent('MouseEvents'); 
		e.initEvent(eType.slice(2), true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 
		this.dispatchEvent(e);
	};

	Node.prototype.attachEvent = function(e, h) {
		this.addEventListener(e.slice(2), h, false);
	};

	Node.prototype.detachEvent = function(e, h) {
		this.removeEventListener(e.slice(2), h, false);
	};

	Document.prototype.selectNodes = function(qXPath, xNode) {
		if(!xNode) xNode = this; 
		this.ns = this.createNSResolver(this.documentElement); 
		this.qI = this.evaluate(qXPath, xNode, this.ns, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 
		aResult = []; 
		for(i=0; i<this.qI.snapshotLength; i++) { 
			aResult[i] = this.qI.snapshotItem(i);
		} 
		return aResult;
	};

	Document.prototype.selectSingleNode = function(qXPath, xNode) {
		if(!xNode) { xNode = this; }
		this.xI = this.selectNodes(qXPath, xNode); 
		return (this.xI.length > 0)? this.xI[0] : null;
	};

	Element.prototype.selectNodes =	function(qXPath) {
		return this.ownerDocument.selectNodes(qXPath, this);
	};

	Element.prototype.selectSingleNode = function(qXPath) {
		return this.ownerDocument.selectSingleNode(qXPath, this);
	};

	Node.prototype.__defineGetter__('xml', function() {
		return (new XMLSerializer()).serializeToString(this);}
	);

	Node.prototype.__defineGetter__('outerHTML',	function() {
		return (new XMLSerializer()).serializeToString(this);}
	);

	Node.prototype.__defineSetter__('outerHTML',	function(s) {
		rng = this.ownerDocument.createRange(); 
		rng.setStartBefore(this); 
		cFrag = rng.createContextualFragment(s); 
		this.parentNode.replaceChild(cFrag, this);}
	);
	
	Event.prototype.__defineGetter__('event',	function() {
		return this;}
	);

	Event.prototype.__defineGetter__("fromElement", function () {
		var node;
		if (this.type == "mouseover") {
			node = this.relatedTarget;
		}
		else if (this.type == "mouseout") {
			node = this.target;
		}
		if (!node) { return; }
		while (node.nodeType != 1) { node = node.parentNode; }
		return node;
	});

	Event.prototype.__defineGetter__("toElement", function () {
		var node;
		if (this.type == "mouseout") {
			node = this.relatedTarget;
		}
		else if (this.type == "mouseover") {
			node = this.target;
		}
		if (!node) { return; }
		while (node.nodeType != 1) { node = node.parentNode; }
		return node;
	});

	Event.prototype.__defineGetter__("offsetX", function () {
		return this.layerX;
	});

	Event.prototype.__defineGetter__("offsetY", function () {
		return this.layerY;
	});

	Event.prototype.__defineGetter__('clientX', function() {
		return this.pageX;
	});

	Event.prototype.__defineGetter__('clientY', function() {
		return this.pageY;
	});

	Event.prototype.__defineGetter__('srcElement',	function() {
		node = this.target; 
		while (node.nodeType != 1) {
			node = node.parentNode; 
		}
		return node;
	});

	Event.prototype.__defineSetter__('cancelBubble',function(b) {
		if (b) this.stopPropagation();
	});

	Event.prototype.__defineSetter__('returnValue',	function(b) {
		if (!b) this.preventDefault();
	});
	

	var $e = ['click', 'dblclick', 'mouseover', 'mouseout', 'mousedown', 'mouseup', 'mousemove', 'keydown', 'keypress', 'keyup', 'focus', 'blur'];
        for (i=0; i<$e.length; i++) document.addEventListener($e[i], function(e) {window.event=e;}, true);


};



function init () {

    var input;

    var types = ['button','submit','reset'];
    for (var i = 0; (input = document.getElementsByTagName("INPUT")[i]); i++) {
	for (var type=0; type<types.length; type++){
	    if (input.type == types[type]) {
		input.onmouseover = function() {
			this.className = 'button_over';
		};
		input.onmouseout = function() {
			this.className = 'button';
		};
		input.className = 'button';
	    }
        }
    }

      var a;
      for (var i = 0; (a = document.getElementById('nav').getElementsByTagName('A')[i]); i++) {

		var text = a.innerHTML;

	    if (document.title.indexOf(text) != -1){
		//a.parentNode.className = 'selected';

		a.outerHTML = '<img src="/template/images/arrow.gif" />'+a.outerHTML+'';
	    }

      }
}





if (window != top) top.location.href = location.href;




window.onload = init;

