function openWindow(url,name,iWidth,iHeight){
  var popwin=null;
  var url;                                
  var name;                          
  var iWidth;                         
  var iHeight;                        
  var iTop = (window.screen.availHeight-30-iHeight)/2;      
  var iLeft = (window.screen.availWidth-10-iWidth)/2;   
  window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no');

 }
 
 function openWin(url,iWidth,iHeight){
  var url;                                                    
  var iWidth;                         
  var iHeight;                        
  var iTop = (window.screen.availHeight-30-iHeight)/2;      
  var iLeft = (window.screen.availWidth-10-iWidth)/2;   
  window.open(url,'','height='+iHeight+',width='+iWidth+',top='+iTop+',left='+iLeft+',scrollbars=yes');
 }
 
 
function fixImgWin(url){
	url = url;
	var imgwin=window.open('','img','width=50,height=50');
	imgwin.focus();
	var HTML="<html>\r\n<head>\r\n<title>Preview</title>\r\n</head>\r\n<body style=\"margin:0;padding:0;\">\r\n<img src=\""+url+"\" border=1 hspace=10 vspace=10 onclick='window.close()' onload=\"window.resizeTo(this.width+32,this.height+90);window.moveTo((screen.width-this.width)/2,(screen.height-this.height)/2)\">\r\n</body>\r\n</html>";
	var doc=imgwin.document;
	doc.open("text/html","replace") ;
	doc.write(HTML);
	doc.close();
}

function openWinRun(html){
	var newWin = window.open('');
	newWin.focus();
	var doc = newWin.document;
	doc.open("text/html","replace") ;
	doc.write(html);
	doc.close();
}

function openWinRun1(html,name){
	var newWin = window.open('',name,'width=400,height=300');
	newWin.focus();
	var doc = newWin.document;
	doc.open("text/html","replace") ;
	doc.write(html);
	doc.close();
}

function confirmDelete(){
	if(!confirm('are you sure to delete?'))
		return false;
}

function confirmMsg(){
	if(!confirm('confirm to do?'))
		return false;
}


function setRemind(Url){
	openWindow(Url,'',600,180);
	return false;
}

function selectAll(name){
	var cbx = document.getElementsByName(name);
	for(var i=0;i<cbx.length;i++){
		cbx[i].checked = true;
	}
}

function unSelect(name){
	var cbx = document.getElementsByName(name);
	for(var i=0;i<cbx.length;i++){
		if(cbx[i].checked)
			cbx[i].checked = false;
		else
			cbx[i].checked = true;
	}
}

function getPosition(o)
{
    var t = o.offsetTop;
    var l = o.offsetLeft;
    while(o = o.offsetParent)
    {
        t += o.offsetTop;
        l += o.offsetLeft;
    }
    var pos = {top:t,left:l};
    return pos;
}

function showTab(str,n,total) //str前缀 , n当前项 , total一共几项 从0开始
{
    for(i=0;i<total;i++)
    {
        document.getElementById(str+"_t_"+i).className = "";
        document.getElementById(str+"_c_"+i).style.display="none";
    }
    document.getElementById(str+"_t_"+n).className = "current";
    document.getElementById(str+"_c_"+n).style.display = "block";
    
}
