// wiki 部分JS
function isDefaultMessage(message) {
	var str = message.replace(/^\s+|\s+$/g, "");
	if (str === "" || str === "\u4f8b: \u4e1c\u65b9\u660e\u73e0\u6709\u591a\u9ad8\uff1f" || str === "\u4f8b: \u53d7\u7406\u70b9" || str === "\u4f8b: \u91d1\u8d38\u5927\u53a6" || str === "\u4f8b: \u9605\u8bfb\u51e0\u672c\u597d\u4e66" || str === "\u4f8b: \u6caaA88888" || str === "\u4f8b: \u793e\u4fdd\u5361\u670d\u52a1\u4e2d\u5fc3") {
		return true;
	} else {
		return false;
	}
}
function clearMessage() {
	var testObj = document.getElementById("cphm");
	if (isDefaultMessage(testObj.value)) {
		testObj.value = "";
		testObj.style.color = "#000000";
	} else {
		testObj.style.color = "#000000";
	}
}
function showMessage(nb) {
	var formObj = document.getElementById("traffic_form");
	var testObj = document.getElementById("cphm");
	switch (Number(nb)) {
	  case 1:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u4e1c\u65b9\u660e\u73e0\u6709\u591a\u9ad8\uff1f";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	  case 2:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u53d7\u7406\u70b9";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	  case 3:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u91d1\u8d38\u5927\u53a6";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	  case 4:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u9605\u8bfb\u51e0\u672c\u597d\u4e66";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	  case 5:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u6caaA88888";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	  case 6:
		if (isDefaultMessage(testObj.value)) {
			testObj.value = "\u4f8b: \u793e\u4fdd\u5361\u670d\u52a1\u4e2d\u5fc3";
			testObj.style.color = "#CCCCCC";
			formObj.action = "";
		} else {
			formObj.action = "";
		}
		break;
	}
}
function doSubmit() {
	var formObj = document.getElementById("traffic_form");
	var selectObj = document.getElementsByName("runflag");
	var testObj = document.getElementById("cphm");
	var selected = "";
	for (var i = 0; i < selectObj.length; i++) {
		if (selectObj[i].checked) {
			selected = selectObj[i].value;
		}
	}
	if (isDefaultMessage(testObj.value)) {
		alert("\u8bf7\u8f93\u5165\u60a8\u8981\u67e5\u8be2\u7684\u4fe1\u606f!");
		return false;
	}
	switch (Number(selected)) {
	  case 1:
	  	//综合信息
		formObj.action = "http://smeline.smmail.cn/fbsystem/yuqing/smmail/jsp/Search/SearchText.jsp?searchtext=" + testObj.value;
		return true;
		break;
	  case 2:
	  	//市民信箱
		formObj.action = "http://wiki.smmail.cn/wiki/smmail/jsp/searchquestion.jsp?finished=2&question=\u5e02\u6c11\u4fe1\u7bb1 " + testObj.value;
		return true;
		break;
	  case 3:
	  	//交通地图
		formObj.action = "http://www.ddmap.com/mstmap50007/g_search.jsp?g_addr=&g_scope=1000&g_mapid=21&typename=&keynameEx=" + testObj.value + "&keyname=" + testObj.value;
		return true;
		break;
	  case 4:
	  	//市民博客
		formObj.action = "http://blog.smmail.cn/blog/smmail/jsp/main/list.jsp?sSearchKey_BlogName=" + testObj.value;
		return true;
		break;
	  case 5:
	  	//违章通知
		formObj.action = "http://218.78.214.28/infosource/smmail/jsp/police/policeQuery.jsp?cphm=" + testObj.value;
		return true;
		break;
	  case 6:
	  	//服务热线
		formObj.action = "http://wiki.smmail.cn/wiki/smmail/jsp/searchquestion.jsp?finished=2&question=" + testObj.value;
		return true;
		break;
	  case 7:
	  	//市民论坛
		formObj.action = "http://smeline.smmail.cn/fbsystem/yuqing/smmail/jsp/Test/testSearch.jsp?searchWords=" + testObj.value + "&area=2";
		return true;
		break;
	  case 8:
	  	//市民博文
		formObj.action = "http://smeline.smmail.cn/fbsystem/yuqing/smmail/jsp/Test/testSearch.jsp?searchWords=" + testObj.value + "&area=3";
		return true;
		break;
	  case 9:
	  	//市民关注
		formObj.action = "http://smeline.smmail.cn/fbsystem/yuqing/smmail/jsp/Test/testSearch.jsp?searchWords=" + testObj.value + "&area=4";
		return true;
		break;
	}
}

function openEduInfo(){
	openUrl('MoreCommonInfoForMain.jsp','教育公告信息列表',true,430,435,initleftPosOfMainTd+160,50);
}

function openSecondClass(){
	openUrl('MoreSecondClassForMain.jsp','第二课堂列表',true,410,409,initleftPosOfMainTd +265,40);
}

function openStudyInfo(){
}

function openStudentEnglish(){
	window.open("http://www.smmail.cn/sspost/sy/index.html", "_blank");
}

function openExpert(){
	openUrl('MoreExpertViewForMain.jsp','专家观点列表',true,410,409,initleftPosOfMainTd +265,40);
}

function openReputation(){
	openUrl('MoreMsArticleForMain.jsp','名师指点列表',true,410,408,initleftPosOfMainTd +265,40);
}

function openTeacherBlog(){
	openUrl('MoreTeacherBlogForMain.jsp','教师博客列表',true,430,435,initleftPosOfMainTd + 275,40);
}

function openStuendtBlog(){
	openUrl('MoreStudentArticleList.jsp?isShowAll=true&CurrentClassId=','学生博文列表',true,530,445,initleftPosOfMainTd + 225,70);
}

