String.prototype.subLength = function(n){ 
	var r = /[^\x00-\xff]/g; 
	if(this.replace(r, "mm").length <= n) 
	return this;
	// n = n - 3; 
	var m = Math.floor(n/2); 
	for(var i=m; i<this.length; i++){ 
		if(this.substr(0, i).replace(r, "mm").length>=n) { 
			return this.substr(0, i) +"..."; 
		} 
	} 
	return this;
};

String.prototype.getChars = function(){ 
	var r = /[^\x00-\xff]/g; 
	return this.replace(r, "mm").length;
};

var url;

function remoteAction(A,B){
	sAlert();
	adddate(B);
	url = A;
	setTimeout("myJSON()",500); 	
}

function myJSON(){
	//JSON
	var s = document.createElement("SCRIPT");
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	s.src = url;
}

function sendJSONrequest(A){
	//JSON
	var s = document.createElement("SCRIPT");
	document.getElementsByTagName("HEAD")[0].appendChild(s);
	s.src = A;
}

function closewin(){
	var bgObj = document.getElementById('bgDiv');
	if(bgObj){
		var msgObj = document.getElementById('msgDiv');
		if(msgObj){
			document.body.removeChild(bgObj);
			document.body.removeChild(msgObj);
		}
	}
}

function add_date(str){
	var d_mytxt = document.getElementById('msgTxt');
	d_mytxt.innerHTML = str;
}

function sAlert(){	
	var msgw,msgh,bordercolor;
	msgw=150;
	msgh=70;
	titleheight=25
	bordercolor="#336699";
	titlecolor="#99CCFF";
	var sWidth,sHeight;
	sWidth=screen.width - 21 ;
	sHeight=document.body.offsetHeight;
	if (sHeight<screen.height){
		sHeight=screen.height;
	}
	var bgObj=document.createElement("div");
	bgObj.setAttribute('id','bgDiv');
	bgObj.style.position="absolute";
	bgObj.style.top="0";
	bgObj.style.background="#777";
	bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60,finishOpacity=80)";
	bgObj.style.opacity="0.6";
	bgObj.style.left="0";
	bgObj.style.width=sWidth + "px";
	bgObj.style.height=sHeight + "px";
	bgObj.style.zIndex = "10000";
	document.body.appendChild(bgObj);
	
	var msgObj=document.createElement("div")
	msgObj.setAttribute("id","msgDiv");
	msgObj.setAttribute("align","center");
	msgObj.style.background="white";
	msgObj.style.border="1px solid " + bordercolor;
	msgObj.style.position = "absolute";
	msgObj.style.left = "50%";
	msgObj.style.top = "50%";
	msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	msgObj.style.marginLeft = "-75px" ;
	msgObj.style.marginTop = (-35+document.documentElement.scrollTop) +"px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = (msgh+10) + "px";
	msgObj.style.textAlign = "center";
	msgObj.style.lineHeight = (msgh-titleheight) + "px";
	msgObj.style.zIndex = "10001";	
	document.body.appendChild(msgObj);
	
	var txt=document.createElement("p");
	txt.style.margin="0";
	txt.setAttribute("id","msgTxt");
	document.getElementById("msgDiv").appendChild(txt);
}