function $(o){
	return document.getElementById(o);
}

function $e(o,e){
	return $(o).getElementsByTagName(e);
}

function hasClass(e,c){
	if(!e){
		e=$(e);
	}
	var cs=e.className.split(' ');
	for(var i=0;i<cs.length;i++){
		if(cs[i]==c){
			return true;
		}
	}
	return false;
} 

function addClass(e,c){
	if(hasClass(e,c)){
		return true;
	} else {
		if(!e){
			e=$(e);
		}
		e.className+=' '+c;
	}
} 

document.getElementsByClassName=function(c){
	var r=[];
	var c = new RegExp('\\b'+c+'\\b');
	var e=this.getElementsByTagName('*');
	for(var i=0;i<e.length;i++){
		var cl=e[i].className;
		if(c.test(cl)){
			r.push(e[i]);
		}
	}
	return r;
}

function opacity(o,l){
	if(!o.style){o=$(o);}
	var o=o.style;
	o.opacity=(l/100);
	o.MozOpacity=(l/100);
	o.filter='alpha(opacity='+l+')';
} 

function offSet(o){var cl = ct = 0;if (o.offsetParent) {do {cl += o.offsetLeft;ct += o.offsetTop;} while (o = o.offsetParent);return [cl,ct];}}
function pageScroll(){var yScroll;if (self.pageYOffset) {yScroll = self.pageYOffset;} else if (document.documentElement && document.documentElement.scrollTop){yScroll = document.documentElement.scrollTop;} else if (document.body) {yScroll = document.body.scrollTop;}ps = new Array('',yScroll);return ps;}
function pageSize(){var xScroll,yScroll;if(window.innerHeight && window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement && document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}arPs=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arPs;}



function cubicEase(t,b,c,d){
	if((t/=d/2)<1){
		return c/2*t*t*t+b;
	}
	return c/2*((t-=2)*t*t+2)+b;
} 

function motion(o,sx,sy,dx,dy,steps,t){
	if(steps>=t){
		return false;
	} else {
		$(o).style.left=cubicEase(steps,sx,dx,t)+'px';
		$(o).style.top=cubicEase(steps,sy,dy,t)+'px';
		steps++;
		setTimeout('motion(\''+o+'\','+sx+','+sy+','+dx+','+dy+','+steps+','+t+')',15);
	}
} 

function moveTo(o,x,y,t){
	if(!o.style){
		o=$(o);
	}
	o.style.position='absolute';
	var sx=getX(o);
	var sy=getY(o);
	var dx=(x-sx);
	var dy=(y-sy);
	t=Math.floor((t/1000)*50);
	motion(o.id,sx,sy,dx,dy,1,t);
} 

function growTo(o,w,h,t){
	if(!o.style){
		o=$(o);
	}
	var sw=o.offsetWidth;
	var sh=o.offsetHeight;
	var dw=(w-sw);
	var dh=(h-sh);
	t=Math.floor((t/1000)*50);
	grow(o.id,sw,sh,dw,dh,1,t);
} 

function grow(o,sw,sh,dw,dh,steps,t){
	if(steps>=t){
		return false;
	}else{
		$(o).style.width=cubicEase(steps,sw,dw,t)+'px';
		$(o).style.height=cubicEase(steps,sh,dh,t)+'px';
		steps++;
		setTimeout('grow(\''+o+'\','+sw+','+sh+','+dw+','+dh+','+steps+','+t+')',15);
	}
} 

xhr=function(u,p,c,f){
	var X=null;
	if(window.XMLHttpRequest){
		X=new XMLHttpRequest();
	} else if(window.ActiveXObject){
		X=new ActiveXObject('Microsoft.XMLHTTP');
	}
	if(X!=null){
		if(p!=''){
			X.open('POST',u,false);
			X.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			X.send(p);
		}else{
			X.open('GET',u,true);
		}
		X.onreadystatechange=function(){
			if(X.readyState==4){
				if(X.status==200){
					c(X.responseText);
				}else{
					f(X.responseText);
				}
			}
		}
		X.send(null);
	} else {
		f();
	}
}