// 页面变换
function changeDIV(divName) {
	// 教育信息
	if (divName === "edu_content") {
		var eduTitleObj = document.getElementById("edu_img");
		var secTitleObj = document.getElementById("sec_img");
		var eduListObj = document.getElementById("edu_content");
		var secListObj = document.getElementById("sec_content");
		var eduMoreObj = document.getElementById("edumore_img");
		if (eduTitleObj && secTitleObj && eduListObj && secListObj && eduMoreObj) {
			eduTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/edu_img.gif')";
			secTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/sec_img.gif')";
			eduListObj.style.display = "";
			secListObj.style.display = "none";
			eduMoreObj.onclick = openEduInfo;
		}
	}
	
	// 第二课堂
	if (divName === "sec_content") {
		eduTitleObj = document.getElementById("edu_img");
		secTitleObj = document.getElementById("sec_img");
		eduListObj = document.getElementById("edu_content");
		secListObj = document.getElementById("sec_content");
		eduMoreObj = document.getElementById("edumore_img");
		if (eduTitleObj && secTitleObj && eduListObj && secListObj && eduMoreObj) {
			eduTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/edu_b_img.gif')";
			secTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/sec_b_img.gif')";
			eduListObj.style.display = "none";
			secListObj.style.display = "";
			eduMoreObj.onclick = openSecondClass;
		}
	}
	
	// 活动信息
	if (divName === "iteminfo_content") {
		var itTitleObj = document.getElementById("iteminfo_");
		var rsTitleObj = document.getElementById("service_");
		var itListObj = document.getElementById("iteminfo_content");
		var rsListObj = document.getElementById("service_content");
		if (itTitleObj && rsTitleObj && itListObj && rsListObj) {
			itTitleObj.style.backgroundColor = "white";
			itTitleObj.style.color = "#F7941D";
			rsTitleObj.style.backgroundColor = "";
			rsTitleObj.style.color = "#FFFFFF";
			rsListObj.style.display = "none";
			itListObj.style.display = "";
		}
	}
	
	// 推荐服务
	if (divName === "service_content") {
		itTitleObj = document.getElementById("iteminfo_");
		rsTitleObj = document.getElementById("service_");
		itListObj = document.getElementById("iteminfo_content");
		rsListObj = document.getElementById("service_content");
		if (itTitleObj && rsTitleObj && itListObj && rsListObj) {
			rsTitleObj.style.backgroundColor = "white";
			rsTitleObj.style.color = "#F7941D";
			itTitleObj.style.backgroundColor = "";
			itTitleObj.style.color = "#FFFFFF";
			itListObj.style.display = "none";
			rsListObj.style.display = "";
		}
	}
	
	// studyinfo_content
	if (divName === "studyinfo_content") {
		siListObj = document.getElementById("studyinfo_content");
		seListObj = document.getElementById("studentenglish_content");
		//psListObj = document.getElementById("pscbasketball_content");		
		siBotton = document.getElementById("studyinfo_img");
		seBotton = document.getElementById("studentenglish_img");
		//psBotton = document.getElementById("pscbasketball_img");
		if (siListObj && seListObj /*&& psListObj*/) {
			siBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studyinfo_new.gif')";
			seBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studentenglish_new.gif')";
			//psBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/pscbasketball.gif')";
			siListObj.style.display = "";
			seListObj.style.display = "none";
			//psListObj.style.display = "none";
		}
	}
	
	// studentenglish_content
	if (divName === "studentenglish_content") {
		siListObj = document.getElementById("studyinfo_content");
		seListObj = document.getElementById("studentenglish_content");
		//psListObj = document.getElementById("pscbasketball_content");		
		siBotton = document.getElementById("studyinfo_img");
		seBotton = document.getElementById("studentenglish_img");
		//psBotton = document.getElementById("pscbasketball_img");
		if (siListObj && seListObj /*&& psListObj*/) {
			siBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studyinfo_b_new.gif')";
			seBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studentenglish_b_new.gif')";
			//psBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/pscbasketball.gif')";
			siListObj.style.display = "none";
			seListObj.style.display = "";
			//psListObj.style.display = "none";
		}
	}
	
	// pscbasketball_content
	if (divName === "pscbasketball_content") {
		siListObj = document.getElementById("studyinfo_content");
		seListObj = document.getElementById("studentenglish_content");
		psListObj = document.getElementById("pscbasketball_content");		
		siBotton = document.getElementById("studyinfo_img");
		seBotton = document.getElementById("studentenglish_img");
		psBotton = document.getElementById("pscbasketball_img");
		if (siListObj && seListObj && psListObj) {
			siBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studyinfo_b_new.gif')";
			seBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studentenglish_new.gif')";
			psBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/pscbasketball_b.gif')";
			siListObj.style.display = "none";
			seListObj.style.display = "none";
			psListObj.style.display = "";
		}
	}	
	
	
	// 公告栏
	if (divName === "affiche_content") {
		var afTitleObj = document.getElementById("affiche_");
		var gaTitleObj = document.getElementById("game_affiche");
		var afListObj = document.getElementById("affiche_content");
		var gaListObj = document.getElementById("game_affiche_content");
		var afMoreObj = document.getElementById("affichemore_");
		if (afTitleObj && gaTitleObj && afListObj && gaListObj && afMoreObj) {
			afTitleObj.style.backgroundColor = "white";
			afTitleObj.style.color = "#72BF44";
			gaTitleObj.style.backgroundColor = "";
			gaTitleObj.style.color = "#FFFFFF";
			afListObj.style.display = "";
			gaListObj.style.display = "none";
			afMoreObj.href = "http://www.smmail.cn/smmail/sy/ggl/index.html";
		}
	}
	
	// 中奖公告
	if (divName === "game_affiche_content") {
		afTitleObj = document.getElementById("affiche_");
		gaTitleObj = document.getElementById("game_affiche");
		afListObj = document.getElementById("affiche_content");
		gaListObj = document.getElementById("game_affiche_content");
		afMoreObj = document.getElementById("affichemore_");
		if (afTitleObj && gaTitleObj && afListObj && gaListObj && afMoreObj) {
			afTitleObj.style.backgroundColor = "";
			afTitleObj.style.color = "#FFFFFF";
			gaTitleObj.style.backgroundColor = "white";
			gaTitleObj.style.color = "#72BF44";
			afListObj.style.display = "none";
			gaListObj.style.display = "";
			afMoreObj.href = "http://www.smmail.cn/smmail/sy/ggl/index.html";
		}
	}

	// 教师博客
	if (divName === "teacherblog_content") {
		var tbTitleObj = document.getElementById("teacherblog_img");
		var sbTitleObj = document.getElementById("studentblog_img");
		var tbListObj = document.getElementById("teacherblog_content");
		var sbListObj = document.getElementById("studentblog_content");
		var tbMoreObj = document.getElementById("blogmore_img");
		if (tbTitleObj && sbTitleObj && tbListObj && sbListObj && tbMoreObj) {
			tbTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/teacherblog.gif')";
			sbTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studentblog_b.gif')";
			tbListObj.style.display = "";
			sbListObj.style.display = "none";
			tbMoreObj.onclick = openTeacherBlog;
		}
	}
	
	// 学生博客
	if (divName === "studentblog_content") {
		tbTitleObj = document.getElementById("teacherblog_img");
		sbTitleObj = document.getElementById("studentblog_img");
		tbListObj = document.getElementById("teacherblog_content");
		sbListObj = document.getElementById("studentblog_content");
		tbMoreObj = document.getElementById("blogmore_img");
		if (tbTitleObj && sbTitleObj && tbListObj && sbListObj && tbMoreObj) {
			tbTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/teacherblog_b.gif')";
			sbTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/studentblog.gif')";
			tbListObj.style.display = "none";
			sbListObj.style.display = "";
			tbMoreObj.onclick = openStuendtBlog;
		}
	}
	
	// 调查天地
	if (divName === "vote_content") {
		var voTitleObj = document.getElementById("vote_");
		var vsTitleObj = document.getElementById("voteresult_");
		var voListObj = document.getElementById("vote_content");
		var vsListObj = document.getElementById("voteresult_content");
		var voMoreObj = document.getElementById("votemore_");
		if (voTitleObj && vsTitleObj && voListObj && vsListObj && voMoreObj) {
			voTitleObj.style.backgroundColor = "white";
			voTitleObj.style.color = "#EF5BA1";
			vsTitleObj.style.backgroundColor = "";
			vsTitleObj.style.color = "#FFFFFF";
			voListObj.style.display = "";
			vsListObj.style.display = "none";
			voMoreObj.href = "http://info.smmail.cn/jsp/wdpt/autotest/main/index_sy.jsp";
		}
	}
	
	// 调查结果
	if (divName === "voteresult_content") {
		voTitleObj = document.getElementById("vote_");
		vsTitleObj = document.getElementById("voteresult_");
		voListObj = document.getElementById("vote_content");
		vsListObj = document.getElementById("voteresult_content");
		voMoreObj = document.getElementById("votemore_");
		if (voTitleObj && vsTitleObj && voListObj && vsListObj && voMoreObj) {
			voTitleObj.style.backgroundColor = "";
			voTitleObj.style.color = "#FFFFFF";
			vsTitleObj.style.backgroundColor = "white";
			vsTitleObj.style.color = "#EF5BA1";
			voListObj.style.display = "none";
			vsListObj.style.display = "";
			voMoreObj.href = "http://info.smmail.cn/jsp/wdpt/autotest/main/index_sy.jsp";
		}
	}
	
	// 论坛热帖
	if (divName === "bbshot_content") {
		var bbsListObj = document.getElementById("bbshot_content");
		var easListObj = document.getElementById("easyinfo_content");
		var chiListObj = document.getElementById("childedu_content");
		var bbsBotton = document.getElementById("bbshot_img");
		var easBotton = document.getElementById("easyinfo_img");
		var chiBotton = document.getElementById("childedu_img");
		if (bbsListObj && easListObj && chiListObj ) {
			bbsBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/bbshot.gif')";
			easBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/easyinfo_b.gif')";
			chiBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/childedu_b.gif')";
			bbsListObj.style.display = "";
			easListObj.style.display = "none";
			chiListObj.style.display = "none";
		}
	}
	
	// 轻松一刻
	if (divName === "easyinfo_content") {
		bbsListObj = document.getElementById("bbshot_content");
		easListObj = document.getElementById("easyinfo_content");
		chiListObj = document.getElementById("childedu_content");		
		bbsBotton = document.getElementById("bbshot_img");
		easBotton = document.getElementById("easyinfo_img");
		chiBotton = document.getElementById("childedu_img");
		if (bbsListObj && easListObj && chiListObj) {
			bbsBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/bbshot_b.gif')";
			easBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/easyinfo.gif')";
			chiBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/childedu_b.gif')";
			bbsListObj.style.display = "none";
			easListObj.style.display = "";
			chiListObj.style.display = "none";
		}
	}
	
	// 亲子教育
	if (divName === "childedu_content") {
		bbsListObj = document.getElementById("bbshot_content");
		easListObj = document.getElementById("easyinfo_content");
		chiListObj = document.getElementById("childedu_content");		
		bbsBotton = document.getElementById("bbshot_img");
		easBotton = document.getElementById("easyinfo_img");
		chiBotton = document.getElementById("childedu_img");
		if (bbsListObj && bbsListObj && chiListObj) {
			bbsBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/bbshot_b.gif')";
			easBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/easyinfo_b.gif')";
			chiBotton.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/childedu.gif')";
			bbsListObj.style.display = "none";
			easListObj.style.display = "none";
			chiListObj.style.display = "";
		}
	}
	
	// 家长汇
	if (divName === "parents_content") {
		var paBotton = document.getElementById("parents_");
		var teBotton = document.getElementById("teachers_");
		var paListObj = document.getElementById("parents_content");
		var teListObj = document.getElementById("teachers_content");
		var paMoreObj = document.getElementById("parentmore_");
		if (paListObj && teListObj && paBotton && teBotton && paMoreObj) {
			paBotton.style.backgroundColor = "white";
			paBotton.style.color = "#F7941D";
			teBotton.style.backgroundColor = "";
			teBotton.style.color = "#FFFFFF";
			paListObj.style.display = "";
			teListObj.style.display = "none";
			paMoreObj.href = "http://bbs.smmail.cn/bbs/smmail/jsp/main/index.jsp?Url=http://bbs.smmail.cn/bbs/smmail/jsp/main/MoreBBSForMain.jsp?sKindId=1000146";
		}
	}
	
	// 教师汇
	if (divName === "teachers_content") {
		paBotton = document.getElementById("parents_");
		teBotton = document.getElementById("teachers_");
		paListObj = document.getElementById("parents_content");
		teListObj = document.getElementById("teachers_content");
		paMoreObj = document.getElementById("parentmore_");
		if (paListObj && teListObj && paBotton && teBotton && paMoreObj) {
			paBotton.style.backgroundColor = "";
			paBotton.style.color = "#FFFFFF";
			teBotton.style.backgroundColor = "white";
			teBotton.style.color = "#F7941D";
			paListObj.style.display = "none";
			teListObj.style.display = "";
			paMoreObj.href = "http://bbs.smmail.cn/bbs/smmail/jsp/main/index.jsp?Url=http://bbs.smmail.cn/bbs/smmail/jsp/main/MoreBBSForMain.jsp?sKindId=1000147";
		}
	}
	
	// 专家观点
	if (divName === "expert_content") {
		var exTitleObj = document.getElementById("expert_img");
		var reTitleObj = document.getElementById("reputation_img");
		var exListObj = document.getElementById("expert_content");
		var reListObj = document.getElementById("reputation_content");
		var exMoreObj = document.getElementById("expertmore_img");
		if (exTitleObj && reTitleObj && exListObj && reListObj && exMoreObj) {
			exTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/expert_img.gif')";
			reTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/reputation_img.gif')";
			exListObj.style.display = "";
			reListObj.style.display = "none";
			exMoreObj.onclick = openExpert;
		}
	}
	
	// 名师指导
	if (divName === "reputation_content") {
		exTitleObj = document.getElementById("expert_img");
		reTitleObj = document.getElementById("reputation_img");
		exListObj = document.getElementById("expert_content");
		reListObj = document.getElementById("reputation_content");
		exMoreObj = document.getElementById("expertmore_img");
		if (exTitleObj && reTitleObj && exListObj && reListObj && exMoreObj) {
			exTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/expert_b_img.gif')";
			reTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/reputation_b_img.gif')";
			exListObj.style.display = "none";
			reListObj.style.display = "";
			exMoreObj.onclick = openReputation;
		}
	}
	
	// 要闻导读/
	if (divName === "importantnews_content") {
		var imTitleObj = document.getElementById("importantnews_img");
		var naTitleObj = document.getElementById("nowawake_img");
		var imListObj = document.getElementById("importantnews_content");
		var naListObj = document.getElementById("nowawake_content");
		if (imTitleObj && naTitleObj && imListObj && naListObj) {
			imTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/importantnews_img.gif')";
			naTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/nowawake_img.gif')";
			imListObj.style.display = "";
			naListObj.style.display = "none";
		}
	}
	
	// 今日提示
	if (divName === "nowawake_content") {
		imTitleObj = document.getElementById("importantnews_img");
		naTitleObj = document.getElementById("nowawake_img");
		imListObj = document.getElementById("importantnews_content");
		naListObj = document.getElementById("nowawake_content");
		if (imTitleObj && naTitleObj && imListObj && naListObj) {
			imTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/importantnews_b_img.gif')";
			naTitleObj.style.backgroundImage = "url('http://jxhd.smmail.cn/newjxhd/smmail/images/index_new/nowawake_b_img.gif')";
			imListObj.style.display = "none";
			naListObj.style.display = "";
		}
	}
}
function loadinfo() {
	try {		
	// 活动信息
		var itTitleObj = document.getElementById("iteminfo_");
		if(itTitleObj){
			itTitleObj.style.backgroundColor = "white";
		}
			
	// 公告栏
		var afTitleObj = document.getElementById("affiche_");
		if(afTitleObj){
			afTitleObj.style.backgroundColor = "white";
		}
		
	// 调查天地
		var voTitleObj = document.getElementById("vote_");
		if(voTitleObj){
			voTitleObj.style.backgroundColor = "white";
		}
	
	// 家长汇
		var paBotton = document.getElementById("parents_");
		if(voTitleObj){
			paBotton.style.backgroundColor = "white";
		}
	
	// 调取期刊
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/qikan/newqikan.html", "qikan_body");

	// 天气预报
		//crossSubDomainRequest("iframeProxy_userinfo", "http://www.smmail.cn/smmail/mailtest/weather/weatherDate.html", "weatherDiv");
		//crossSubDomainRequest("iframeProxy_userinfo", "http://www.smmail.cn/smmail/mailtest/weather/weatherTemperature.html", "weatherEx");

	// 调取wiki问题页面
		crossSubDomainRequest("iframeProxy_wiki", "http://wiki.smmail.cn/wiki/smmail/html/newquestion.html", "wiki_question");
	
	// 调取fbsystem_1
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html1.htm", "ad1");

	// 调取ad_2
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html2.htm", "ad2");

	// 调取ad_3
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html3.htm", "ad3");

	// 调取ad_4
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html4.htm", "ad4");

	// 调取ad_5
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html5.htm", "ad5");

	// 调取ad_6
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html6.htm", "ad6");

	// 调取ad_7
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html7.htm", "ad7");

	// 调取ad_8
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html8.htm", "ad8");

	// 调取ad_9
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html9.htm", "ad9");

	// 调取ad_10
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html10.htm", "ad10");

	// 调取ad_11
		crossSubDomainRequest("iframeProxy_ad", "http://smeline.smmail.cn/fbsystem/html/jxhdsy_html11.htm", "ad11");
	}
	catch (e) {
		alert(e);
	}
}
function checkLogin(resultstr) {
	var LoginResult = resultstr;

	if (LoginResult) {
		if (LoginResult.indexOf("OK") >= 0) {
			var UserName = GetCookie("UserName");

			loadLoginPage(UserName);
		} else {
			//删除cookie
		}
	} else {
		//删除cookie
	}
}
function loadlogin() {
	try {
		var UserName = GetCookie("UserName");
		var LoginTime = GetCookie("LoginTime");
		var now = new Date();
		var CurrentTime = now.getTime();
		var dif = CurrentTime - LoginTime;

		if (UserName == null || LoginTime == null || UserName == "-1") {//静态页面
			//doRequest("http://www.smmail.cn/smmail/sy09/login_new/index.html", document.getElementById("login_main"), "", "u52a0u8f7du4e2d...");
		} else { //动态页面
			if (dif > 0) {
				// 调取登录验证
				crossSubDomainRequest("iframeProxy_userinfo", "http://info.smmail.cn/smmail/jsp/Portal/CheckLogined.jsp", "login_main", "checkLogin", " ");
			} else {
				loadLoginPage(UserName);
			}
		}
	}
	catch (e) {
		//alert(e);
	}
}
function loadLoginPage(username) {
	//doRequest("http://www.smmail.cn/smmail/sy09/login_ok/index.html", document.getElementById("login_main"), "", "u52a0u8f7du4e2d...");
	// 去除背景色
	var mainObj = document.getElementById("login_main");
	if (mainObj) {
		mainObj.style.backgroundColor = "white";
	}
	
	// 隐藏未登录DIV
	var nologinObj = document.getElementById("nologin");
	var loginokObj = document.getElementById("loginok");
	if (nologinObj && loginokObj) {
		nologinObj.style.display = "none";
		loginokObj.style.display = "";
	}
	// 隐藏广告2
	var ad_2Obj = document.getElementById("ad_2");
	var ad_14Obj = document.getElementById("ad_14");
	if (ad_2Obj && ad_14Obj) {
		ad_2Obj.style.display = "none";
		ad_14Obj.style.display = "";
	}
	// 隐藏广告3
	var ad_3Obj = document.getElementById("ad_3");
	var ad_15Obj = document.getElementById("ad_15");
	if (ad_3Obj && ad_15Obj) {
		ad_3Obj.style.display = "none";
		ad_15Obj.style.display = "";
	}
	// 隐藏广告6
	var ad_6Obj = document.getElementById("ad_6");
	var blank5 = document.getElementById("left_blank5");
	if (ad_6Obj && blank5) {
		ad_6Obj.style.display = "none";
		blank5.style.display = "none";
	}
	// 隐藏广告9
	var ad_9Obj = document.getElementById("ad_9");
	var blank7 = document.getElementById("left_blank7");
	if (ad_9Obj && blank7) {
		ad_9Obj.style.display = "none";
		blank7.style.display = "none";
	}
	// 隐藏WIKI
	var wikiObj = document.getElementById("wiki_main");
	var blank6 = document.getElementById("left_blank6");
	if (wikiObj && blank6) {
		wikiObj.style.display = "none";
		blank6.style.display = "none";
	}
	// 隐藏便民信息
	var infoObj = document.getElementById("info_main");
	var blank8 = document.getElementById("left_blank8");
	if (infoObj && blank8) {
		infoObj.style.display = "none";
		blank8.style.display = "none";
	}
	try {
	// 调取登录信息
		crossSubDomainRequest("iframeProxy_userinfo", "http://info.smmail.cn/smmail/jsp/Portal/Logined.jsp?username=" + username, "userinfo_body");
	// 调取邮件
		//crossSubDomainRequest("iframeProxy_userinfo", "http://info.smmail.cn/smmail/jsp/Portal/LoginMail.jsp?username=" + username, "mailbox_body");
	// 调取邮件
		//crossSubDomainRequest("iframeProxy_userinfo", "http://info.smmail.cn/smmail/jsp/Portal/JxNewMsgInfo.jsp?username=" + username, "jxhd1_body");
	// 调取blog问题页面
		//crossSubDomainRequest("iframeProxy_blog", "http://blog.smmail.cn/blog/smmail/jsp/main/getUserinfo_blog.jsp?username=" + username, "blog1_body");
	// 调取bbs问题页面
		//crossSubDomainRequest("iframeProxy_bbs", "http://bbs.smmail.cn/bbs/smmail/jsp/main/getUserinfo_bbs.jsp?username=" + username, "bbs1_body");
	// 调取wiki问题页面
		//crossSubDomainRequest("iframeProxy_wiki", "http://wiki.smmail.cn/wiki/smmail/jsp/getUserinfo_wiki.jsp?username=" + username, "wiki1_body");
	}
	catch (e) {
		alert(e);
	}
}
function openBill() {
	window.open("http://info.smmail.cn/jsp/user/USER_MENU.jsp?sid=1231935770775&Src=/jsp/user/ORDERLIST.jsp?sid=1231935770775&" + getRandom(), "_blank");
}
function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) {
			break;
		}
	}
	return null;
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie(name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}
function crossSubDomainRequest(iframeId, url, windowDiv, actionList, Html) {
	var result = "";
	if (!actionList) {
		actionList = "";
	}
	if (!Html) {
		Html = " ";
	}
	try {
		var proxy = document.getElementById(iframeId).contentWindow;
		if (proxy) {
			result = proxy.doRequest(url, document.getElementById(windowDiv), actionList, Html);
		} else {
			setTimeout("crossSubDomainRequest('" + iframeId + "','" + url + "','" + windowDiv + "','" + actionList + "','" + Html + "')", 100);
		}
	}
	catch (e) {
		setTimeout("crossSubDomainRequest('" + iframeId + "','" + url + "','" + windowDiv + "','" + actionList + "','" + Html + "')", 100);
	}
	return result;
}
function SetLoginResult(resultstr) {
	var LoginResult = resultstr;
	result = LoginResult.split(",");
	if (result.length > 0) {
		if (result[0] == "OK") {
			loadLoginPage(result[2]);
		} else {
			var loginDiv = document.getElementById("logining_");
			if (loginDiv) {
				loginDiv.style.display = "none";
			}
			alert("\u7528\u6237\u540d\u6216\u5bc6\u7801\u4e0d\u6b63\u786e\uff01");
		}
	} else {
		var loginDiv = document.getElementById("logining_");
		if (loginDiv) {
			loginDiv.style.display = "none";
		}
		alert("\u7528\u6237\u540d\u6216\u5bc6\u7801\u4e0d\u6b63\u786e\uff01");
	}
}
function doLogin() {
	var username = document.getElementById("username").value;
	var password = document.getElementById("password").value;
	var loginDiv = document.getElementById("logining_");
	if (loginDiv) {
		loginDiv.style.display = "";
	}
	var remflag = "";
	if (document.getElementById("remflag").checked == true) {
		remflag = document.getElementById("remflag").value;
	} else {
		remflag = "";
	}
	if (!remflag) {
		remflag = "";
	}
	if (username && password) {
		var url = "http://info.smmail.cn/smmail/jsp/Portal/LoginCheck.jsp?UserName=" + username + "&Pwd=" + UrlEncode(password) + "&remflag=" + remflag;
		//alert(url);
		crossSubDomainRequest("iframeProxy_userinfo", url, "login_main", "SetLoginResult", " ");
	} else {
		if (loginDiv) {
			loginDiv.style.display = "none";
		}
		alert("\u7528\u6237\u540d\u6216\u5bc6\u7801\u4e0d\u6b63\u786e\uff01");
	}
}
function loadUserName() {
	try {
		var nameObj = document.getElementById("username");
		var remCheck = document.getElementById("remflag");
		var proxy = document.getElementById("iframeProxy_userinfo").contentWindow;
		if (proxy) {
			result = proxy.GetCookie("RemUserName");
			//alert(result);
			if (result != "") {
				nameObj.value = result;
				remCheck.checked = true;
			}
		} else {
			setTimeout("loadUserName()", 100);
		}
	}
	catch (e) {
		setTimeout("loadUserName()", 100);
	}
}

