/* v3.0.5 */

	/* ---------------- Common Prima UIC operations/ --------------- */
    function ReadCookie ( cookieName )
    {
        var theCookie=""+document.cookie;
        var ind=theCookie.indexOf(cookieName);
        if (ind==-1 || cookieName=="") return "";
        var ind1=theCookie.indexOf(';',ind);
        if (ind1==-1) ind1=theCookie.length;
        return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
    }

    function SetCookie(cookieName,cookieValue,nDays)
    {
        var today = new Date();
        var expire = new Date();
        if (nDays==null || nDays==0) nDays=1;
        expire.setTime(today.getTime() + 3600000*24*nDays);
        document.cookie = cookieName+"="+escape(cookieValue)
                     + ";expires="+expire.toGMTString();
    }

    // every page need a frame like tab highlight feature MUST set following 2 vars in the top of the page
    // number of tabs
    var numberOfTabs = 0;
    // cookie name to store which tab is highlighted
    var tabCookieName = "" ;

    // reqire tab title table and tab content div named like tablink1, tablink2, .... and tabdiv1, tabdiv2, ...
    function doTab ( theHighlightTab )
    {
        if ( numberOfTabs <= 0 )
        {
            return;
        }
        var highlightTab = theHighlightTab;
        // if given tab index number less than 1
        // check first if we get fetch it from cookie
        // if no cookie, assume the first tab is highlighted
        if ( highlightTab < 1 )
        {
            if ( tabCookieName != "" )
            {
                highlightTab = ReadCookie ( tabCookieName ) ;
            }
        }
        if ( highlightTab < 1 )
        {
            highlightTab = 1 ;
        }
        if (document.getElementById)
        {
            for (var f = 1; f < numberOfTabs+1; f++)
            {
                document.getElementById('tabdiv'+f).style.display='none';
                document.getElementById('tablink'+f).className = 'framenormaltable';
            }
            document.getElementById('tabdiv'+highlightTab).style.display='block';
            document.getElementById('tablink'+highlightTab).className = 'frametitletable';
            if ( tabCookieName != "" )
            {
                SetCookie(tabCookieName,highlightTab,1);
            }
        }
    }


	// function and global variable to replace view area after form submit, requires viewPanel div element
	var imgProgressBar = new Image ( ) ;
	imgProgressBar.src = "images/zh-CN/progressbar.gif" ;

	function fn_AfterSubmit ( )
	{
		if (window.navigator.userAgent.indexOf("Firefox")>=1) { return ; }
		viewPanel.style.position = "absolute" ;
		viewPanel.style.overflow = "auto" ;
		viewPanel.style.top = document.body.clientHeight/2 ;
		viewPanel.style.left = document.body.clientWidth/2 - 398/2;
		viewPanel.innerHTML = "<table cellspacing='0' cellpadding='0' align='center' valign='middle'><tr><td align='center' valign='middle'><table cellspacing='0' cellpadding='2' style='font-size:9pt;'><tr><td style='border-width:2px; border-style: groove;'><img id='img_progressbar' border='0' width='398' height='4'></td></tr><tr><td style='border-width:0px;' align='center' height='10'></td></tr><tr><td style='border-width:0px; font-family:宋体; font-size: 9pt;' align='center'><b>请求已经发送，请稍候……</b></td></tr></table></td></tr></table>" ;
		img_progressbar.src = imgProgressBar.src ;
	}

    function fn_OpenNewWindow ( strUrl , strWindowName , strTheWindowProperties )
    {
        if ( strTheWindowProperties == "" )
            strWindowProperties = "height=400,width=600,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
        else
            strWindowProperties = strTheWindowProperties;
        window.open( strUrl , strWindowName , strWindowProperties ) ;
    }

    function fn_OpenNewWindowReturn ( strUrl , strWindowName , strTheWindowProperties )
    {
        if ( strTheWindowProperties == "" )
            strWindowProperties = "height=400,width=600,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes";
        else
            strWindowProperties = strTheWindowProperties;
        return window.open( strUrl , strWindowName , strWindowProperties ) ;
    }

    function fn_ImageOnMouseOver ( theImage )
    {
        theImage.className = 'imgonmouseover';
    }

    function fn_ImageOnMouseOut ( theImage )
    {
        theImage.className = 'imgonmouseout';

    }

    function fn_ToggleDisplay(theElementID)
    {
        if ( document.getElementById(theElementID) )
        {
            if ( document.getElementById(theElementID).style.display == 'none' )
                document.getElementById(theElementID).style.display = 'block';
            else
                document.getElementById(theElementID).style.display = 'none';
            SetCookie(theElementID,document.getElementById(theElementID).style.display,1);
        }
    }

    function fn_InitDisplay(theElementID)
    {
        if ( document.getElementById(theElementID) && ReadCookie ( theElementID ) )
        {
            document.getElementById(theElementID).style.display = ReadCookie ( theElementID );
        }
    }

    function fn_CheckFeatureLink(objLink,strFTDesc)
    {
        if ( objLink.disabled == 1 )
        {
            alert ( '抱歉，您的系统暂不支持"' + strFTDesc + '"功能！' ) ;
            return false;
        }
        return true;
    }
    
    function fn_PrintTimeperiod ( nTimeperiod )
    {
        if( isNaN( parseInt ( nTimeperiod ) ) ) return null ;
        
        var strTimeperiodDisplay ;
    	if ( nTimeperiod % 12 == 0 )
    	{
    		strTimeperiodDisplay = (nTimeperiod / 12) + '年';
    	}else if ( nTimeperiod == 6 )
    	{
    		strTimeperiodDisplay = '半年';
    	}else if ( nTimeperiod == 3 )
    	{
    		strTimeperiodDisplay = '季度';
    	}else if ( nTimeperiod > 0 )
    	{
    		strTimeperiodDisplay = nTimeperiod + '月';
    	}else if ( nTimeperiod == -1 )
    	{
    		strTimeperiodDisplay = '永久';
    	}else
    	{
    		strTimeperiodDisplay = '一次性';
    	}
    	return strTimeperiodDisplay;
    }

    function fn_PrintMoney ( nMoney )
    {
        if( isNaN( parseFloat ( nMoney ) ) ) return null ;
        
        return '￥' + parseFloat ( nMoney ) + '元' ;
    }
	/* ---------------- /Common Prima UIC operations --------------- */
	/* ---------------- /页面顶部的图片变换 --------------- */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}