﻿var xmlHttpCourseList;

function CertificationList()
{    
    xmlHttpCourseList=GetXmlHttpObject()
    if (xmlHttpCourseList==null)
    {
	    alert ("Browser does not support HTTP Request")
	    return
    } 
    var url = "ajCertificationList.aspx?type=0" + "&sid="+Math.random();
    //alert(url);
	
    xmlHttpCourseList.onreadystatechange=function getSearch()
    {
	    if (xmlHttpCourseList.readyState==4 || xmlHttpCourseList.readyState=="complete")
	    {
		    if (Trim(xmlHttpCourseList.responseText)!="")
		    {
		        document.getElementById('spCertificationList').innerHTML = xmlHttpCourseList.responseText;
		    }
	    }
    };
    xmlHttpCourseList.open("GET",url,true);
    xmlHttpCourseList.send("");
}

function GetXmlHttpObject()
{
	var objXMLHttp=null
	if (window.XMLHttpRequest)objXMLHttp=new XMLHttpRequest()
	else if (window.ActiveXObject)	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	return objXMLHttp
}

function CertificationListId()
{    
    var ddlcourse = document.getElementById('ddlCourseTitle');
    var cid = ddlcourse.options[ddlcourse.selectedIndex].value;
    
    var ddlsubj = document.getElementById('ddlSubjectArea');
    ddlsubj.options[0].selected = true;
    
    xmlHttpCourseList=GetXmlHttpObject()
    if (xmlHttpCourseList==null)
    {
	    alert ("Browser does not support HTTP Request")
	    return
    } 
    var url = "ajCertificationList.aspx?type=1&courseid=" + cid + "&sid="+Math.random();
    //alert(url);
	
    xmlHttpCourseList.onreadystatechange=function getSearch()
    {
	    if (xmlHttpCourseList.readyState==4 || xmlHttpCourseList.readyState=="complete")
	    {
		    if (Trim(xmlHttpCourseList.responseText)!="")
		    {
		        document.getElementById('spCertificationList').innerHTML = xmlHttpCourseList.responseText;
		    }
	    }
    };
    xmlHttpCourseList.open("GET",url,true);
    xmlHttpCourseList.send("");
}


function CertificationListSubject()
{    

    var ddlsubj = document.getElementById('ddlSubjectArea');
    var id = ddlsubj.options[ddlsubj.selectedIndex].value;
    
    var ddlcourse = document.getElementById('ddlCourseTitle');
    ddlcourse.options[0].selected = true;
    
    xmlHttpCourseList=GetXmlHttpObject()
    if (xmlHttpCourseList==null)
    {
	    alert ("Browser does not support HTTP Request")
	    return
    } 
    var url = "ajCertificationList.aspx?type=3&sjid=" + id + "&sid="+Math.random();
    //alert(url);
	
    xmlHttpCourseList.onreadystatechange=function getSearch()
    {
	    if (xmlHttpCourseList.readyState==4 || xmlHttpCourseList.readyState=="complete")
	    {
		    if (Trim(xmlHttpCourseList.responseText)!="")
		    {
		        document.getElementById('spCertificationList').innerHTML = xmlHttpCourseList.responseText;
		    }
	    }
    };
    xmlHttpCourseList.open("GET",url,true);
    xmlHttpCourseList.send("");
}

function CertificationListCityState()
{    
    var ddlcity = document.getElementById('ddlCity');
    var ddlstate = document.getElementById('ddlState');
    var city = ddlcity.options[ddlcity.selectedIndex].value;
    var state = ddlstate.options[ddlstate.selectedIndex].value;
    
    xmlHttpCourseList=GetXmlHttpObject()
    if (xmlHttpCourseList==null)
    {
	    alert ("Browser does not support HTTP Request")
	    return
    } 
    var url = "ajCertificationList.aspx?type=2&city=" + city + "&state=" + state + "&sid="+Math.random();
    //alert(url);
	
    xmlHttpCourseList.onreadystatechange=function getSearch()
    {
	    if (xmlHttpCourseList.readyState==4 || xmlHttpCourseList.readyState=="complete")
	    {
		    if (Trim(xmlHttpCourseList.responseText)!="")
		    {
		        document.getElementById('spCertificationList').innerHTML = xmlHttpCourseList.responseText;
		    }
	    }
    };
    xmlHttpCourseList.open("GET",url,true);
    xmlHttpCourseList.send("");
}