var IS_IE = (navigator.userAgent.toLowerCase().indexOf("msie") > -1) ? true : false;

//判断值是否为空
function IsNull(val)
{
	if(val.replace(/^\s+|\s+$/g,'')=='')
		return true;
	else
		return false;
}

//判断值是否是数字
function IsNumber(val)
{
	var reg = /\d*/;
	return reg.test(val);	
}

//显示导航位置
function NavigatePos(pos_str)
{
	$('#navigate_str').html(pos_str);
}

//打开新窗口
function OpenWindow(opurl,width, height)
{
	window.open (opurl, '', 'height='+height+', width='+width+', scrollbars=yes, resizable=yes');	
}

function OpenDialog(dialogURL,width, height)
{
	ret = window.showModalDialog(dialogURL, window, "dialogWidth:"+width+"px; dialogHeight:"+height+"px; center:yes; help:no; resizable:no; status:no") ;	
	if(ret) 
	{
		window.location.reload(true); 
	}
}

function OpenDialogRet(dialogURL,width, height)
{
	ret = window.showModalDialog(dialogURL, window, "dialogWidth:"+width+"px; dialogHeight:"+height+"px; center:yes; help:no; resizable:no; status:no") ;	
	return ret;
}

function CloseDialog(breload)
{
	window.returnValue = breload;
	window.close();
}


function setPointer(theRow, theAction, theDefaultColor, thePointerColor)
{
    var theCells = null;
	var newColor = null;
	
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    if (theAction == 'out' && thePointerColor != '')
    {
    	newColor	= thePointerColor;
    }
    
    if (theAction == 'over')
    {
            newColor	= theDefaultColor;
    }
    
    var domDetect = false;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        domDetect    = true;
    }
    
    var rowCellsCnt  = theCells.length;
    
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } 

    return true;
} // end of the 'setPointer()' function

function display(span_id, img_id)
{
	if($('#'+span_id).css('display') == 'none')
	{
		$('#'+span_id).show();
		$('#'+img_id).attr("src", "imgs/dtree/nolines_minus.gif");
	}
	else
	{
		$('#'+span_id).hide();
		$('#'+img_id).attr("src", "imgs/dtree/nolines_plus.gif");
	}
}

function go2web(url_link)
{
	document.location.href=url_link;	
}

function go2issue(issue_id)
{
        query_id=$('#hidden_query_id').val();
        page=$('#hidden_page').val();
        view_job=$('#hidden_view_job').val();
	document.location.href="index.php?job=issue_info&issue_id="+issue_id+"&query_id="+query_id+"&page="+page+"&view_job="+view_job;	
}

//显示一个层
function DispLayer(div, w, h, pos_x, pos_y, bgColor)
{
	var div_obj = document.createElement("div");
	
  div_obj.style.position = "absolute";
  div_obj.style.background=bgColor;
  div_obj.style.border="1px solid #cccccc";
  div_obj.style.lineHeight ="25px";
  div_obj.style.paddingLeft = "10px" ;
  div_obj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  div_obj.style.width = w + "px";
  div_obj.style.height =h + "px";
  div_obj.style.right = pos_x+ "px";;
 	div_obj.style.top = pos_y+ "px";;
 
  div_obj.innerHTML = div;
  document.body.appendChild(div_obj);
}

