function person_count(){
	send_person_model = document.getElementById('person_model').value;
	var xmlhttp;
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	var url;
	switch (parseInt(send_person_model)){
		case 1:
			url = _Web_Url + '/index.php/M_model/M_person/person1/'+new Date().getTime();  //模組1
			break;
		case 2:	
			url = _Web_Url + '/index.php/M_model/M_person/person2/'+new Date().getTime(); //模組2
			break;
	}			
	xmlhttp.open('GET',url,true);
	xmlhttp.onreadystatechange=function()
		{
		if (xmlhttp.readyState == 4){
				if (xmlhttp.status == 200) {	
					if (document.getElementById('person_totoal_count').value     !=  xmlhttp.responseText){
						loading_person_gif();
						document.getElementById('person_totoal_count').value    =  xmlhttp.responseText
						try {
						document.getElementById('show_person_count').innerHTML  = xmlhttp.responseText;
						} catch(err) {
						}		

					}
				}
			}
		};
	xmlhttp.send();
	return false;
}




function person_clock(){
	setTimeout("person_clock()",5000);
	person_count();
}


function load_person_counts(select_model){
	var bgObj   = document.createElement("div"); 
	bgObj.id    = "allPersonScript";
	document.body.appendChild(bgObj);  
	html_object = "<input id=\"person_model\" type=\"hidden\" value="+select_model+" />";
	html_object = html_object + "<input id=\"person_totoal_count\" type=\"hidden\" value=0 />";
	document.getElementById('allPersonScript').innerHTML = html_object;
	person_add_count();
	person_clock();
}


function person_add_count(){
	var xmlhttp;
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}else if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	var url;
	url = _Web_Url + '/index.php/M_model/M_person/add_count/'+new Date().getTime();
	xmlhttp.open('GET',url,true);
	xmlhttp.onreadystatechange=function()
		{
		if (xmlhttp.readyState == 4){
				if (xmlhttp.status == 200) {	
				}
			}
		};
	xmlhttp.send();
	return false;
}



function loading_person_gif(){
	try {
		document.getElementById('show_person_count').innerHTML    = "(update.....)";	
	} catch(err) {
	}		
}
