<!--
// Set interval to load the data 
   /** Delay between requests to the server when polling. */ 
var quoteDelay = 5000;
var req;
var req2;
var req3;
var req4;

function loadNextProblem(pid) {

}

function updateDetailStatus(vpid,vcid,status) {
	req3 = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req3 = new XMLHttpRequest();
        } catch(e) {
			req3 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req3 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req3 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req3 = false;
        	}
		}
    }
	if(req3) {		
		//index.php?name=Test&noheader=1&file=get_info&pid='+pid+'&type=problem&time=<?=time();?>
		url = "index.php?name=Test&noheader=1&file=update_status&cid="+vcid+"&status="+status+"&pid="+vpid;
		Stamp = new Date();
		url = url + "&time=" + Stamp.getYear() + Stamp.getMonth() + Stamp.getDate() + Stamp.getHours() + Stamp.getMinutes() + Stamp.getSeconds();
		req3.onreadystatechange = dataReqChange2;
		req3.open("GET", url, true);
		req3.send("");
	}
}

function loadXMLDoc(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {		
		Stamp = new Date();
		url = url + "?time=" + Stamp.getYear() + Stamp.getMonth() + Stamp.getDate() + Stamp.getHours() + Stamp.getMinutes() + Stamp.getSeconds();
		req.onreadystatechange = dataReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}

function loadXMLDoc2(url) {
	req2 = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req2 = new XMLHttpRequest();
        } catch(e) {
			req2 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req2 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req2 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req2 = false;
        	}
		}
    }
	if(req2) {		
		Stamp = new Date();
		url = url + "?time=" + Stamp.getYear() + Stamp.getMonth() + Stamp.getDate() + Stamp.getHours() + Stamp.getMinutes() + Stamp.getSeconds();
		req2.onreadystatechange = dataReqChange2;
		req2.open("GET", url, true);
		req2.send("");
	}
}

function flashObj(obj,content) {
	x = obj;
	c = content;
	x.innerHTML = "<table border='0' cellpadding='0' cellspacing='0' style='height:100%;width:100%;background-color:#FFF479;'><tr><td height='100%' width='100%'>&nbsp;</td></tr></table>";
//	setTimeout("x.innerHTML = c;",500);
}

function displayLoading() {
	document.getElementById("area_problem").innerHTML  = "<center>กำลังเรียกข้อมูล..<br>ถ้าไม่ขึ้น <a href='#' onclick='loadProblem(\""+pid+"\");'>กรุณาคลิกที่นี่</a></center>";
}

function dataReqChange() {
    // only if req shows "loaded"
	if (req.readyState == 4) {
        // only if "OK"			
        if (req.status == 200) {			
            // ...processing statements go here...
			debugXML(req.responseText);
			fetchData(req.responseText);
        } else {
            alert("There was a problem retrieving the XML data:\n" +  req.statusText);
        }
    }
}

function dataReqChange2() {
    // only if req shows "loaded"
	if (req2.readyState == 4) {
        // only if "OK"			
        if (req2.status == 200) {			
            // ...processing statements go here...
			debugXML(req2.responseText);
			fetchData2(req2.responseText);
        } else {
            alert("There was a problem retrieving the XML data:\n" +  req2.statusText);
        }
    }
}


function loadXMLDoc4(url) {
	req4 = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req4 = new XMLHttpRequest();
        } catch(e) {
			req4 = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req4 = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req4 = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req4 = false;
        	}
		}
    }
	if(req4) {		
		Stamp = new Date();
		url = url + "?time=" + Stamp.getYear() + Stamp.getMonth() + Stamp.getDate() + Stamp.getHours() + Stamp.getMinutes() + Stamp.getSeconds();
		req4.onreadystatechange = dataReqChange4;
		req4.open("GET", url, true);
		req4.send("");
	}
}


function dataReqChange4() {
    // only if req shows "loaded"
	if (req4.readyState == 4) {
        // only if "OK"			
        if (req4.status == 200) {			
            // ...processing statements go here...
			debugXML(req4.responseText);
			fetchData4(req4.responseText);
        } else {
            alert("There was a problem retrieving the XML data:\n" +  req4.statusText);
        }
    }
}


function debugXML(t) {
//	alert(t);
}	



//-->