﻿ window.onerror = ignoreError;
function ignoreError() {
  return true;
}

function subString(str, len, hasDot) 
{ 
var newLength = 0; 
var newStr = ""; 
var chineseRegex = /[^\x00-\xff]/g; 
var singleChar = ""; 
var strLength = str.replace(chineseRegex,"**").length; 
for(var i = 0;i < strLength;i++) 
{ 
singleChar = str.charAt(i).toString(); 
if(singleChar.match(chineseRegex) != null) 
{ 
newLength += 2; 
} 
else 
{ 
newLength++; 
} 
if(newLength > len) 
{ 
break; 
} 
newStr += singleChar; 
} 
if(hasDot && strLength > len) 
{ 
newStr += "..."; 
} 
return newStr; 
}
function GetXmlHttpObject()
{
  var xmlHttp=null;
  if(window.XMLHttpRequest)//Firefox, Opera 8.0+, Safari
  {
	xmlHttp=new XMLHttpRequest();
  }
  else if(window.ActiveXObject)//Internet Explorer
  {
	try
	{
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  }  
  else
  {
  alert( '未做与该浏览器的兼容！');
  return;
  }
return xmlHttp;
}
function SendXmlHttpRequest(url,htmtxt) {
    var objXmlHttp = null;
	
    var showResponse=function(){
        if(objXmlHttp.readyState==4)
        {
            if(objXmlHttp.status==200)
            {
				if(htmtxt!="0")
				{
				  var txt=objXmlHttp.responseText;
				  if(txt!="")
				  {
					  if(htmtxt=="newscontents"){   
						  if(txt.substring(0,11)=="0wwwurl9="){
							  window.location.href=txt.substring(11);
						  }else{
							 document.getElementById(htmtxt).innerHTML=txt;
						  }
					   }else{
						 document.getElementById(htmtxt).innerHTML=txt;
					   }
				  }else{
				  }
				}
			}
		}
        else //请求状态还没有成功，页面等待
        {
            document.getElementById(htmtxt).innerHTML = "数据加载中..";
        }
	}
    objXmlHttp = GetXmlHttpObject();
    objXmlHttp.onreadystatechange=showResponse;
    objXmlHttp.open("POST", url, true);
    objXmlHttp.send(""); 
}
function getxml(n,htmtxt,xmlname,s)
{
    var xmlHttpx = null; 
    var showResponse=function(){
        var HTML="";
		var HTML1="";
        if(xmlHttpx.readyState==4)
        {
            if(xmlHttpx.status==200)
            {	
                var xmlDOM=xmlHttpx.responseXML;
                var xmlRoot=xmlDOM.documentElement;
                var xmlItem=xmlRoot.getElementsByTagName("data");	
                if (n > xmlItem.length || n == 0) {
                    n=xmlItem.length;      
                }    
                var id;
                var Title; 
                var Summary; 
                var Content; 
                var TitleImageUrl;
				var j=0;
                for(var i=0;i<n;i++)
                {       
                    id=xmlItem[i].getAttribute("id");	
                    if(xmlItem[i].childNodes[0].text==undefined)
                    {
                      Title = xmlItem[i].getElementsByTagName("Title")[0].firstChild.data; 
                      Summary = xmlItem[i].getElementsByTagName("Summary")[0].firstChild.data; 
                      Content = xmlItem[i].getElementsByTagName("Content")[0].firstChild.data; 
                      TitleImageUrl=xmlRoot.getElementsByTagName("TitleImageUrl")[i].childNodes[0].nodeValue;
                    }else{
                      Title=xmlItem[i].childNodes[0].text;
                      TitleImageUrl=xmlItem[i].childNodes[1].text;
                      Summary=xmlItem[i].childNodes[2].text;
                      Content=xmlItem[i].childNodes[3].text;
                    }
				////////////////////////
				     if(s == id){
				        getxml(0,'left_mu',Title,2);
				     }else if(s == 1){
                        if(xmlname == "bailarines"){
                            if(i==0){
						        HTML += "<div class='news_tu_content dis' name='f'><div class='news_tu_img' id='apyimg'><a href='../Part/" + xmlname + ".html?" + id + "' target='_blank'><img style='width:326px; height:190px' alt='" + Title + "' src='" + TitleImageUrl + "'/></a></div>";
						        HTML += "<h3>"+Title+"</h3>";
						        HTML += "<a href='../Part/" + xmlname + ".html?" + id + "' target='_blank'>" + Summary + "</a></div>";
						    }else{
						        HTML += "<div class='news_tu_content undis' name='f'><div class='news_tu_img' id='apyimg'><a href='../Part/" + xmlname + ".html?" + id + "' target='_blank'><img style='width:326px; height:190px' alt='" + Title + "' src='" + TitleImageUrl + "'/></a></div>";
						        HTML += "<h3>"+Title+"</h3>";
						        HTML += "<a href='../Part/" + xmlname + ".html?" + id + "' target='_blank'>" + Summary + "</a></div>";
						    }
                        }else{
						    HTML += "<li><a href='../Part/" + xmlname + ".html?" + id + "' target='_blank'>" + Title + "</a><span>"+Summary+"</span></li>";
						}
                    }else if(s == 2){
                        HTML += "<li><a href='../more/list.html?" + id + "1' target='_blank'>" + Title + "</a></li>";
                    }else if(s == 3){
                        HTML += "<li><a href='../information/content.html?" + id + "' target='_blank'>" + Title + "</a></li>";
                    }
				//////////////////////
                }
                if(HTML!=""){			
					document.getElementById(htmtxt).innerHTML=HTML;
				}
            } 
        }
//      else //请求状态还没有成功，页面等待
//        {
//          document.getElementById(htmtxt).innerHTML = "数据加载中..";
//        }
    };
  
  xmlHttpx = GetXmlHttpObject();
  xmlHttpx.onreadystatechange=showResponse;
  xmlHttpx.open("GET","xml/"+xmlname+".xml",true);
  xmlHttpx.send(null);
  delete (xmlHttpx);
}

function gettlist(s){
   SendXmlHttpRequest("../uda/NewsList.aspx?"+s,"DivRsxh");
}
function getclass(s){
   SendXmlHttpRequest("../uda/ArticleClass.aspx?"+s,"Divclass");
}
function getcontet(s){
    SendXmlHttpRequest("../uda/newscontent.aspx?" + s,"DivRsxh");
}
function getlist(s){
    gettlist(s);
    getclass(s);
}


//首页 index
function getindex(){

    getxml(0,'DivLawsregulations','Lawsregulations', 1);
    getxml(0,'divbailarines','bailarines', 1);
    getxml(0,'divArbitrationDynamic','ArbitrationDynamic', 1);
    getxml(0,'divBulletinBoard','BulletinBoard', 1);
}
////left
//function getleft(s){
//    getxml(0,'left_mu','getleft',s);
//}
//right
function getNewList(){
    this.id=location.search.substring(1,37);
    if(location.search.substring(1).length==37){
//列表页
            gettlist(this.id);
            getclass(this.id);
//内容页
    }else{
        getclass(this.id + "007");
        getcontet(this.id);
    }
}
function jsgetNewList(id){
    if(id.length>=37){
//列表页
            gettlist(id);
            getclass(id);
//内容页
    }else{
        getclass(id + "007");
        getcontet(id);
    }
}
    //SendXmlHttpRequest("../uda/Relatedinfo.aspx?" + this.id,"divRelatedinfo");
function getNewContent()//ID内容
{
    this.id=location.search.substring(1,37);
    getclass(this.id + "007");
    getcontet(this.id);
}
function getNewMLContent(id)//ID内容
{
    getclass(id + "007");
    getcontet(id);
}
function getNewLContent()//ID栏目
{   
    this.id=location.search.substring(1,37);
    getclass(this.id);
    getcontet(this.id);
}
function getNewMuContent(id)//ID栏目
{
    getclass(id);
    getcontet(id);
}
//站内搜索
function SearchInfos(a,vl){//搜索键
	if(vl.value=="" || vl.value=="请输入搜索条件！")
	{
		vl.value='请输入搜索条件！';
	}else{
	    if(window.location.href.indexOf("list")>=0){
	        thSearchInfo(escape(vl.value));
        }else{
            window.location="../part/list.html?"+escape(vl.value);
        }
	}
}
function SearchPage(s) {//查询页翻页
  var scvl = document.getElementById('scvl').contentWindow
  if(scvl.document.getElementById("key").value=="")
  {
  alert('请输入搜索条件！');
  }else{
  SendXmlHttpRequest("../uda/Searchinfo.aspx?txtkey=" + scvl.document.getElementById("key").value +"&page=" + s,"right");
  }
}
function SearchInfo() {//查询页查询
    var scvl = document.getElementById('scvl').contentWindow
    var key = location.search.substring(1);
 	if(key!="")
	{
	    scvl.document.getElementById("key").value =unescape(key);
        SendXmlHttpRequest("../uda/SearchInfo.aspx?txtkey=" + key,"right");
	}else{
      document.getElementById("SearchList").innerHTML="请输入要查询的内容..";
	}
}
function thSearchInfo(key) {//查询页查询
    var scvl = document.getElementById('scvl').contentWindow
 	if(key!="")
	{
	    scvl.document.getElementById("key").value =unescape(key);
        SendXmlHttpRequest("../uda/SearchInfo.aspx?txtkey=" + key,"right");
	}else{
      document.getElementById("SearchList").innerHTML="请输入要查询的内容..";
	}
}
function top()
{    document.write("");
	}
function voids()
{
}

//            <!-----费用计算---开始------>

function Calculate_js() {
var Amount = document.getElementById("Amount").value
if (Amount.length == 0) {
 alert ("请输入您的争议金额！");
 return;
 }
Amount = parseFloat(Amount);
if (isNaN(Amount)) {
 alert ("请输入正确的数值！");
 return;
 }
document.getElementById("Amount").value = Amount;
if (Amount <= 0 ) {
 alert ("请输入正确的数值！");
 return;
 }
if (Amount <= 1000) {
 acceptfee = 100;
 }
else if (Amount <= 50000) {
 acceptfee = 100 + (Amount - 1000) /25;
 }
else if (Amount <= 100000) {
 acceptfee = 2060 + (Amount - 50000) /33;
 }
else if (Amount <= 200000) {
 acceptfee = 3560 + (Amount - 100000)/33;
 }
else if (Amount <= 500000) {
 acceptfee = 7550 + (Amount - 200000) * .02;
 }
else if (Amount <= 1000000) {
 acceptfee = 13550 + (Amount - 500000) * .01;
 }
else {
 acceptfee = 18550 + (Amount - 1000000) * .005;
 }
acceptfee=acceptfee+"";
var j=0;
var count=0;
var gc="";
for(i=0;i<acceptfee.length;i++){
 if(acceptfee.charAt(i)==".")j=1;
 if(j==1)count++;
 if(count==4)break;
 gc+=acceptfee.charAt(i);
}
document.getElementById("AcceptFee").value =gc+" 元";

if (Amount < 1000) {
 processfee = 100;
 }
else if (Amount <= 50000) {
 processfee = 100 + (Amount - 1000) /31;
 }
else if (Amount <= 100000) {
 processfee = 1668 + (Amount - 50000)/55;
 }
else if (Amount <= 200000) {
 processfee = 2568 + (Amount - 100000) /55;
 }
else if (Amount <= 500000) {
 processfee = 5950 + (Amount - 200000) * .02 * .4;
 }
else if (Amount < 10000000) {
 processfee = 8350 + (Amount - 500000) * .01 * .3;
 }
else if (Amount == 10000000) {
processfee = -9650 + (Amount - 500000) * .01 * .3;
 }
else {
 processfee = 9850 + (Amount - 1000000) * .005 * .2;
 }
processfee=processfee+"";
var j=0;
var count=0;
var gc="";
for(i=0;i<processfee.length;i++){
 if(processfee.charAt(i)==".")j=1;
 if(j==1)count++;
 if(count==4)break;
 gc+=processfee.charAt(i);
}
document.getElementById("ProcessFee").value = gc+" 元";

document.getElementById("TotalFee").value = parseFloat(document.getElementById("AcceptFee").value) + parseFloat(document.getElementById("ProcessFee").value)+" 元";
}
//            <!-----费用计算---结束------>
