var xmlhttp=false;
var xml;
var doc;
var str;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

//if(navigator.userAgent.indexOf("Firefox")>-1){
	//LoadDegrees();
//}

function LoadDegrees() {
xmlhttp.open("POST", "/WebServices/external/ELearnersWebService.asmx",true);
xmlhttp.setRequestHeader("SOAPAction", "http://elearners.com/GetEDULevel_ByCampaign");
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.onreadystatechange=function(){
    if (xmlhttp.readyState==4) 
    {
        xml = xmlhttp.responseText;
        var nodes = xml.split("<EduLevel>");
        var i=0;
        var index=1;
	
        for(i=0;i<nodes.length;i++)
        {
            if(nodes[i].indexOf("<Value>") > -1)
            {
                var nodeval = nodes[i].substr(nodes[i].indexOf("<Value>")+7, 1);
                var nodetext = nodes[i].substr(nodes[i].indexOf("<DisplayName>")+13, nodes[i].indexOf("</DisplayName>")-13);
                document.myform.eduLvl[index] = new Option(nodetext, nodeval);
                index++;
            }
        }
        
    }
}

str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
		"<soap12:Envelope " +
		"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
		"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
		"xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">" +
		"<soap12:Body>" +
		"<GetEDULevel_ByCampaign xmlns=\"http://elearners.com/\">" +
		"<RPCamp_GUID>" + document.myform.cid.value + "</RPCamp_GUID>" +
		"</GetEDULevel_ByCampaign>" +
		"</soap12:Body>" +
		"</soap12:Envelope>";
 xmlhttp.send(str);
}


function DegreeChanged() {
document.myform.industry.disabled=false;
document.myform.industry.selectedIndex=0;

var x;

for(x=document.myform.industry.length-1;x>0;x--)
{
	document.myform.industry[x] = null;
}

xmlhttp.open("POST", "/WebServices/external/ELearnersWebService.asmx",true);
xmlhttp.setRequestHeader("SOAPAction", "http://elearners.com/GetSubjects_SSOProfile");
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
        xml = xmlhttp.responseText;
        var nodes = xml.split("<Subject>");
        var i=0;
        var index=1;

        for(i=0;i<nodes.length;i++)
        {
            if(nodes[i].indexOf("<Value>") > -1)
            {
                var nodeval = nodes[i].substr(nodes[i].indexOf("<Value>")+7, nodes[i].indexOf("</Value>")-nodes[i].indexOf("<Value>")-7);
		
                var nodetext = nodes[i].substr(nodes[i].indexOf("<DisplayName>")+13, nodes[i].indexOf("</DisplayName>")-13);
                document.myform.industry[index] = new Option(nodetext, nodeval);
                index++;
            }
        }
    }
}


str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
		"<soap12:Envelope " +
		"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
		"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
		"xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">" +
		"<soap12:Body>" +
		"<GetSubjects_SSOProfile xmlns=\"http://elearners.com/\">" +
		"<Degree>" + document.myform.eduLvl[document.myform.eduLvl.selectedIndex].value + "</Degree>" +
		"<Category>"  + document.myform.optone.value + "</Category>" + 
		"<RPCamp_GUID>" + document.myform.cid.value + "</RPCamp_GUID>" +
		"</GetSubjects_SSOProfile>" +
		"</soap12:Body>" +
		"</soap12:Envelope>";
xmlhttp.send(str);
}


   function doClick()
   {
   	var industry = document.myform.industry.options[document.myform.industry.selectedIndex].value;
   	var eduLvl = document.myform.eduLvl.options[document.myform.eduLvl.selectedIndex].value;
    var CID = document.myform.cid.value;
    var PostUrl = document.myform.PostUrl.value;
    document.myform.action=PostUrl;
   	if (eduLvl == "-1")
   	{
   		alert("Please choose a Degree Level.");
   		return false;
   	}
   	
   	else if (industry == "-1"){
   		alert("Please choose a Subject.");
   		return false;
   	}
   	else
   	{
   	    document.myform.submit();
   	    return true;
   	}
   }