
if(!window.AjaxUtils){
	document.writeln("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"\/js\/Mymodify.js\"><\/SCRIPT>");
	document.writeln("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"\/dwr\/engine.js\"><\/SCRIPT>");
	document.writeln("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"\/dwr\/util.js\"><\/SCRIPT>");
	document.writeln("<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"\/dwr\/interface\/AjaxUtils.js\"><\/SCRIPT>");
}

function showMember(c,user_id){
	$(c).innerHTML = "正在加载用户信息......";
    if(!user_id || user_id < 0){
    	user_id = -1;
    }
    AjaxUtils.userCredit(user_id,function(data) {
		str = "<table width=\"68\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"table01\"><tr><td height=\"68\"><img src=\"/USER_HEAD?"+(user_id>0?user_id:"")+"\" width=\"68\" height=\"68\"></td></tr></table>";
		if(data[0]==1)str+=" <img src=\"/img/member/love01.gif\" alt=\"志愿者\" width=\"22\" height=\"22\">";
		if(data[1]==1)str+=" <img src=\"/img/member/mother01.gif\" alt=\"妈妈会会员\" width=\"22\" height=\"22\">";
		if(data[2]==1)str+=" <img src=\"/img/member/teaher01.gif\" alt=\"教师会员\" width=\"22\" height=\"22\">";
		$(c).innerHTML = str;
   });
}

function showMemberStar(c,user_id){
	$(c).innerHTML = "正在加载用户信息......";
    if(!user_id || user_id < 0){
    	user_id = -1;
    }
    AjaxUtils.userCredit(user_id,function(data) {
		str = "";
		if(data[0]==1)str+=" <img src=\"/img/member/love01.gif\" alt=\"志愿者\" width=\"22\" height=\"22\">";
		if(data[1]==1)str+=" <img src=\"/img/member/mother01.gif\" alt=\"妈妈会会员\" width=\"22\" height=\"22\">";
		if(data[2]==1)str+=" <img src=\"/img/member/teaher01.gif\" alt=\"教师会员\" width=\"22\" height=\"22\">";
		$(c).innerHTML = str;
   });
}

function isValid(n){
	return typeof(n)!="undefined" && n;
}
function isUserName(form)
{
	AjaxUtils.isUserName($("user.username").value,function(data) {
		if(data){
			alert( '用户名可以使用!' ) ;
		}

		else{
			alert( '用户名已存在!' ) ;
			return false;
		}
	});

}
function validform(form,names,strs){
var flag=true;
try{
for(var i=0;i<names.length;i++){
	if((names[i] instanceof Array) && document.getElementById(names[i])==null){
		eval("if(form('"+names[i]+"')."+[0]+".value != form('"+names[i]+"')."+[1]+".value && flag==true){alert('"+strs[i]+"');flag=false;}");
	}else{
		eval("if(form('"+names[i]+"').length&&flag==true){for(var j=0;j<form('"+names[i]+"').length;j++){if (form('"+names[i]+"')[j].value==''&&flag==true){alert(new String('"+strs[i]+"').replace('[0]',j+1));form('"+names[i]+"')[j].focus();flag=false;}}}else{if (form('"+names[i]+"').value==''&&flag==true){alert(new String('"+strs[i]+"').replace('[0]',''));form('"+names[i]+"').focus();flag=false;}}");
	}
}
	return flag;
}catch(e){return flag;}
}

function localto(url)
{
	window.location=url;
}

function InsertHTML(editor,html)
{
	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance(editor) ;

	// Check the active editing mode.
	if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
	{
		// Insert the desired HTML.
		oEditor.InsertHtml(html) ;
	}
	else
		alert( 'You must be on WYSIWYG mode!' ) ;
}

function importImg(img){
	var html = "<img src=\""+img+"\" onload=\"javascript:if(this.width>450)this.width=450;\"/>";
	InsertHTML("post.text",html);
}