MKI = function(){
	var fb = document.getElementsByClassName('fadeBox');
	for(var i=0;i<fb.length;i++){
		fb[i].style.display = 'none';
	}
	var pb =  document.getElementsByClassName('twistyBox');
	for(var i=0;i<pb.length;i++){
		if(!hasClass(pb[i], 'twistyOpen')){
			pb[i].style.overflow = 'hidden';
			pb[i].style.height = '0px';	
		}
	}
	var ft = document.getElementsByClassName('togFade');
	for(var i=0;i<ft.length;i++){
		ft[i].href = '#'+ ft[i].getAttribute('ref');
		ft[i].onclick = function(){
			var b = document.createElement('div');
			b.id = 'mkiF';
			bs = b.style;
			bs.position='absolute';
			bs.top='0px';
			bs.left='0px';
			bs.zIndex='1900';
			bs.width='100%';
			bs.backgroundColor = '#fff';
			bs.height = (pageSize()[1] + pageScroll()[1]) + 'px';
			opacity(b,0);
			var c = document.createElement('div');
			c.id = 'mkiFc';
			var cs = c.style;
			cs.width = ($('contentContainer').offsetWidth - 200) + 'px';
			cs.height = (pageSize()[1] - 200) + 'px';
			cs.top=((pageSize()[1]-(pageSize()[1]-200))/2)+'px';
			cs.left=(((pageSize()[0]-($('contentContainer').offsetWidth - 200))/2)+'px');
			cs.position = 'absolute';
			cs.zIndex = '1901';
			cs.border = '1px #808080 solid';
			cs.padding = '10px';
			cs.overflow = 'auto';
			cs.backgroundColor = '#fff';
			opacity(c,0);
			c.innerHTML = '<img src=\'/ie/img/close.gif\' alt=\'close\' style=\'float:right;cursor:pointer;\' />'+ $(this.getAttribute('rel')).innerHTML;

			for(var i=0;i<90;i++){
				setTimeout('opacity(\'mkiFc\','+ i +');', i*2);
				setTimeout('opacity(\'mkiF\','+ i +');', i*2);
			}

			document.getElementsByTagName('body')[0].appendChild(c);
			document.getElementsByTagName('body')[0].appendChild(b);

			var sls = document.getElementsByTagName('select');
			for(i=0;i!=sls.length;i++){
				sls[i].style.visibility='hidden';
			}
			$e('mkiFc','img')[0].onclick = function(){	
				for(var i=0;i<90;i++){
					setTimeout('opacity(\'mkiFc\','+ (99-i) +');', i*2);
					setTimeout('opacity(\'mkiF\','+ (89-i) +');', i*2);
				}
				setTimeout('document.getElementsByTagName(\'body\')[0].removeChild($(\'mkiFc\'))', 400);
				setTimeout('document.getElementsByTagName(\'body\')[0].removeChild($(\'mkiF\'))', 400);
				for(i=0;i!=sls.length;i++){
					sls[i].style.visibility='visible';
				}
			};
			return false;
		}
	}
	var pt =  document.getElementsByClassName('togTwisty');
	for(var i=0;i<pt.length;i++){
		pt[i].href = '#'+ pt[i].getAttribute('ref');
		pt[i].onclick = function(){
			var o = $(this.getAttribute('rel'));
			if(!hasClass(o,'twistyOpen')){
				o.style.overFlow = 'auto';
				o.style.height = 'auto';
				var tarHeight = o.offsetHeight;
				o.style.overFlow = 'hidden';
				o.style.height = '0px';
				addClass(o,'twistyOpen');
			} else {
				var tarHeight = 0;
				o.className = o.className.replace('  ','').replace('twistyOpen','');
			}
			growTo(o, o.offsetWidth, tarHeight, 200);
		}
	}
	var a=document.createElement('link');a.type='text/css';a.rel='stylesheet';a.href='/ie/aug.css';a.media='screen';document.getElementsByTagName('head')[0].appendChild(a);
}
MKI();