////////////////////滚动新闻JS
var TimeOut = 4000; //每张图切换时间 (单位毫秒);
var stopScroll = false;
var wordTitle = new Array();
var wordText = new Array();
var wordAlt = new Array();
var adNum = 0;
var theTimer;
var ScrollObj = function (newsNum) {
	for (var i = 0; i < newsNum; i++) {
		var titleObj = document.getElementById("scroll_title_" + i);
		var contentObj = document.getElementById("scroll_content_" + i);
		wordTitle[i + 1] = titleObj.innerHTML;
		wordText[i + 1] = contentObj.innerHTML;
		wordAlt[i + 1] = titleObj.innerHTML;
	}
};
function change() {
	window.clearInterval(theTimer);
	goMyScroll();
	nextAd();
	stopMyScroll();
}
function stopMyScroll() {
	stopScroll = true;
}
function goMyScroll() {
	stopScroll = false;
}
function nextAd() {
	if (stopScroll === false) {
		if (adNum < (wordTitle.length - 1)) {
			adNum++;
		} else {
			adNum = 1;
		}
		var writter = "<div class='scroll_c' onclick='javascript:change();' onmouseover='stopMyScroll()' onmouseout='goMyScroll()'><div class='scroll_title color_blue b'>" + wordTitle[adNum] + "</div>";
		writter = writter + "<div class='scroll_body'>" + wordText[adNum] + "</div></div>";
		document.getElementById("scroollBox").innerHTML = writter;
	}
	theTimer = setTimeout("nextAd()", TimeOut);
}