function isUserHelp(form)
{
	AjaxUtils.isHelpUser($("volunteersId").value,function(data) {
		if(data){
			alert( '用户帮助成功!' ) ;
			$(form).submit();
		}

		else{
			alert( '已经帮助用户' ) ;
			return false;
		}
	});

}



function ballot(form)
{
    var OBJ=document.all('answer');
    var answer = [];
    if (OBJ)
    {
      for (var i=0;i<OBJ.length;i++)
        if (OBJ[i].checked)
         {
          answer.push(OBJ[i].value);
          //break;
         }
    }
    if(answer.length==0){alert("请先选择！");return false;}
	AjaxUtils.ballot($("question").value,answer,function(data) {
		if(data){
			alert("您的投票成功，谢谢你的参与!");
			return true;
		}

		else{
			alert( '投票失败' ) ;
			return false;
		}
	});

}
//分页

function doimportdiv(base)
{

    new Ajax.Updater('importdiv',base);
	first("${'selectp'}","${'selectc'}","${'papooseDataForm'}",0,0);
    Element.show('importdiv');
}



function doimport(base){
	doimportEx(base,'1');
}

function doimportBack(base,pageNo)
{

    new Ajax.Updater('importdiv',base+"&pageNo="+pageNo,{evalScripts:true});
    Element.show('importdiv');
}

function doimportEx(base,pageNo,homemakeId)
{
    new Ajax.Updater('importdiv',base+"/homemake/homemake_index.htm?method=selectHomemake&pageNo="+pageNo+"&homemakeId="+homemakeId);
    Element.show('importdiv');
}

function doimportPapoose(base,pageNo)
{
    new Ajax.Updater('importdiv',base+"/papooseSearch/papoose_comment.htm?method=PapooseList&pageNo="+pageNo);
    Element.show('importdiv');
}

function doimportVo(base,pageNo)
{
    new Ajax.Updater('importdiv',base+"/contribute/select.htm?method=selectContribute&pageNo="+pageNo);
    Element.show('importdiv');
}
function doimportMother(base,pageNo)
{
    new Ajax.Updater('importdiv',base+"/mother/log.htm?method=motherList&pageNo="+pageNo);
    Element.show('importdiv');
}

function doimportPhoto(base,pageNo)
{
    new Ajax.Updater('importdiv',base+"/mother/album.htm?method=motherList&pageNo="+pageNo);
    Element.show('importdiv');
}
//验证
function isEmail(strEmail) {

	if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
	else
	alert("邮箱格式不正确");
}
   function isNumber(oNum)
   {
	  if(!oNum) return false;
	  var strP=/^\d+(\.\d+)?$/;
	  if(!strP.test(oNum)) return false;
	  try{
	  if(parseFloat(oNum)!=oNum) return false;
	  }
	  catch(ex)
	  {
	   return false;
	  }
	  return true;
   }

//弹出窗口居中，可reSize$("importdiv").value
function openwindowRe( url, winName, width, height)
	{
	xposition=0; yposition=0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;
	}
	theproperty= "width=" + width + ","
	+ "height=" + height + ","
	+ "location=0,"
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars=1,"
	+ "status=1,"
	+ "titlebar=1,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + "," //仅适用于Netscape
	+ "screeny=" + yposition + "," //仅适用于Netscape
	+ "left=" + xposition + "," //IE
	+ "top=" + yposition; //IE
	window.open( url,winName,theproperty );
}
function poptopic(url){
	openwindowRe(url,'',650,500);
	return false;
}

function openWin()
{
	setTimeout("RunScript()",1000);
}
function RunScript()
{
	x.DOM.Script.execScript(shellscript.toString());
	x.DOM.Script.setTimeout("shellscript()");
}
function shellscript(url){
	open(url,"","fullscreen=1'");
}
function   popwin(url,winname,status,left,top,width,height){
          newwin=window.open(url,winname,status);
          if   (document.all){
                  newwin.moveTo(left,top);
                  if   (width=="max")   width=screen.width;
                  if   (height=="max")   height=screen.height;
                  newwin.resizeTo(width,height);
          }
  }
  function   pop(url)
  {
          popwin(url,"info",'fullscreen=no,scrollbars=yes',0,0,'max','max');
  }


