




/*
【函数名称】setSize
【参数说明】
	w		:[数值型][*]	窗口的宽度;
	h		:[数值型][*]	窗口的高度;
	a		:[字符型]		窗口的位置("TL")["T":上,"B":下,"L":左,"R":右,"TL":左上,"TR":右上,"BL":左下,"BR":右下,"C":中上];
【功能说明】设置当前弹出窗口页面的大小;
【调用实例】setSize(400,300,"TL");
*/
function setSize(w,h,a){
	window.resizeTo(w+11,h+30);
	var l = 0;
    var t = 0; 
	switch(a){
		case "L":
			l = 0;
			t = screen.availHeight/2 - h/2; 
			break;
		case "R":
			l = screen.availWidth - w;
			t = screen.availHeight/2 - h/2; 
			break;
		case "T":
			l = screen.availWidth/2 - w/2;
			t = 0; 
			break;
		case "B":
			l = screen.availWidth/2 - w/2;
			t = screen.availHeight - h; 
			break;
		case "TR":
			l = screen.availWidth - w;
			t = 0; 
			break;
		case "BL":
			l = screen.availWidth - w;
			t = 0; 
			break;
		case "BR":
			l = screen.availWidth - w;
			t = screen.availHeight - h; 
			break;
		case "C":
			l = screen.availWidth/2 - w/2;
			t = screen.availHeight/3 - h/3; 
			break;
	}
	window.moveTo(l,t);
	window.focus();
}

/*
【函数名称】setOpen
【参数说明】
	url		:[字符型][*]	调用页面地址;
	title	:[字符型]		被调用窗口的name("");
	w		:[数值型]		窗口的宽度(556);
	h		:[数值型]		窗口的高度(300);
	a		:[字符型]		窗口的位置("TL")["T":上,"B":下,"L":左,"R":右,"TL":左上,"TR":右上,"BL":左下,"BR":右下,"C":中上];
	s		:[布尔型]       是否显示滚动条(true);
【功能说明】弹出小窗口页面;
【调用实例】setOpen("open/index.htm","new_window",500,400,"C",true);
*/
function setOpen(url,title,w,h,a,s){
	if(url == null){
		return false;
	}
	if(title == null){
		title="";
	}
	if(w == null || h == null){
		w =566;
		h =300;
	}
	var sb = "scrollbars=no";
	if(s != null && s == true){
		var sb = "scrollbars=yes";
	}
	var l = 0;
    var t = 0; 
	switch(a){
		case "L":
			l = 0;
			t = screen.availHeight/2 - h/2; 
			break;
		case "R":
			l = screen.availWidth - w;
			t = screen.availHeight/2 - h/2; 
			break;
		case "T":
			l = screen.availWidth/2 - w/2;
			t = 0; 
			break;
		case "B":
			l = screen.availWidth/2 - w/2;
			t = screen.availHeight - h; 
			break;
		case "TR":
			l = screen.availWidth - w;
			t = 0; 
			break;
		case "BL":
			l = screen.availWidth - w;
			t = 0; 
			break;
		case "BR":
			l = screen.availWidth - w;
			t = screen.availHeight - h; 
			break;
		case "C":
			l = screen.availWidth/2 - w/2;
			t = screen.availHeight/3 - h/3; 
			break;
	}
	var loadingStr = "<body onblur=\"this.focus();\">"
               + "<table width=100% height=100%><tr><td align=middle>"
               + "正在加载数据...."
               + "</td></tr></table>"
               + "</body>";
	var open_win_tmp = window.open("", title, sb+", left="+l+", top="+t+", width="+w+", height="+h );	
	open_win_tmp.document.write(loadingStr);
	if(url.length!=0){open_win_tmp.location = url;}
	open_win_tmp.focus();
	return open_win_tmp;
}

/*
【函数名称】setPage
【参数说明】
	url		:[字符型][*]	调用页面地址;
	flag	:[布尔型]       是否关闭当前页面(false);
【功能说明】打开父页面地址;
【调用实例】setPage("main.htm",false);
*/
function setPage(url,flag){
	if(flag == null){
		flag = false;
	}
	if(window.opener != null){
		window.opener.location.href = url;
	}
	if(flag){
		window.close();
	}
}

/*
【函数名称】setClose
【参数说明】无
【功能说明】关闭当前页面;
【调用实例】setClose();
*/
function setClose(){
		window.close();
}

/*
【函数名称】setTop
【参数说明】无
【功能说明】页面置顶;
【调用实例】setTop();
*/
function setTop(){
		window.scrollTo(0,0);
}

/*
【函数名称】setScroll
【参数说明】无
【功能说明】页面滚动;
【调用实例】setScroll();
*/
function setScroll(){
	document.onmousedown=scroll_clear; 
	document.ondblclick=scroll_init;
}
var scroll_timer,scroll_point;
function scroll_init(){ 
	scroll_timer = setInterval("scroll_move()",16); 
}
function scroll_clear(){
	clearInterval(scroll_timer);
}
function scroll_move(){ 
	scroll_point = document.body.scrollTop; 
	window.scroll(0,++scroll_point); 
	if (scroll_point != document.body.scrollTop) {
		scroll_clear(); 
	}
} 