//////////common JS
var IE = "IE";
function getNavigator() {
	if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
		return IE;
	} else {
		if (window.navigator.userAgent.indexOf("Firefox") >= 1) {
			return MOZILLA;
		} else {
			return MOZILLA;
		}
	}
}
String.prototype.trim = function () {
	return this.replace(/(^\s*)|(\s*$)/g, "");
};
String.prototype.trimL = function () {
	return this.replace(/(^\s*)/g, "");
};
String.prototype.trimR = function () {
	return this.replace(/(\s*$)/g, "");
};
String.prototype.stripBlanks = function () {
	return this.replace(/\s/g, "");
};
String.prototype.lenB = function () {
	try {
		return this.match(/[^\x00-\xff]/g).length + this.length;
	}
	catch (e) {
		return this.length;
	}
};
String.prototype.contain = function (str) {
	return (this.indexOf(str) != -1) ? true : false;
};
function getRandom() {
	try {
		time = new Date();
		return time.getTime() + "" + Math.random();
	}
	catch (e) {
		now = new Date();
		return now.getTime();
	}
}
function getXMLReqest() {
	var xmlHttpReq;
	if (window.XMLHttpRequest) {
		xmlHttpReq = new XMLHttpRequest();
	} else {
		try {
			xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
			}
		}
	}
	return xmlHttpReq;
}
function doRequest(url, windowDiv, callbackAction, info) {
	var uuUrl;
//alert(url+windowDiv.innerText);    
	if (info) {
		if (info == " ") {
		} else {
			windowDiv.innerHTML = info;
		}
	} else {
		windowDiv.innerHTML = "<table id='' style='width:100%;height=100%;' >" + "<tr>" + "<td align='left' style='font-size:12px;padding-left:10px;padding-top:3px' valign='top' >  \u7cfb\u7edf\u52a0\u8f7d\u4e2d,\u8bf7\u7a0d\u5019....</td>" + "</tr>" + "</table>";
	}
	if (url.indexOf("?") >= 0) {
		uuUrl = url + "&" + getRandom() + "&xcharset=\u4e2d\u6587";
	} else {
		uuUrl = url + "?" + getRandom() + "&xcharset=\u4e2d\u6587";
	}
	try {
		var xmlHttpReq = getXMLReqest();
		xmlHttpReq.onreadystatechange = function () {
			if (xmlHttpReq.readyState == 4) {
				var x = xmlHttpReq.responseText;
				windowDiv.innerHTML = x;
				if (callbackAction) {
					var actionList = callbackAction.split(";");
					var len = actionList.length;
					if (len > 1) {
						for (m = 0; m < len; m++) {
							eval(actionList[m]);
						}
					} else {
						eval(callbackAction);
					}
				}
				xmlHttpReq = null;
				x = null;
				return;
			}
		};
		xmlHttpReq.open("GET", uuUrl, true);
		xmlHttpReq.send(null);
	}
	catch (e) {
		windowDiv.innerHTML = "<table id='' style='width:100%;height=100%;' >" + "<tr>" + "<td align='left' style='font-size:12px;padding-left:10px;padding-top:3px' valign='top' > \u8d85\u65f6,\u8bf7\u91cd\u8bd5\u6216\u5237\u65b0\u9875\u9762</td>" + "</tr>" + "</table>";
	}
}
function G(elementId) {
	return document.getElementById(elementId);
}