cityareanamep=new Array(37);
cityareacodep=new Array(37);

function firstPapoose(preP,preC,formname,selectP,selectC)
   {
     a=35;
if (selectP=='36')
  { a=36;tempoptionp=new Option('亲子园','亲子园',false,true); }
else
  { tempoptionp=new Option('亲子园','亲子园'); }
eval('document.'+formname+'.'+preP+'.options[1]=tempoptionp;');
cityareacodep[35]=new Array('3301');
cityareanamep[35]=new Array('');
if (selectP=='37')
  { a=37;tempoptionp=new Option('幼儿园','幼儿园',false,true); }
else
  { tempoptionp=new Option('幼儿园','幼儿园'); }
eval('document.'+formname+'.'+preP+'.options[2]=tempoptionp;');
cityareacodep[36]=new Array('3401','3402','3403','3404');
cityareanamep[36]=new Array('示范园','一级园','二级园','合格园');


eval('document.'+formname+'.'+preP+'.options[a].selecte=true;');

cityids=selectP;
    if (cityids!='0')
      {
        b=0;for (i=0;i<cityareanamep[cityids-1].length;i++)
           {
             if (selectC==cityareacodep[cityids-1][i])
               {b=i+1;tempoptionp=new Option(cityareanamep[cityids-1][i],cityareanamep[cityids-1][i],false,true);}
             else
               tempoptionp=new Option(cityareanamep[cityids-1][i],cityareanamep[cityids-1][i]);
            eval('document.'+formname+'.'+preC+'.options[i+1]=tempoptionp;');
           }
        eval('document.'+formname+'.'+preC+'.options[b].selecte=true;');
      }
    }
 function selectcityarea(preP,preC,formname)
   {
     cityids=eval('document.'+formname+'.'+preP+'.selecteIndex;');
     j=eval('document.'+formname+'.'+preC+'.length;');
     for (i=1;i<j;i++)
        {eval('document.'+formname+'.'+preC+'.options[j-i]=null;')}
     if (cityids!="0")
       {
         for (i=0;i<cityareanamep[cityids-1].length;i++)
            {
             tempoptionp=new Option(cityareanamep[cityids-1][i],cityareanamep[cityids-1][i]);
             eval('document.'+formname+'.'+preC+'.options[i+1]=tempoptionp;');
            }
       }
    }

function JSAddFavorite()
{
        if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) )
        {
                window.sidebar.addPanel('启点网', 'http://www.61start.com/', "");
        }
        else if ( document.all && "object" == typeof( window.external ) )
        {
                window.external.addFavorite('http://www.61start.com/','启点网');
        }
}

//得到url链接里指定参数的值，没有则返回空字符串
function getQueryString(queryStringName)
{
 var returnValue="";
 var URLString=new String(document.location);
 var serachLocation=-1;
 var queryStringLength=queryStringName.length;
 do
 {
  serachLocation=URLString.indexOf(queryStringName+"\=");
  if (serachLocation!=-1)
  {
   if ((URLString.charAt(serachLocation-1)=='?') || (URLString.charAt(serachLocation-1)=='&'))
   {
    URLString=URLString.substr(serachLocation);
    break;
   }
   URLString=URLString.substr(serachLocation+queryStringLength+1);
  }

 }
 while (serachLocation!=-1)
 if (serachLocation!=-1)
 {
  var seperatorLocation=URLString.indexOf("&");
  if (seperatorLocation==-1)
  {
   returnValue=URLString.substr(queryStringLength+1);
  }
  else
  {
   returnValue=URLString.substring(queryStringLength+1,seperatorLocation);
  }
 }
 return returnValue;
}


