var d=document;

window.onload = function(){
	if (window.external && (typeof window.XMLHttpRequest == "undefined")) {
		fnLoadPngs();
	}
}

function fnLoadPngs() {
	for (var i = d.images.length - 1, img = null; (img = d.images[i]); i--) {
		if (img.src.match(/\.png$/i) != null) {
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='image')"
			img.src = "/images/spacer.gif";
		}
	}
	for (i=0; i<d.all.length; i++){
		var bg = d.all[i].currentStyle.backgroundImage;
		if (bg){
			if (bg.match(/\.png/i) != null){
				var mypng = bg.substring(5,bg.length-2);
				d.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='crop')";
				d.all[i].style.backgroundImage = "url('/images/spacer.gif')";
			}
		}
	}
}

function gB(){
	var n=navigator;
	var ua=' ' + n.userAgent.toLowerCase();
	var pl=n.platform.toLowerCase();
	var an=n.appName.toLowerCase();
	this.version = n.appVersion;
	this.dom=d.getElementById?1:0;
	this.ns=ua.indexOf('mozilla')>0;
	if(ua.indexOf('compatible')>0){this.ns = false;};
	this.ie=ua.indexOf('msie')>0;
	this.ie5=ua.indexOf("msie 5") != -1;
	this.mac=ua.indexOf('mac')>0;
	this.major=parseInt(this.version);
	this.minor=parseFloat(this.version);
	return this;
}
var is = new gB();


function aEvt(el, evtObj, Fn, b){
		if(document.addEventListener){
			bubble = false || b;
			el.addEventListener(evtObj, eval(Fn), bubble);
		}else if(document.attachEvent){
			el.attachEvent("on" + evtObj,eval(Fn));
		}
}
function dEvt(el, evtObj, Fn, b){
		if(document.addEventListener){
			bubble = false || b
			  el.removeEventListener(evtObj, eval(Fn), bubble);
		}else if(document.attachEvent){
			  el.detachEvent("on" + evtObj, eval(Fn));
		}
}

/* Element functions */
function gE(e){
	return d.getElementById(e);
}
function cE(t,e){
	var elem = d.createElement(t);
	elem.setAttribute('id', e);
	return elem;
}
function aC(e,p){
	return (p||d.body).appendChild(e);
}

/* Element style properties*/
function sV(e,v){
	e.style.display=v?"block":"none";
}
function sZ(e,z){
	e.style.zIndex=z;
}
function sO(e,p){
	if(typeof e.style.filter != 'undefined') e.style.filter = 'alpha(opacity='+p+')';
	else if(typeof e.style.MozOpacity != 'undefined') e.style.MozOpacity=p/100;
	else if(typeof e.style.khtmlOpacity != 'undefined') e.style.khtmlOpacity = p/100;
	else e.style.opacity = p/100;
	
	}
	
function sP(e,x,y){
	if(x != null){
		x=Math.round(x);
		e.x=x;
		e.style.left=px(x);
	}
	if(y != null){
		y=Math.round(y);
		e.y=y;
		e.style.top=px(y);
	}
}
function sX(e,x){e.style.left=px(x)};
function sY(e,y){e.style.top=px(y)};
function gX(e){parseInt(e.style.left)||e.style.pixelLeft||e.offsetLeft};
function gY(e){parseInt(e.style.top)||e.style.pixelTop||e.offsetTop};

function sD(e,h,w){
	if(h!=null){
		e.h=h;
		e.style.height=px(h);
	}
	if(w!=null){
		e.w=w;
		e.style.width=px(w);
	}
	e.style.clip='rect(0px '+ (e.style.width||(is.ie?'auto':'')) + ' ' + (e.style.height||(is.ie?'auto':'')) +' 0px)';
	e.style.overflow='hidden';
}
function sW(e,w){e.style.width=px(w);}
function sH(e,h){e.style.height=px(h);}

