﻿function ajax(url,para,method,divId)
{
    //document.getElementById(divId).innerHTML='<div style="width:100%; text-align:center"><img src="/images/loading.gif"/></div>'
    document.getElementById(divId).innerHTML='<img src="/images/loading.gif" style="width:20px;height:20px;"/>'
	var XHR=false;
	function XmlHttp(){
		if(window.XMLHttpRequest){
			XHR=new XMLHttpRequest(); 
		}else{
			try{
				XHR=new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					XHR=new ActiveXObject("Microsoft.XMLHTTP ");
				}catch(e){
					return false;
				}
			}
		}
		if (XHR!=null) {
			return true;
		}else{
			XHR.setRequestHeader("Content-Type","text/xml");
			XHR.setRequestHeader("Content-Type","gb2312");
		}
	}

	XmlHttp();
	if(XmlHttp){
	    if(method=='post'){
		    XHR.open(method,url,true);
		    XHR.onreadystatechange=ReadyState;
		    XHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		    XHR.send(para);	        
	    }else{
	    	XHR.open(method,url+'?'+para,true);
		    XHR.onreadystatechange=ReadyState;
		    XHR.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		    XHR.send();	
	    }
	}
	
	function ReadyState()
	{

		if(XHR.readyState==4 && XHR.status==200){
		    document.getElementById(divId).innerHTML=XHR.responseText
		}
	}         
}


function changeitem(index,total,cur){
    for(var i=0;i<total;i++){
        document.getElementById('t'+index+'_'+i).className='t'+index;
        document.getElementById('c'+index+'_'+i).className='c'+index;
    }
    document.getElementById('t'+index+'_'+cur).className='t'+index+'_';
    document.getElementById('c'+index+'_'+cur).className='c'+index+'_';
}


