var bSafari=bWebkit=(navigator.userAgent.indexOf("WebKit")!=-1),bIE=(!!(window.attachEvent&&!window.opera)),bIE6=(bIE&&parseFloat(navigator.appVersion.split("MSIE")[1])<7),bIE7=(bIE&&parseFloat(navigator.appVersion.split("MSIE")[1])<8),bGecko=(!bWebkit&&navigator.userAgent.indexOf("Gecko")!=-1);
function dummy(){}
function doNothing(){return false}
function hu$(A){if(document.getElementById){hu$=function(B){return document.getElementById(B)};return hu$(A)}if(document.all){hu$=function(B){return document.all[B]};return hu$(A)}}
var _e=new function(){
	this.c=function(n,i,p){var a=document.createElement(n);if(i){a.id=i};return a};
	this.a=function(p,tp){return p.appendChild(tp)};
	this.r=function(p,a){return p.removeChild(a)};
	this.getChild=function(p,a){return p.getElementsByTagName(a)}
};
function getObjleft(B){var A=B.offsetLeft;while((B=B.offsetParent)!=null){A+=B.offsetLeft}return A}
function getObjtop(B){var A=B.offsetTop;while((B=B.offsetParent)!=null){A+=B.offsetTop}return A}
function checkclass(o,c){var arrclasses=o.className.split(' ');for(var i=0;i<arrclasses.length;i++){if(arrclasses[i]==c){return true}};return false}
function checklinks(target){
	if(!target){target=document};
	for(var i=0;i<_e.getChild(target,'input').length;i++){
		var input=_e.getChild(target,'input')[i];
		if(checkclass(input,'box')){
			dean_addEvent(input,'focus',function(){this.className='box cur'});
			dean_addEvent(input,'blur',function(){this.className='box'});
			if(!bIE){dean_addEvent(input,'focus',function(){this.select()})};
			if(input.alt){
				if(input.value==''){input.value=input.alt.split('||')[0]};
				dean_addEvent(input,'focus',function(){if(this.value==this.alt.split('||')[0])this.value=''});
				dean_addEvent(input,'blur',function(){if(this.value=='')this.value=this.alt.split('||')[0]});
			}
		}
		if(checkclass(input,'realtimecheck')){_input.applyrealtimecheck(input)}
	}
	for(var i=0;i<_e.getChild(target,'div').length;i++){
		var checkDiv=_e.getChild(target,'div')[i]
		if(checkclass(checkDiv,'optionbox')){_optionbox.init(checkDiv)}
	}
}
var _optionbox=new function(){
	this.show=this.curoption=false;
	this.boxes=[];
	maskdiv=defaulttext=false;
	this.init=function(obj){
		var optionname=obj.id.substr(10),optiontitlediv=_e.getChild(obj,'a')[0];
		this.boxes[obj.id]={
			'name':optionname,
			'title':optiontitlediv,
			'defaulttext':optiontitlediv.innerHTML,
			'curtext':optiontitlediv.innerHTML,
			'curval':false
		};
		optiontitlediv.rel='TIP::'+optiontitlediv.innerHTML;
		var lis=_e.getChild(obj,'li');
		for(var i=0;i<lis.length;i++){
			if(_e.getChild(lis[i],'a')[0]){
				var ea=_e.getChild(lis[i],'a')[0];
				var curtext=ea.innerHTML;
				if(lis[i].className=='default'){
					optiontitlediv.innerHTML=this.boxes[obj.id].curtext=curtext;
					this.boxes[obj.id].curval=lis[i].value;
					lis[i].className='cur'
				}
				ea.onclick=function(){_optionbox.optionitem(this,obj.id)};
				if(i==lis.length-1){lis[i].className='last'}
			}
		};
		if(defaulttext==''){defaulttext=false};
		if(bIE){dean_addEvent(optiontitlediv,'focus',function(){if(this.blur)this.blur()})}
	}
	this.showoptions=function(obj){
		if(this.curoption){
			var showing=this.show;
			this.hideoptions();
			if(obj.parentNode.parentNode.id==this.curoption&&showing){this.curoption=false;return}
		}
		this.show=false;
		this.hid=false;
		this.curoption=obj.parentNode.parentNode.id;
		maskdiv=obj.parentNode;
		setTimeout(function(){
			maskdiv.className='show';
			var t=getObjtop(maskdiv)+maskdiv.offsetHeight;
			var scrolltop=(bSafari)?window.pageYOffset:document.documentElement.scrollTop;
			if(t+_e.getChild(maskdiv,'ul')[0].offsetHeight>scrolltop+document.documentElement.clientHeight){t=scrolltop+document.documentElement.clientHeight_e.getChild(maskdiv,'ul')[0].offsetHeight}
			_e.getChild(maskdiv,'ul')[0].style.top=t+'px';
			_e.getChild(maskdiv,'ul')[0].style.left=getObjleft(maskdiv)+((bIE6)?0:-1)+'px';
			_optionbox.show=true;
			obj.innerHTML=_optionbox.boxes[obj.parentNode.parentNode.id].defaulttext
		},5);
	};
	this.hideoptions=function(){if(this.show){maskdiv.className='';this.boxes[this.curoption].title.innerHTML=this.boxes[this.curoption].curtext;this.show=false;this.hid=true}}
	this.optionitem=function(obj,id){
		for(var i=0;i<_e.getChild(hu$(id),'li').length;i++){_e.getChild(hu$(id),'li')[i].className=''}
		this.boxes[id].curval=obj.parentNode.value;
		obj.parentNode.className='cur';
		this.boxes[id].title.innerHTML=this.boxes[id].curtext=obj.innerHTML
	}
}
var _input=new function(){
	this.init=this.show=this.curinp=false;
	this.applyrealtimecheck=function(obj){
		if(!this.init){this.initialize()};
		obj.onfocus=function(){_input.realtimecheckStart(obj)};
		obj.onkeyup=function(){_input.realtimecheckStart(obj)};
		obj.onblur=function(){_input.realtimecheckEnd()}
	};
	this.initialize=function(){
		this.init=_e.c('ul');
		this.init.className='inputrealtimecheck';
		_e.a(hu$('_techHu'),this.init);
	}
	this.realtimecheckStart=function(obj){
		this.curinp=obj;
		if(!_input.show){
			_input.init.style.left=getObjleft(obj)+'px';
			_input.init.style.top=(getObjtop(obj)+obj.offsetHeight-1)+'px';
			_input.show=true
		}
		_input.realtimecheckClear(true);
		if(obj.value!=''){
			var arr=eval(obj.alt.split('||')[1]),pointer=0;
			for(var i=1;i<arr.length;i++){
				for(var j=0;j<arr[i].length;j++){
					if(pointer==9){_input.init.innerHTML+='<li class="more">...</li>';return};
					if(arr[i][j].toLowerCase().indexOf(obj.value.toLowerCase())!=-1){
						_input.init.style.display='block';
						var eli=_e.c('li'),ea=_e.c('a');
						if(pointer==0){eli.className='first'};
						var tmp = arr[i][j].replace(/'/g,"\\\'");
						eli.innerHTML='<a href="javascript:;" onmousedown="_input.realtimeItemclick(\''+ tmp + '\')" style="width:'+(obj.offsetWidth-18)+'px">'+((arr[0].length>1)?'<span>'+arr[0][i-1]+'</span>':'')+''+arr[i][j]+'</a>'
						_e.a(_input.init,eli)
						pointer++
					}
				}
			}
		}
	}
	this.realtimecheckEnd=function(){setTimeout(function(){_input.realtimecheckClear()},10)}
	this.realtimecheckClear=function(text){
		if(!text){this.init.style.display='none';this.show=this.curinp=false}
		this.init.innerHTML='';
	}
	this.realtimeItemclick=function(val){
		this.curinp.value=val;
		this.curinp.focus();
		this.realtimecheckClear()
	}
}
function docCloseallframe(){
	_optionbox.hideoptions()
}
function DOMnow(u){
	var i=_e.c('div','_techHu');
	_e.a(document.body,i);
	if(typeof $atlasolinePower!='undefined'){$atlasolinePower.aOlA();$atlasolinePower.aOlI()}
	
	document.onclick=docCloseallframe;
	checklinks();
}
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
 
// http://dean.edwards.name/weblog/2005/10/add-event/
 
function dean_addEvent(element, type, handler) {
	if (element.addEventListener) {
		element.addEventListener(type, handler, false);
	} else {
		// assign each event handler a unique ID
		if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
		// create a hash table of event types for the element
		if (!element.events) element.events = {};
		// create a hash table of event handlers for each element/event pair
		var handlers = element.events[type];
		if (!handlers) {
			handlers = element.events[type] = {};
			// store the existing event handler (if there is one)
			if (element["on" + type]) {
				handlers[0] = element["on" + type];
			}
		}
		// store the event handler in the hash table
		handlers[handler.$$guid] = handler;
		// assign a global event handler to do all the work
		element["on" + type] = handleEvent;
	}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
 
function removeEvent(element, type, handler) {
	if (element.removeEventListener) {
		element.removeEventListener(type, handler, false);
	} else {
		// delete the event handler from the hash table
		if (element.events && element.events[type]) {
			delete element.events[type][handler.$$guid];
		}
	}
};
 
function handleEvent(event) {
	var returnValue = true;
	// grab the event object (IE uses a global event object)
	event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
	// get a reference to the hash table of event handlers
	var handlers = this.events[event.type];
	// execute each event handler
	for (var i in handlers) {
		this.$$handleEvent = handlers[i];
		if (this.$$handleEvent(event) === false) {
			returnValue = false;
		}
	}
	return returnValue;
};
 
function fixEvent(event) {
	// add W3C standard event methods
	event.preventDefault = fixEvent.preventDefault;
	event.stopPropagation = fixEvent.stopPropagation;
	return event;
};
fixEvent.preventDefault = function() {
	this.returnValue = false;
};
fixEvent.stopPropagation = function() {
  this.cancelBubble = true;
}
 
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
	forEach, version 1.0
	Copyright 2006, Dean Edwards
	License: http://www.opensource.org/licenses/mit-license.php
*/
 
// array-like enumeration
if (!Array.forEach){ // mozilla already supports this
	Array.forEach=function(array,block,context){for(var i=0;i<array.length;i++){block.call(context,array[i],i,array);}};
}
// generic enumeration
Function.prototype.forEach=function(object,block,context){
	for(var key in object){if(typeof this.prototype[key]=="undefined"){block.call(context,object[key],key,object);}}
};
// character enumeration
String.forEach=function(string,block,context){
	Array.forEach(string.split(""),function(chr,index){block.call(context,chr,index,string);});
};
// globally resolve forEach enumeration
var forEach=function(object,block,context){
	if(object){
		var resolve=Object; // default
		if(object instanceof Function){
			// functions have a "length" property
			resolve=Function;
		}else if(object.forEach instanceof Function){
			// the object implements a custom forEach method so use that
			object.forEach(block,context);
			return;
		}else if(typeof object=="string"){
			// the object is a string
			resolve=String;
		}else if(typeof object.length=="number"){
			// the object is array-like
			resolve=Array;
		}
		resolve.forEach(object,block,context);
	}
};
function serverinfo(){
	var servername =document.getElementById('realmName').value;
	document.getElementById('searchForm').submit();
}