﻿// JavaScript Document
/*
author-wurong
mobile-18688884885
must define the colorfont and colorback
Ndiv means div 's name
sortID is the sort of the title you click
*/
function changeWin(Ttitle,Tcontent,Ndiv,sortID){
	
	//开始处理标题样式
	var allA = document.getElementById(Ttitle).getElementsByTagName("a");
	for (var i=0;i<allA.length;i++)
	{ 
		allA[i].style.color = colorfont;
		allA[i].style.background = colorback;
	}
	var thisobj = allA[sortID];
	thisobj.style.color = colorback;
	thisobj.style.background = colorfont;
	
	//下面处理内容窗
	var allContent = document.getElementById(Tcontent).getElementsByTagName("div");
	var startcount = 0;
	for (var i=0;i<allContent.length;i++)
	{
		if(allContent[i].name == Ndiv && startcount != sortID){
			allContent[i].style.display = 'none';
			startcount = startcount + 1;
		}
		else if(allContent[i].name == Ndiv && startcount == sortID){
			allContent[i].style.display = '';
			startcount = startcount + 1;
		}
	}
	var thisContent = allContent[sortID];
	thisContent.style.display = '';
}