

//判断浏览器 自动改变foot 高度
     function changeHeight(){
    	 if(window.navigator.userAgent.indexOf("Firefox")>=1){ 
    		 var ifm= document.getElementById("line");   
 			var subWeb = document.frames ? document.frames["line"].document : ifm.contentDocument;   
 			if(ifm != null && subWeb != null) {
 				//  alert(subWeb.body.scrollHeight);
 			   ifm.height = subWeb.body.scrollHeight;
 			}   
   	    }else{
    		  document.getElementById("line").style.height=line.document.body.scrollHeight;
    	 }
     } 
     function SetCwinHeight(){
   	  var iframeid=document.getElementById("line"); 
   	  if (document.getElementById){
   	   if (iframeid && !window.opera){
   		if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
   		 iframeid.height = iframeid.contentDocument.body.offsetHeight;
   		}else if(iframeid.Document && iframeid.Document.body.scrollHeight){
   		 iframeid.height = iframeid.Document.body.scrollHeight;
   		}
   	   }
   	  } 
   	} 
	$(function(){
		var $accordions  = $('#accordions>.accordion');
		var $links = $accordions.find('li');
		$accordions.each(function(){
//二级菜单链接通过URL？后面部分Start		
			var thisSearch=window.top.location.search.split("=");
			if(thisSearch[1]!=null){
				var a=$("#accordions>.accordion>p").eq(thisSearch[1]);
				var t=a.next().find("a").first();
				a.next().slideDown();
				a.addClass("accor-title-selected");
				$("#line").attr("src",t.attr("href"));
				t.parent().addClass("selected");
		        var fl=a.html(); 
				if(fl==null){			
		         }
				else{
					//cilTitle(fl);
					$('#title3').html(""); 
					$('#title4').html("");
					$('#title3').html("&gt;"+a.text()+"</span>");
					$('#title4').html("&gt; <span class='red'>"+t.text()+"</span>");

				}
			}   
//菜单链接部分End
			$(this).find('.accor-title').click(function(){				 
				$(this).addClass('accor-title-selected').parent().siblings().find('.accor-title').removeClass('accor-title-selected');
				var t=$(this).next().find("a").first();
				$(this).next().slideDown();
				$(this).addClass("accor-title-selected");
				$("#line").attr("src",t.attr("href"));
				t.parent().addClass("selected");
		        var fl=t.html(); 	
				if(fl==null){			
		         }
				else{
					cilTitle($(this).text());
				}	

				$(this).parent().find("li").eq(0).trigger("click");
				
				$(this).siblings('.accor-list').each(function(){
				
					$(this).slideDown();
				}).end().parent().siblings().find('.accor-list').each(function(){
				
					$(this).slideUp();
				});
			});
		});
		$links.click(function(){	
			$links.removeClass('selected');
			$(this).addClass('selected');
			$('#title3').html(""); 
			$('#title4').html("");
			$('#title3').html("&gt;"+$(this).parent().parent().find("p").eq(0).text()+"</span>");
			$('#title4').html("&gt; <span class='red'>"+$(this).find("a").eq(0).text()+"</span>");
		});
	}); 
	var thisSearch="";
	
	function xx(){  
		var $accordions  = $('#accordions>.accordion');
		var $links = $accordions.find('li');
		var data=new Array();
		$accordions.each(function(){
//二级菜单链接通过URL？后面部分Start		
			thisSearch=window.top.location.search.substring(window.top.location.search.lastIndexOf("=")+1);
			if(thisSearch!=null){
				
				if(thisSearch.indexOf('-')!=-1){
					data=thisSearch.split('-');
					thisSearch=data[0];
				}
				var a=$("#accordions>.accordion>p").eq(thisSearch);	
                 var temp=0;
				if(data.length!=0){
		         temp=data[1];   
           	}	
				var t=a.next().find("a").eq(temp);
				a.next().slideDown();
				a.addClass("accor-title-selected1");		
				$("#line").attr("src",t.attr("href"));
				t.parent().addClass("selected");
				var status=0;
				if(getParameter("index").indexOf("#")!=-1){
					var ky=getParameter("index");	
					queryTitle(" &gt; "+a.text()+" "," &gt; "+t.html()+" ",ky.substring(ky.indexOf('#')+1,ky.length));				
				        status=1;	        
				}else{		
                   cilFirstTitle(" &gt; "+a.text()+" ",t.html());	
				}
			}
//菜单链接部分End
		$(this).find('.accor-title1').click(function(){ 
			//给 li 加默认 事件 默认为 第一个
				var $li=$(this).parent().find('li');	
				var $pi=$li.eq(0);
				$li.removeClass('selected');
				$pi.addClass('selected');  
			$('#title4').html(" &gt; <span class='red'>"+$pi.text()+"</span>");
			$('#title3').html(" "+$("#title3").text()+" ");
			   var links = $(this).parent().find('li').find("a").eq(0).attr("onclick")+"";	   
			   var temp=links.substring(links.indexOf('{')+1,links.indexOf('}'));
			   var array=temp.substring(temp.indexOf('(')+1,temp.indexOf(')')).split(',');
			   var citID=array[0];                      
                pk(citID,array[1],array[2]);       
				$accordions.find('p').removeClass('accor-title-selected1');
				$accordions.find('p').addClass('accor-title1');
				$accordions.find('p').each(function(){
					var v1=$(this).attr("c1");
					$(this).attr("style","background-image: url(../pic/infoType/"+v1+")");
				})
				$(this).addClass('accor-title-selected1').parent().siblings().find('.accor-title1').removeClass('accor-title-selected1');	
				var v2=$(this).attr("c2");
				$(this).attr("style","background-image: url(../pic/infoType/"+v2+")");
				$(this).siblings('.accor-list').each(function(){
					$(this).slideDown();
				}).end().parent().siblings().find('.accor-list').each(function(){
					$(this).slideUp();
				}); 
			});
		});  
		var p="";
		$accordions.find('p').click(function(){	
		        p=$(this).text();
		}) 
		$links.click(function(){		
			$links.removeClass('selected');
			$(this).addClass('selected');	
			if(p!=""){
				cilFirstTitle(" ",$(this).text());
			}
			else{
				var a=$("#accordions>.accordion>p").eq(thisSearch).text();
				cilFirstTitle(" &gt; "+a,$(this).text());
			}		
		});	
	}   
	function cilTitle(tit){
		var titleId3 = document.getElementById("title3");
		var titleId4 = document.getElementById("title4");
		
		if(titleId3==undefined){
			return ;
		}

		$("#title3").text(" ");
		$("#title4").text(" ");
		$("#title3").html(" &gt; <span>"+tit+"</span>");
		//$("#title4").html(" &gt; <span class='red'>"+$(":contains(tit)").parent().find("a").eq(0).text()+"</span>");
		
	} 
	//通过cinfID 查询 cinfTitle
	function queryTitle(first,temp,cinfID){	
		var param={cinfID:cinfID};
		$.ajax( { 
   			type :"POST",
   			url :projectName()+"cms/QueryTitleServlet",
   			data :param,
   			success :function (str){
			document.getElementById("title3").innerHTML=temp;
			cilFirstTitle(first,str);
        }
    	   })
	}
	//从首页跳转 到新闻信息    
	function cilFirstTitle(first,tit){
	var titleId3=document.getElementById("title3");
		var titleId4 = document.getElementById("title4");
		titleId4.innerHTML = " ";
		titleId4.innerHTML =first+" &gt; <span class='red'> "+tit+" </span>";	
	} 
	function srcAdd(add){
		var titleId3 = document.getElementById("title3");
		titleId3.innerHTML = " ";
		var titleId4 = document.getElementById("title4"); 
		titleId4.innerHTML = " ";
		var line = document.getElementById('line');
		line.src = add;
	}
//ff自适高度  
	var FFextraHeight = 0; 
	if(window.navigator.userAgent.indexOf("Firefox")>=1){
		FFextraHeight = 35;//在火狐下的参数 可以调
	}
	function ReSizeiFrame(iframe){ 
		if(iframe && !window.opera){
			iframe.style.display = "block";
			if(iframe.contentDocument && iframe.contentDocument.body.offsetHeight){
				iframe.height = iframe.contentDocument.body.offsetHeight + FFextraHeight;//设置iframe在火狐下高度
			}else if (iframe.Document && iframe.Document.body.scrollHeight){
				iframe.height = iframe.Document.body.scrollHeight;//设置iframe在ie下的高度
			}
		}
	} 
	function reinitIframe(){
		var iframe = document.getElementById("line");
		try{
			var bHeight = iframe.contentWindow.document.body.scrollHeight;
			var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
			var height = Math.max(bHeight, dHeight);//一个ff 一个ie 取大值兼容
			iframe.height =  height; 
		}catch (ex){	
		}
	} //window.setTimeout
	
	window.setTimeout("reinitIframe()", 600);//定时刷新重取 经测试对cpu 没啥影响
//ff自适高
