/*Paraselene generated this source file.*/
function paraselene_get_id(id){
	if(document.getElementById){
		return document.getElementById(id);
	}else if(document.all){
		return document.all(id);
	}else if(document.layers){
		return document.layers[id];
	}
}

function ParaseleneAjax(key,callback,msec){
	this.inteval=msec;
	this.callback=callback;
	this.key=key;
	this.http=null;
	this.no=-1;
}

var paraselene_holder=new Array(0);

function paraselene_receive(ps){
	if(ps.http.readyState==4){
		if(ps.http.status!=200){
			return;
		}
		var obj=eval('('+ps.http.responseText+')');
		if(!obj.data){
			setTimeout('paraselene_holder['+ps.no+'].http_access()',ps.inteval);
			return;
		}
		for(var i=0;i<obj.data.length;i++){
			if(!ps.callback(obj.data[i]))	return;
		}
		setTimeout('paraselene_holder['+ps.no+'].http_access()',ps.inteval);
	}
}

function paraselene_get_http(){
	var obj=null;
	if(window.ActiveXObject){
		try{
			obj=new ActiveXObject('Msxml2.XMLHTTP');
		}catch(e){
			obj=new ActiveXObject('Microsoft.XMLHTTP');
		}
	}else if(window.XMLHttpRequest){
		obj=new XMLHttpRequest();
	}
	if(obj==null)return null;
	return obj;
}

function paraselene_send(o){
	var url='';
	var data='';
	if(o.tagName=='A'){
		var x=o.getAttribute('href').split('?');
		url=x[0];
		if(x[1]){
			data=x[1];
		}
	}
	else if(o.tagName=='FORM'){
		url=o.getAttribute('action');
	}
	else return true;

	var url_test=url.split(':');
	if(!url_test[1])	return true;
	url_test=url.split('/');
	if(!url_test[1])	return true;
	url_test=url.split('.');
	if(url_test[url_test.length-1]!='na')	return true;

	var svr=paraselene_get_http();
	if(svr==null)return true;
	ho.open('POST',url,false);
	ho.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ho.send(data);
	return false;
}

ParaseleneAjax.prototype={
	http_access:function(){
		this.http=paraselene_get_http();
		if(this.http==null)	return;
		this.http.onreadystatechange=function(){
			var p=arguments[0];
			return function(){
				paraselene_receive(p);
			};
		}(paraselene_holder[this.no]);
		this.http.open('GET','paraselene.json.na?key='+this.key,true);
		this.http.send('');
	}
};

function paraselene_ajax_entry(key,callback,msec){
	paraselene_holder.push(new ParaseleneAjax(key,callback,msec));
	paraselene_holder[paraselene_holder.length-1].no=paraselene_holder.length-1;
	paraselene_holder[paraselene_holder.length-1].http_access();
}


