/*****************************************************************************
 设置父窗口的标题	divWindowMovTitle父窗口必须有此函数
	parentWindowTitle(text)		text=标题文字
*****************************************************************************/

function parentWindowTitle(text){
	var a = parent.document.getElementsByTagName("IFRAME");
	var iframeParentObjId=null;
	try
	{
	  if(window!=parent)
	  {
	      var a = parent.document.getElementsByTagName("IFRAME");
	      for(var i=0; i<a.length; i++) //author:meizz
	      {
	          if(a[i].contentWindow==window)
	          {
				  iframeParentObjId=a[i].parentNode;
	          }
	      }
	  }
	}
	catch (ex){}
	if(iframeParentObjId==null || iframeParentObjId.id==null)return;
	parent.divWindowMovTitle(iframeParentObjId.id,text)       
}

/*****************************************************************************
Iframe 自动调整,不需要指定具体的Iframe对象名

iframeParentObjId	调整后可直接在子页中引用父页的FRAME父对象的ID
*****************************************************************************/
	  //父FRAME对象的ID
	  var iframeParentObjId=null;
	  var PmenuBoxId=null,PmenuBoxHeight=0;
      function iframeAutoFit(menuBoxId,menuBoxHeight)
      {
      //return;
          try
          {
              if(window!=parent)
              {
                  var a = parent.document.getElementsByTagName("IFRAME");
                  var menuBoxH=0;
                  for(var i=0; i<a.length; i++) //author:meizz
                  {
                      if(a[i].contentWindow==window)
                      {
                          var h1=0, h2=0;
						  if(iframeParentObjId==null)iframeParentObjId=a[i].parentNode;
                          a[i].parentNode.style.height = a[i].offsetHeight +"px";
                          a[i].style.height = "10px";						  
                          if(document.documentElement&&document.documentElement.scrollHeight)
                          {
                              h1=document.documentElement.scrollHeight;
                          }
                          if(document.body) h2=document.body.scrollHeight;

                          var h=Math.max(h1, h2);
                          //if(document.all) {h += 4;}
                          //if(window.opera) {h += 1;}
                          a[i].style.height = a[i].parentNode.style.height = h +"px";
                          menuBoxH=h;
                          
						  if(menuBoxId!=null){
						  	menuBoxId=document.getElementById(menuBoxId);
						  	if(menuBoxId!=null){
						  		PmenuBoxId=menuBoxId;
						  		PmenuBoxHeight=menuBoxHeight;			  		
						  	}
						  }
						  
						//alert(PmenuBoxHeight+"-"+PmenuBoxId+"-");
						//alert(PmenuBoxId.childNodes);
						/*
						menuBox.childNodes
						clientHeight
						*/
						//alert(PmenuBoxHeight+"-"+PmenuBoxId.id+"-"+h+"-"+(h<PmenuBoxHeight)+"-"+a[i].id);
						if(h>PmenuBoxHeight&(PmenuBoxId!=null&PmenuBoxHeight>0)){
							PmenuBoxId.style.height=PmenuBoxHeight+"px";
							a[i].parentNode.style.height=PmenuBoxHeight+0+"px";
							 a[i].style.height=PmenuBoxHeight+10+"px";
						}
						//PmenuBoxId & PmenuBoxId.firstChild & 
						if(PmenuBoxId.firstChild.offsetHeight<PmenuBoxHeight){
							PmenuBoxId.style.height= "100%";	
							if(PmenuBoxId.firstChild.offsetHeight>0){
							 //a[i].parentNode.style.height=PmenuBoxId.firstChild.offsetHeight;
							 //a[i].style.height =PmenuBoxId.firstChild.offsetHeight;		  
							  a[i].parentNode.style.height=PmenuBoxId.firstChild.offsetHeight+0+"px";
							  a[i].style.height=PmenuBoxId.firstChild.offsetHeight+6+"px";
							}
						}
                      }
                  }
                  if(menuBoxH>PmenuBoxHeight&(PmenuBoxId!=null&PmenuBoxHeight>0)){
							//PmenuBoxId.style.height=PmenuBoxHeight+"px";
							//alert(h);
						}else{
							//PmenuBoxId.style.height= "100%";
							//a[i].style.height = a[i].parentNode.style.height = h +"px";
							//alert("#"+h);
					}

                  
              }
          }
          catch (ex){}
      }
      if(window.attachEvent)
      {
          window.attachEvent("onload",    iframeAutoFit);
          //window.attachEvent("onresize",    iframeAutoFit);
      }
      else if(window.addEventListener)
      {
          window.addEventListener('load',    iframeAutoFit,    false);
          //window.addEventListener('resize',    iframeAutoFit,    false);
      }

	function iframeParentCls(){
		if(iframeParentObjId)
			iframeParentObjId.style.display='none';
	}