//***************** 系统变量 获取对象的绝对位置*************************************/
function CPos(x, y) {
	this.x = x;
	this.y = y;
}
function GetObjPos(ATarget) {
	var target = ATarget;
	var pos = new CPos(target.offsetLeft, target.offsetTop);
	target = target.parentElement;
	while (target) {
		pos.x += target.offsetLeft;
		pos.y += target.offsetTop;
		target = target.parentElement;
	}
	return pos;
}

//////////////小方块动态JS

var xm;
var ym;

/* ==== onmousemove event ==== */
document.onmousemove = function(e){
	if(window.event){
		e = window.event;
	}
	xm = (e.x || e.clientX);
	ym = (e.y || e.clientY);
}

/* ==== window resize ==== */
function resize() {
	if(diapo) {
		diapo.resize();
	}
}

onresize = resize;

/* ==== opacity ==== */
setOpacity = function(o, alpha){
	if(o.filters) {
		o.filters.alpha.opacity = alpha * 100;
	} else {
		o.style.opacity = alpha;
	}
}


////////////////////////////////////////////////////////////////////////////////////////////
/* ===== encapsulate script ==== */
diapo = {
	O : [],
	DC : 0,
	img : 0,
	txt : 0,
	N : 0,
	xm : 0,
	ym : 0,
	nx : 0,
	ny : 0,
	nw : 0,
	nh : 0,
	rs : 0,
	rsB : 0,
	zo : 0,
	tx_pos : 0,
	tx_var : 0,
	tx_target : 0,

	/////// script parameters ////////
	attraction : 2,
	acceleration : .9,
	dampening : .1,
	zoomOver : 1.15,
	//zoomClick : 6,
	transparency : .8,
	//font_size: 18,
	//////////////////////////////////

	/* ==== diapo resize ==== */
	resize : function(){
		//alert("in resize");
		with(this){
			nx = DC.offsetLeft;
			ny = DC.offsetTop;
			nw = DC.offsetWidth;
			nh = DC.offsetHeight;
			//txt.style.fontSize = Math.round(nh / font_size) + "px";
			if(Math.abs(rs-rsB)<100){
				for(var i=0; i<N; i++) {
					O[i].resize();
				}
			}
			
			rsB = rs;
		}
	},

	/* ==== create diapo ==== */
	CDiapo : function(o){
		/* ==== init variables ==== */
		this.o        = o;
		this.x_pos    = this.y_pos    = 0;
		this.x_origin = this.y_origin = 0;
		this.x_var    = this.y_var    = 0;
		this.x_target = this.y_target = 0;
		this.w_pos    = this.h_pos    = 0;
		this.w_origin = this.h_origin = 0;
		this.w_var    = this.h_var    = 0;
		this.w_target = this.h_target = 0;
		this.over     = false;
		this.click    = false;

		/* ==== create shadow ==== */
		this.spa = document.createElement("span");
		this.spa.className = "spaDC";
		diapo.DC.appendChild(this.spa);

		/* ==== create thumbnail image ==== */
		this.img = document.createElement("img");
		this.img.className = "imgDC";
		this.img.src = o.src;
		this.img.O = this;
		diapo.DC.appendChild(this.img);
		setOpacity(this.img, diapo.transparency);

		/* ==== mouse events ==== */
		this.img.onselectstart = new Function("return false;");
		this.img.ondrag = new Function("return false;");
		this.img.onmouseover = function(){
			diapo.tx_target=0;
			diapo.txt=this.O.o.alt;
			this.O.over=true;
			setOpacity(this,this.O.click?diapo.transparency:1);
		}
		this.img.onmouseout = function(){
			diapo.tx_target=-diapo.nw;
			this.O.over=false;
			setOpacity(this,diapo.transparency);
		}
		this.img.onclick = function() {
			if(!this.O.click){
				if(diapo.txt){
					window.open(diapo.txt, "_blank");
				}
				//if(diapo.zo && diapo.zo != this) diapo.zo.onclick();
				//this.O.click = true;
				//this.O.x_origin = (diapo.nw - (this.O.w_origin * diapo.zoomClick)) / 2;
				//this.O.y_origin = (diapo.nh - (this.O.h_origin * diapo.zoomClick)) / 2;
				//diapo.zo = this;
				//setOpacity(this,diapo.transparency);
			//} else {
			//	this.O.click = false;
			//	this.O.over = false;
			//	this.O.resize();
			//	diapo.zo = 0;
			}
		}

		/* ==== rearrange thumbnails based on "imgsrc" images position ==== */
		this.resize = function (){
			with (this) {
				x_origin = o.offsetLeft;
				y_origin = o.offsetTop;
				w_origin = o.offsetWidth;
				h_origin = o.offsetHeight;
			}
		}

		/* ==== animation function ==== */
		this.position = function (){
			with (this) {
				/* ==== set target position ==== */
				w_target = w_origin;
				h_target = h_origin;
				if(over){
					/* ==== mouse over ==== */
					w_target = w_origin * diapo.zoomOver;
					h_target = h_origin * diapo.zoomOver;
					//x_target = diapo.xm - w_pos / 2 - (diapo.xm - (x_origin + w_pos / 2)) / (diapo.attraction*(click?10:1));
					//y_target = diapo.ym - h_pos / 2 - (diapo.ym - (y_origin + h_pos / 2)) / (diapo.attraction*(click?10:1));
					
					x_target = (x_origin + w_origin / 2);
					y_target = (y_origin + h_origin / 2);
				} else {
					/* ==== mouse out ==== */
					x_target = (x_origin + w_origin / 2);
					y_target = (y_origin + h_origin / 2);
				}
				//if(click){
					/* ==== clicked ==== */
				//	w_target = w_origin * diapo.zoomClick;
				//	h_target = h_origin * diapo.zoomClick;
				//}

				/* ==== magic spring equations ==== */
				//x_pos += x_var = x_var * diapo.acceleration + (x_target - x_pos) * diapo.dampening;
				//y_pos += y_var = y_var * diapo.acceleration + (y_target - y_pos) * diapo.dampening;
				x_pos = x_var = x_target;
				y_pos = y_var = y_target;
				//w_pos += w_var = w_var * (diapo.acceleration * .5) + (w_target - w_pos) * (diapo.dampening * .5);
				//h_pos += h_var = h_var * (diapo.acceleration * .5) + (h_target - h_pos) * (diapo.dampening * .5);
				w_pos += w_var = w_var * (diapo.acceleration * .5) + (w_target - w_pos) * (diapo.dampening * 1);
				h_pos += h_var = h_var * (diapo.acceleration * .5) + (h_target - h_pos) * (diapo.dampening * 1);
				
				diapo.rs += (Math.abs(x_var) + Math.abs(y_var));

				/* ==== html animation ==== */
				with(img.style){
					left   = (Math.round(x_pos) * 1 - (Math.max(0, w_pos) / 2))  + "px";
					top    = (Math.round(y_pos) - (Math.max(0, h_pos) / 2)) + "px";
					width  = Math.round(Math.max(0, w_pos)) + "px";
					height = Math.round(Math.max(0, h_pos)) + "px";
					zIndex = Math.round(w_pos);
				}
				//with(spa.style){
				//	left   = Math.round(x_pos + w_pos * .05) + "px";
				//	top    = Math.round(y_pos + h_pos * .05) + "px";
				//	width  = Math.round(Math.max(0, w_pos * 1.001)) + "px";
				//	height = Math.round(Math.max(0, h_pos * 1.001)) + "px";
				//	zIndex = Math.round(w_pos);
				//}
			}
		}
	},

	/* ==== main loop ==== */
	run : function(){
		//alert("in run");
		diapo.xm = xm - diapo.nx;
		diapo.ym = ym - diapo.ny;
		/* ==== caption anim ==== */
		diapo.tx_var = diapo.tx_var * .9 + (diapo.tx_target - diapo.tx_pos) * 0.02;
		
		diapo.tx_pos += diapo.tx_var;
		//diapo.txt.style.left = Math.round(diapo.tx_pos) + "px";
		/* ==== images anim ==== */
		for(var i in diapo.O) diapo.O[i].position();
		/* ==== loop ==== */
		setTimeout("diapo.run();", 10);
	},

	/* ==== load images ==== */
	images_load : function(){
		//alert("in load");
		// ===== loop until all images are loaded =====
		var M = 0;
		for(var i=0; i<diapo.N; i++) {
			if(diapo.img[i].complete) {
				diapo.img[i].style.position = "relative";
				diapo.O[i].img.style.visibility = "visible";
				diapo.O[i].spa.style.visibility = "visible";
				M++;
			}
			resize();
		}
		if(M<diapo.N) setTimeout("diapo.images_load();", 128);
	},

	/* ==== init script ==== */
	init : function() {
		//alert("in init");
		diapo.DC = document.getElementById("smallsquare_child");
		diapo.img = diapo.DC.getElementsByTagName("img");
		//diapo.txt = document.getElementById("caption");
		diapo.N = diapo.img.length;
		for(i=0; i<diapo.N; i++){
			diapo.O.push(new diapo.CDiapo(diapo.img[i]));
		}
		diapo.resize();
		diapo.tx_pos = -diapo.nw;
		diapo.tx_target = -diapo.nw;
		diapo.images_load();
		diapo.run();
	}
}

