﻿function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
}

function AjaxRequest(url, data, callback)
{
	var async = typeof(callback) == "function";

	if(async) xmlHttp.onreadystatechange = callback;
	xmlHttp.open("GET", url, async);
	xmlHttp.send(data);
}



function changeTb(_id,target,count,tagid){
    var ele = $(target);
	for(i=1;i<=count;i++){
		var curr = $(target+"_li_"+i);		
		if(_id == i){
			curr.className = "case_curr";
		}
		else{
			curr.className = "case_cancelcurr";
		}
	}
	createXMLHttpRequest();
	AjaxRequest("/Include/Ajax.aspx?action=caselist&p="+_id+"&aaa="+new Date().getTime(),null,null);
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			ele.innerHTML = xmlHttp.responseText;
		}
	}
}

function GetPic(id){
    var result;
	createXMLHttpRequest();
	AjaxRequest("/CustomerCase/show_pic.aspx?isajax=1&Id="+id +"&aaa="+new Date().getTime(),null,null);
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			result = xmlHttp.responseText;
		}
	}
	//setTimeout(,3000);
	return result;
}

function ChildNav1(id){
    var result;
	createXMLHttpRequest();
	AjaxRequest("/Include/Ajax.aspx?action=nav&id="+id+"&aaa="+new Date().getTime(),null,null);
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			result = xmlHttp.responseText;
		}
	}
	if(result == ""){
	    $("nav_child").style.display = "none";
	}
	else{
	    $("nav_child").style.display = "block";
	    $("nav_child").innerHTML = result;
	}
}