﻿function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

function check_yp_search(theform)
			{
				if(theform.keyword.value.length<1)
				{
					alert('至少要输入1个数字!');
					return false;
				}
				else
				{
					theform.keyword.value=check_word(theform.keyword.value);
					return true;
				}
			}
function check_word(word)
{
 var aaa=word;
 var st=0,en=0;
 var st_tag=false,en_tag=false;
 for(i=0;i<aaa.length;i++)
 {
 	if(check_num(aaa.substring(i,i+1))&&!st_tag)
 	{
 		st=i;
 		st_tag=true;
 	}
 	if(st_tag)
 	{
 		if(!check_num(aaa.substring(i,i+1))&&!en_tag)
 		{
 			en=i;
 			en_tag=true;	
 		}
 	}
 }
 if(en==0)
   en=aaa.length;
 return aaa.substring(st,en);
}
function check_num(w)
{
	var num_arry="0123456789";
	if(num_arry.indexOf(w)==-1)
		return false;
	else
		return true;
} 

if(document.post_form!=null)
	post_form.onsubmit=Check_Post(post_form);

function Check_Post(theForm)
{

var i,mulu_arr,mulu_count;
mulu_arry="";
mulu_count=0;
mulu_name="";


for(i=0;i<theForm.mulu.length;i++)
	if(theForm.mulu[i].checked)
	{
		mulu_arry+=theForm.mulu[i].value+",";
		mulu_name+="\n"+theForm.yp_type[i].value
		mulu_count+=1;
	}

if(mulu_count>100)
	{	
	alert("最多能选择100个目录,请重新选择!");
	return false;
	}
else if	(mulu_count==0)
	{
	alert("至少要选择2个目录!");
	return false;
	}
else 
	{		
	theForm.mulu_arry.value=mulu_name;
	if(window.confirm("注意:\n你申请加入的目录是:\n"+mulu_name+"\n你确定要加入吗?"))
		return true;
	else
		return false;
	}
}

var bV=parseInt(navigator.appVersion);
var NS4=(document.layers) ? true : false;
var IE4=((document.all)&&(bV>=4))?true:false;
//var ver4 = (NS4 || IE4) ? true : false;
var ver4=true;
isExpanded = false;
function getIndex(el) {
   ind = null;
   for (i=0; i<document.layers.length; i++) {
	whichEl = document.layers[i];
	if (whichEl.id == el) {
	   ind = i;
	   break;
	}
   }
   return ind;
}

function arrange() {
   nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
   for (i=firstInd+1; i<document.layers.length; i++) {
	whichEl = document.layers[i];
	   if (whichEl.visibility != "hide") {
		whichEl.pageY = nextY;
		nextY += whichEl.document.height;
	   }
   }
}

function initIt(){

   if (NS4) {
	for (i=0; i<document.layers.length; i++) {
	   whichEl = document.layers[i];
		if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
	}
	arrange();
   }
   else {
	//tempColl = document.all.tags("DIV");
	tempColl = document.getElementsByTagName("DIV");
	for (i=0; i<tempColl.length; i++) {
	   if (tempColl[i].className == "child") tempColl[i].style.display = "none";
	}
   }
}

function expandIt(el) {
   expandIE(el);
   //if (!ver4) return;
   //if (IE4) {expandIE(el)} else {expandNS(el)}
}

function expandIE(el) { 
   whichEl =document.getElementById(el + "Child");
   whichIm= whichEl.previousSibling.childNodes[0];
   //whichIm = event.srcElement;
   if (whichEl.style.display == "block") {
	whichEl.style.display = "none";
        if( whichIm!=null)
			whichIm.src = "/gb/images/midplus.gif";		
   }
   else {
	whichEl.style.display = "block";
	if( whichIm!=null)
		whichIm.src = "/gb/images/bullet-minus.gif";	
   }
   
}

function expandNS(el) {
   whichEl = eval("document." + el + "Child");
   whichIm = eval("document." + el + "Parent.document.images['imEx']");
   if (whichEl.visibility == "hide") {
	whichEl.visibility = "show";
	whichIm.src = "/gb/images/bullet-minus.gif";
   }
   else {
	whichEl.visibility = "hide";
        whichIm.src = "/gb/images/midplus.gif";
   }
   arrange();
}

function showAll() {
   if (NS4) {
	for (i=0; i<document.layers.length; i++) {
	   whichEl = document.layers[i];
		if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "visible";
	}
	arrange();
   }
   else {
	//tempColl = document.all.tags("DIV");
	tempColl = document.getElementsByTagName("DIV");
	for (i=0; i<tempColl.length; i++) {
	   if (tempColl[i].className == "child") tempColl[i].style.display = "block";
	}
   }
}

function expandAll(isBot) {
   newSrc = (isExpanded) ? "midplus.gif" : "/gb/images/bullet-minus.gif";
   if (NS4) {
        document.images["imEx"].src = newSrc;
	for (i=firstInd; i<document.layers.length; i++) {
		whichEl = document.layers[i];
		if (whichEl.id.indexOf("Parent") != -1) {
		   whichEl.document.images["imEx"].src = newSrc;
		}
		if (whichEl.id.indexOf("Child") != -1) {
		   whichEl.visibility = (isExpanded) ? "hide" : "show";
		}
	}

	arrange();
	if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
   }
   else {
	divColl = document.all.tags("DIV");
	for (i=0; i<divColl.length; i++) {
		if (divColl(i).className == "child") {
		   divColl(i).style.display = (isExpanded) ? "none" : "block";
		}
	}
	imColl = document.images.item("imEx");
	for (i=0; i<imColl.length; i++) {
		imColl(i).src = newSrc;
	}
   }

   isExpanded = !isExpanded;
}

with (document) {
   write("<STYLE TYPE='text/css'>");
   if (NS4) {
	write(".parent {position:absolute; visibility:hidden}");
	write(".child {position:absolute; visibility:hidden}");
	write(".regular {position:absolute; visibility:hidden}")
   }
   else {
	write(".child {display:none}")
   }
   write("</STYLE>");
}
initIt();