/*这里开始时UrlEncode和UrlDecode函数*/ 
function UrlEncode(str){
 var i,c,ret="",strSpecial="!\"#$%&'()*+,/:;<=>?@[\]^`{|}~%";
 for(i=0;i<str.length;i++){
  if(str.charCodeAt(i)>=0x4e00){
   c=qswhU2GB[str.charCodeAt(i)-0x4e00];
   ret+="%"+c.slice(0,2)+"%"+c.slice(-2);
  }
  else{
   c=str.charAt(i);
   if(c==" ")
    ret+="+";
   else if(strSpecial.indexOf(c)!=-1)
    ret+="%"+str.charCodeAt(i).toString(16);
   else
    ret+=c;
  }
 }
 return ret;
}

function getSpell(str,sp){
 var i,c,t,ret="";
 if(sp==null)sp="";
 for(i=0;i<str.length;i++){
  if(str.charCodeAt(i)>=0x4e00){
   c=parseInt(qswhU2GB[str.charCodeAt(i)-0x4e00],16);
   if(c<55290){
    for(t=qswhSpell.length-1;t>0;t=t-2)if(qswhSpell[t]<=c)break;
    if(t>0)ret+=qswhSpell[t-1]+sp;
   }
  }
 }
 return ret.substr(0,ret.length-sp.length);
}
