// Open window and locate at center

function OpenWindow(page, framename, win_width, win_height,lockscroll)
{
	var w,h, para,sc;
	var absw, absh;
	
	w = screen.width;
	h = screen.height
	
	absw = (w-win_width) /2;
	
	if (win_height > 0) {
		absh = (h-win_height) / 2;	
	} else{
		absh = (h-(h * 0.7)) /2;
		}
		
	if (lockscroll == 1) { sc = "no" } else { sc = "YES" }

	para = "top="+absh+", left="+absw+ ",width="+win_width+", height="+win_height+", toolbar=no, menubar=no, location=no, scrollbars="+sc+", directories=no";
	
	window.open(page, framename, para);

}

function checkkeyword()
{
	if (document.searchform.txtkey.value == '') {
		alert("Keyword cannot be empty");
		return false;
	} else {
		return true;
		}
}

function convert(txtobj) 
{
	//apply only this page
	var txt = txtobj.value;
	
	y = '';
	i1 = 0;
	while(1) {
		i2 = txt.indexOf(unescape("%0A"),i1);
		if (i2 < 0) {
			y += txt.substring(i1);
			break;
		} else 
			y += txt.substring(i1,i2-1) +"<br>";
		i1 = i2 +1
	}
	txtobj.value = y;
}

function splitdesc(txt)
{
	//apply only this page
	
	y = '';
	i1 = 0;
	while(1) {
		i2 = txt.indexOf("<br>",i1);
		if (i2 < 0) {
			y += txt.substring(i1);
			break;
		} else {
			y += txt.substring(i1,i2) + unescape("%0A%0D");
			i2 += 3;
		}
		i1 = i2 +1
	}
	return y;
}
