﻿
function $(str)
{
  return (document.getElementById(str));
}

//mouseover out click
function DealTableMO()
{
    var tbs=document.getElementsByTagName("table");
    if(tbs.length==0)return;
    for(var i=0;i<tbs.length;i++)
    {
        var tb=tbs[i];
        if(tb.name=="table_mo")
        {
            for(var j=1;j<tb.rows.length;j++)
            {
                var row=tb.rows[j];
                row.onmouseover=function(){this.className="trContentOver";}
                row.onmouseout=function(){this.className="trContent";}
            }
        }
    }
}

function IsMobileNo(_sphoneno)
{
    return (/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})/.test(_sphoneno)); 
}

//获取Selectbox text
function SelectBoxText(_sel)
{
    return _sel[_sel.selectedIndex].text;
}
//清空
function resetSelectBox(selName) {
	var ele = document.getElementById(selName);
	while (ele.childNodes.length > 0) {
        ele.removeChild(ele.firstChild);
    }
}

//选中制定Text
function SelectedBoxByText(_sel,_stext)
{
   for(var i=0;i<_sel.options.length;i++)
   {
      var stext=_sel.options[i].text;
      if(stext==_stext)
      {
        _sel.options[i].selected=true;
        break;
      }
   }
}

// --- GetUrlParam ---
function GetUrlParam( paramName )
{
	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
	var oMatch = oRegex.exec( self.location.search ) ;
	if ( oMatch && oMatch.length > 1 )
	{
		return unescape( oMatch[1] ) ;
	}		
	else
	{
        return '' ;		
	}
}

function GetUrlParamdecodeURIComponent( paramName )
{
	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
	var oMatch = oRegex.exec(self.location.search) ;
	if ( oMatch && oMatch.length > 1 )
	{
		return decodeURIComponent( oMatch[1] ) ;
	}		
	else
	{
        return '' ;		
	}
}

//居中打开
function openCenterWindow(_link,_width,_height)
{
    var fadd=",top="+(screen.height-70-_height)/2+",left="+(screen.width-_width)/2;
    window.open (_link, "_blank", "height="+_height+",width="+_width+",toolbar=no,menubar=no,scrollbars=1,resizable=no,location=no,status=0"+fadd);
    return false;
}