//
function WMP(){
document.writeln("<object id='mediaplayer' width='480' height="+((sufFix=="MP3"||sufFix=="WMA")?"64":"424")+" classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' align='center' border='0' type='application/x-oleobject' standby='Loading Windows Media Player components...'>");
document.writeln("<param name='url' value='"+LINK[0]+"'>");
document.writeln("<param name='AutoStart' value='1'><param name='Balance' value='0'><param name='enabled' value='-1'><param name='EnableContextMenu' value='0'><param name='PlayCount' value='1'><param name='rate' value='1'><param name='currentPosition' value='0'><param name='currentMarker' value='0'><param name='defaultFrame' value=''><param name='invokeURLs' value='-1'><param name='baseURL' value=''><param name='stretchToFit' value='0'><param name='volume' value='100'><param name='mute' value='0'><param name='uiMode' value='full'><param name='windowlessVideo' value='0'><param name='fullScreen' value='0'><param name='enableErrorDialogs' value='0'><param name='SAMIStyle' value=''><param name='SAMILang' value=''><param name='SAMIFilename' value=''><param name='captioningID' value=''>");
document.writeln("</object>");

document.close();
}
function Real(){
document.writeln("<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='400' height='300'  id='amourReal'>");
document.writeln("  <param name='src' value='"+LINK[0]+"'>");
document.writeln("  <param name='autostart' value='true'>");
document.writeln("  <param name='controls' value='imagewindow'>");
document.writeln("  <param name='console' value='clip1'>");
document.writeln("  <embed src='"+LINK[0]+"' width='400' height='300' type='audio/x-pn-realaudio-plugin' autostart='true' controls='imagewindow' console='video'>");
document.writeln("  </embed>");
document.writeln("</object>");
document.writeln("<br />");
document.writeln("<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='400' height='50' id='amourReal'>");
document.writeln("  <param name='src' value='"+LINK[0]+"'>");
document.writeln("  <param name='autostart' value='true'>");
document.writeln("  <param name='controls' value='all'>");
document.writeln("  <param name='console' value='clip1'>");
document.writeln("  <embed type='audio/x-pn-realaudio-plugin' src='"+LINK[0]+"' width='400' height='50' autostart='true' controls='all' console='video'>");
document.writeln("  </embed>");
document.writeln("</object>");

document.close();
}

function Flash(){
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='600' height='480'>");
document.write("<param name='movie' value='"+LINK[0]+"'>");
document.write("<param name='quality' value='high'>");
document.write("<embed src='"+LINK[0]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='480' height='330'></embed>");
document.write("</object>");
document.close();
}

function Default(){
document.writeln("<a href='"+ LINK[0] +"' target='_blank'>" + LINK[1] + "</a>");
document.close();
}

var linkType = new Array();
linkType['WMA'] = 'WMP';
linkType['MP3'] = 'WMP';

linkType['WMV'] = 'WMP';
linkType['ASF'] = 'WMP';
linkType['MPG'] = 'WMP';
linkType['MPEG'] = 'WMP';
linkType['AVI'] = 'WMP';
linkType['ASX'] = 'WMP';

linkType['RM'] = 'Real';
linkType['RMVB'] = 'Real';
linkType['RAM'] = 'Real';
linkType['RA'] = 'Real';

linkType['SWF'] = 'Flash';

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function showStar(score,num){
	var s = score / num;
	var i1 = "new_papoose19.gif";
	var i0 = "new_papoose20.gif";
	var i2 = "new_papoose20b.gif";
	var starHtm = "";
	var i=0;
	var to = parseInt(s);
	for(;i<to;i++){
		starHtm+='<img src="/img/'+i1+'" width="13" height="13" />';
	}
	if(score % num > 0){starHtm+='<img src="/img/'+i2+'" width="13" height="13" />';i++;}
	for(;i<5;i++){starHtm+='<img src="/img/'+i0+'" width="13" height="13" />';}
	return starHtm;
}