function wH(e,h){
	if(e.innerHTML)e.innerHTML=h;
}
function px(n){
	return(typeof n=='string')?n:n+'px';
}



	/* 
Slide function
*/
function slide(e,x,y,sp,func,xNow,yNow){
	var num;
	if(typeof e!='object'){
		num=e;
		e=slide.all[num];
		e.sliding=true;
	}
	else{
		if(e.sliding)return
	}
	xNow=xNow||parseInt(e.left||e.style.left||e.style.pixelLeft);
	yNow=yNow||parseInt(e.top||e.style.top||e.style.pixelTop);
	var distX=Math.abs(xNow-x);
	var distY=Math.abs(yNow-y);
	if(Math.round(xNow)!=x)xNow+=(distX/(30-sp)*sign(xNow,x));
	if(Math.round(yNow)!=y)yNow+=(distY/(30-sp)*sign(yNow,y));
	sX(e,px(Math.round(xNow)));
	sY(e,px(Math.round(yNow)));
	if(num==null){num=slide.all.length;slide.all[num]=e;}
	if(Math.round(xNow)!=x||Math.round(yNow)!=y)setTimeout('slide('+num+','+x+','+y+','+sp+',"'+func+'",'+xNow+','+yNow+')', 30);
	else{
		e.sliding=false;
		if(func!='')eval(func);
	}
}

slide.all=[];
function sign(x,y){
	return(x<y)?1:-1
}

/* Fading opacity function */
function fade(e,o,s,fn,o2){
	var num;
	if(typeof e!='object'){
		num=e;
		e=fade.all[num];
		e.fading=true;
	}
	else{
		if(e.fading)return
	}
		o2 = o2 || parseInt(e.style.filter || e.style.MozOpacity);
		var valF = Math.abs(o2-o);
		if(Math.round(o2)!= o)o2 += (valF/(10-s)*sign(o2,o));
		sO(e,o2);
		if(num==null){num=fade.all.length;fade.all[num]=e;}
		if(Math.round(o2)!= o)setTimeout('fade('+num+','+o+','+s+',"'+fn+'",'+o2+')', 10);
	else{
		e.fading=false;
		if(fn!='')eval(fn);
	}
}
fade.all=[];




/* Sliding clippng mask function */

function sC(e,t,r,b,l){
	e.style.clip='rect('+px(t)+' '+px(r)+' '+px(b)+' '+px(l)+')';
}


function clip(e,t,r,b,l,s,fn,t1,r1,b1,l1){
	var num;
	if(typeof e!='object'){num=e;e=clip.all[num];e.clipping=true;}
	else{if(e.clipping)return}
		var distT=Math.abs(t1-t);distR=Math.abs(r1-r);distB=Math.abs(b1-b);distL=Math.abs(l1-l);
		var newT=Math.round(t1);newR=Math.round(r1);newB=Math.round(b1);newL=Math.round(l1);
		if(newT!=t)t1+=(distT/(30-s)*sign(t1,t));
		if(newR!=r)r1+=(distR/(30-s)*sign(r1,r));
		if(newB!=b)b1+=(distB/(30-s)*sign(b1,b));
		if(newL!=l)l1+=(distL/(30-s)*sign(l1,l));
		sC(e,newT,newR,newB,newL);
		if(num==null){num=clip.all.length;clip.all[num]=e;}
		if(newT!=t||newR!=r||newB!=b||newL!=l)setTimeout('clip('+num+','+t+','+r+','+b+','+l+','+s+',"'+fn+'",'+t1+','+r1+','+b1+','+l1+')', 30);
	else{
		e.clipping=false;
		if(fn!='')eval(fn);
	}
}
clip.all=[];

/*XML HTTP Request*/
var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/
if (!xmlhttp && document.createElement) {
	try {
		xmlhttp = new XMLHttpRequest();
		}catch (e){
		xmlhttp=false
	}
}


function lP(t,u,fn){
	var c=gE(t);
	if (xmlhttp){
		 xmlhttp.open("GET", u,true);
		 xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState<4) {
			//wH(c,'Loading');
			}else{
			wH(c,xmlhttp.responseText);
			if(fn!=''){eval(fn);}
		}
	}
	xmlhttp.send(null);
	}else{
		window.status="No support for XMLHTTPRequest";
		location.href=redirectPage;
	}
}

