//Adds Class to use if Javascript is disabled
$(function($) {
	$('body').addClass('jsIsOn');
});

$(document).ready(function(){
	//Search Input Swap Value and validates with alert
	var search_input_id = $("#search_input");//Search Input Id
	var search_button_id = $("#search_button");//Search Submit Id
	var original_val = $(search_input_id).val();
	$(search_input_id).focus(function(){
		if ($(this).val(original_val)){
			$(this).val("");
		}
	});
	$(search_input_id).blur(function(){
		if ($(this).val() == ""){
			$(this).val(original_val);
		}
	});
	$(search_button_id).click(function (){
		if ($(search_input_id).val()==original_val){
			alert('Please use a word or phrase other than "' + original_val + '."');
			return false
		}
	});
	
	
	//Submit QDF
	$("#degree-finder").submit(function (){
	    var optOne = document.myform.optone.options[document.myform.optone.selectedIndex].value;
	   	var industry = document.myform.industry.options[document.myform.industry.selectedIndex].value.toLowerCase();
	   	var eduLvl = document.myform.eduLvl.options[document.myform.eduLvl.selectedIndex].value;	
		var originalAction = $("#degree-finder").attr("action");
		
	   	if (eduLvl == "-1"){
	   		alert("Please choose a Degree Level.");	
	   		return false;
	   	}
	   	else if (optOne == "-1"){
	   		alert("Please choose a Category.");
	   		return false;
	   	}
	   	else if (industry == "-1"){
	   		alert("Please choose a Subject.");
	   		return false;
	   	}
	   	else{
				
			if (eduLvl == '5') {
				location.href = originalAction + "/programs/" + industry.replace(/ /g, "-") + ".htm"
				return false;
			}
			else{
				switch (eduLvl){
				case "1":
					eduLvl = "associate";
					break;
				case "2":
					eduLvl = "bachelor";
					break;
				case "3":
					eduLvl = "master";
					break;
				case "4":
					eduLvl = "doctorate";
					break;
				}
				
				location.href = originalAction + "/online-degrees/" + eduLvl + "/" + industry.replace(/ /g, "-") + ".htm"
				return false;
			}
		
	   	    return true;
	   	}
	});
	
});


//Bubble Tip 1.0.5
; (function($) {
	var bindIndex = 0;
	$.fn.extend({
		bubbletip: function(tip, options) {
			// check to see if the tip is a descendant of 
			// a table.bubbletip element and therefore
			// has already been instantiated as a bubbletip
			if ($('table.bubbletip #' + $(tip).get(0).id).length > 0) {
				return this;
			}

			var _this, _tip, _options, _calc, _timeoutAnimate, _timeoutRefresh, _isActive, _isHiding, _wrapper, _bindIndex;
			// hack for IE6,IE7
			var _windowWidth, _windowHeight;

			_this = $(this);
			_tip = $(tip);
			_bindIndex = bindIndex++;  // for window.resize namespace binding
			_options = {
				positionAt: 'element', // element | body | mouse
				positionAtElement: _this,
				offsetTop: 0,
				offsetLeft: 0,
				deltaPosition: 30,
				deltaDirection: 'up', // direction: up | down | left | right
				animationDuration: 250,
				animationEasing: 'swing', // linear | swing
				bindShow: 'mouseover', // mouseover | focus | click | etc.
				bindHide: 'mouseout', // mouseout | blur | etc.
				delayShow: 0,
				delayHide: 3500,
				calculateOnShow: false
			};
			if (options) {
				_options = $.extend(_options, options);
			}
			// calculated values
			_calc = {
				top: 0,
				left: 0,
				delta: 0,
				mouseTop: 0,
				mouseLeft: 0,
				tipHeight: 0,
				bindShow: (_options.bindShow + ' ').replace(/ +/g, '.bubbletip' + _bindIndex),
				bindHide: (_options.bindHide + ' ').replace(/ +/g, '.bubbletip' + _bindIndex)
			};
			_timeoutAnimate = null;
			_timeoutRefresh = null;
			_isActive = false;
			_isHiding = false;

			// store the tip id for removeBubbletip
			if (!_this.data('bubbletip_tips')) {
				_this.data('bubbletip_tips', [[_tip.get(0).id, _bindIndex]]);
			} else {
				_this.data('bubbletip_tips', $.merge(_this.data('bubbletip_tips'), [[_tip.get(0).id, _bindIndex]]));
			}


			// validate _options
			if (!_options.positionAt.match(/^element|body|mouse$/i)) {
				_options.positionAt = 'element';
			}
			if (!_options.deltaDirection.match(/^up|down|left|right$/i)) {
				_options.deltaDirection = 'up';
			}

			// create the wrapper table element
			if (_options.deltaDirection.match(/^up$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td><table class="bt-bottom" cellspacing="0" cellpadding="0"><tr><th></th><td><div></div></td><th></th></tr></table></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^down$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td><table class="bt-top" cellspacing="0" cellpadding="0"><tr><th></th><td><div></div></td><th></th></tr></table></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^left$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left"></td><td class="bt-content"></td><td class="bt-right-tail"><div class="bt-right"></div><div class="bt-right-tail"></div><div class="bt-right"></div></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			} else if (_options.deltaDirection.match(/^right$/i)) {
				_wrapper = $('<table class="bubbletip" cellspacing="0" cellpadding="0"><tbody><tr><td class="bt-topleft"></td><td class="bt-top"></td><td class="bt-topright"></td></tr><tr><td class="bt-left-tail"><div class="bt-left"></div><div class="bt-left-tail"></div><div class="bt-left"></div></td><td class="bt-content"></td><td class="bt-right"></td></tr><tr><td class="bt-bottomleft"></td><td class="bt-bottom"></td><td class="bt-bottomright"></td></tr></tbody></table>');
			}

			// append the wrapper to the document body
			_wrapper.appendTo('body');

			// apply IE filters to _wrapper elements
			if ((/msie/.test(navigator.userAgent.toLowerCase())) && (!/opera/.test(navigator.userAgent.toLowerCase()))) {
				$('*', _wrapper).each(function() {
					var image = $(this).css('background-image');
					if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
						image = RegExp.$1;
						$(this).css({
							'backgroundImage': 'none',
							'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=' + ($(this).css('backgroundRepeat') == 'no-repeat' ? 'crop' : 'scale') + ', src=\'' + image + '\')'
						}).each(function() {
							var position = $(this).css('position');
							if (position != 'absolute' && position != 'relative')
								$(this).css('position', 'relative');
						});
					}
				});
			}

			// move the tip element into the content section of the wrapper
			$('.bt-content', _wrapper).append(_tip);
			// show the tip (in case it is hidden) so that we can calculate its dimensions
			_tip.show();
			// handle left|right delta
			if (_options.deltaDirection.match(/^left|right$/i)) {
				// tail is 40px, so divide height by two and subtract 20px;
				_calc.tipHeight = parseInt(_tip.height() / 2);
				// handle odd integer height
				if ((_tip.height() % 2) == 1) {
					_calc.tipHeight++;
				}
				_calc.tipHeight = (_calc.tipHeight < 20) ? 1 : _calc.tipHeight - 20;
				if (_options.deltaDirection.match(/^left$/i)) {
					$('div.bt-right', _wrapper).css('height', _calc.tipHeight + 'px');
				} else {
					$('div.bt-left', _wrapper).css('height', _calc.tipHeight + 'px');
				}
			}
			// set the opacity of the wrapper to 0
			_wrapper.css('opacity', 0);
			// execute initial calculations
			_Calculate();
			_wrapper.hide();

			// handle window.resize
			$(window).bind('resize.bubbletip' + _bindIndex, function() {
				var w = $(window).width();
				var h = $(window).height();

				if ((w === _windowWidth) && (h === _windowHeight)) {
					return;
				}
				_windowWidth = w;
				_windowHeight = h;

				if (_timeoutRefresh) {
					clearTimeout(_timeoutRefresh);
				}

				_timeoutRefresh = setTimeout(function() {
					_Calculate();
				}, 250);
			});

			// handle mouseover and mouseout events
			$([_wrapper.get(0), this.get(0)]).bind(_calc.bindShow, function(e) {
				if (_timeoutAnimate) {
					clearTimeout(_timeoutAnimate);
				}
				_timeoutAnimate = setTimeout(function() {
					if (_isActive) {
						return;
					}
					_isActive = true;
					if (_isHiding) {
						_wrapper.stop(true, false);
					}

					var animation;

					if (_options.calculateOnShow) {
						_Calculate();
					}
					if (_options.positionAt.match(/^element|body$/i)) {
						if (_options.deltaDirection.match(/^up|down$/i)) {
							if (!_isHiding) {
								_wrapper.css('top', parseInt(_calc.top + _calc.delta) + 'px');
							}
							animation = { 'top': _calc.top + 'px' };
						} else {
							if (!_isHiding) {
								_wrapper.css('left', parseInt(_calc.left + _calc.delta) + 'px');
							}
							animation = { 'left': _calc.left + 'px' };
						}
					} else {
						if (_options.deltaDirection.match(/^up|down$/i)) {
							if (!_isHiding) {
								_calc.mouseTop = e.pageY + _calc.top;
								_wrapper.css({ 'top': parseInt(_calc.mouseTop + _calc.delta) + 'px', 'left': parseInt(e.pageX - (_wrapper.width() / 2)) + 'px' });
							}
							animation = { 'top': _calc.mouseTop + 'px' };
						} else {
							if (!_isHiding) {
								_calc.mouseLeft = e.pageX + _calc.left;
								_wrapper.css({ 'left': parseInt(_calc.mouseLeft + _calc.delta) + 'px', 'top': parseInt(e.pageY - (_wrapper.height() / 2)) + 'px' });
							}
							animation = { 'left': _calc.left + 'px' };
						}
					}
					_isHiding = false;
					_wrapper.show();
					animation = $.extend(animation, { 'opacity': 1 });
					_wrapper.animate(animation, _options.animationDuration, _options.animationEasing, function() {
						_wrapper.css('opacity', '');
						_isActive = true;
					});
				}, _options.delayShow);

				return false;
			}).bind(_calc.bindHide, function(e) {
				if (_timeoutAnimate) {
					clearTimeout(_timeoutAnimate);
				}
				_timeoutAnimate = setTimeout(function() {
					var animation;

					_isActive = false;
					_isHiding = true;
					if (_options.positionAt.match(/^element|body$/i)) {
						if (_options.deltaDirection.match(/^up|down$/i)) {
							animation = { 'top': parseInt(_calc.top - _calc.delta) + 'px' };
						} else {
							animation = { 'left': parseInt(_calc.left - _calc.delta) + 'px' };
						}
					} else {
						if (_options.deltaDirection.match(/^up|down$/i)) {
							animation = { 'top': parseInt(_calc.mouseTop - _calc.delta) + 'px' };
						} else {
							animation = { 'left': parseInt(_calc.mouseLeft - _calc.delta) + 'px' };
						}
					}
					animation = $.extend(animation, { 'opacity': 0 });
					_wrapper.animate(animation, _options.animationDuration, _options.animationEasing, function() {
						_wrapper.hide();
						_isHiding = false;
					});

				}, _options.delayHide);

				return false;
			});

			function _Calculate() {
				// calculate values
				if (_options.positionAt.match(/^element$/i)) {
					var offset = _options.positionAtElement.offset();
					if (_options.deltaDirection.match(/^up$/i)) {
						_calc.top = offset.top + _options.offsetTop - _wrapper.height();
						_calc.left = offset.left + _options.offsetLeft + ((_options.positionAtElement.width() - _wrapper.width()) / 2);
						_calc.delta = _options.deltaPosition;
					} else if (_options.deltaDirection.match(/^down$/i)) {
						_calc.top = offset.top + _options.positionAtElement.height() + _options.offsetTop;
						_calc.left = offset.left + _options.offsetLeft + ((_options.positionAtElement.width() - _wrapper.width()) / 2);
						_calc.delta = -_options.deltaPosition;
					} else if (_options.deltaDirection.match(/^left$/i)) {
						_calc.top = offset.top + _options.offsetTop + ((_options.positionAtElement.height() - _wrapper.height()) / 2);
						_calc.left = offset.left + _options.offsetLeft - _wrapper.width();
						_calc.delta = _options.deltaPosition;
					} else if (_options.deltaDirection.match(/^right$/i)) {
						_calc.top = offset.top + _options.offsetTop + ((_options.positionAtElement.height() - _wrapper.height()) / 2);
						_calc.left = offset.left + _options.positionAtElement.width() + _options.offsetLeft;
						_calc.delta = -_options.deltaPosition;
					}
				} else if (_options.positionAt.match(/^body$/i)) {
					if (_options.deltaDirection.match(/^up|left$/i)) {
						_calc.top = _options.offsetTop;
						_calc.left = _options.offsetLeft;
						// up or left
						_calc.delta = _options.deltaPosition;
					} else {
						if (_options.deltaDirection.match(/^down$/i)) {
							_calc.top = parseInt(_options.offsetTop + _wrapper.height());
							_calc.left = _options.offsetLeft;
						} else {
							_calc.top = _options.offsetTop;
							_calc.left = parseInt(_options.offsetLeft + _wrapper.width());
						}
						// down or right
						_calc.delta = -_options.deltaPosition;
					}
				} else if (_options.positionAt.match(/^mouse$/i)) {
					if (_options.deltaDirection.match(/^up|left$/i)) {
						if (_options.deltaDirection.match(/^up$/i)) {
							_calc.top = -(_options.offsetTop + _wrapper.height());
							_calc.left = _options.offsetLeft;
						} else if (_options.deltaDirection.match(/^left$/i)) {
							_calc.top = _options.offsetTop;
							_calc.left = -(_options.offsetLeft + _wrapper.width());
						}
						// up or left
						_calc.delta = _options.deltaPosition;
					} else {
						_calc.top = _options.offsetTop;
						_calc.left = _options.offsetLeft;
						// down or right
						_calc.delta = -_options.deltaPosition;
					}
				}
				// handle the wrapper (element|body) positioning
				if (_options.positionAt.match(/^element|body$/i)) {
					_wrapper.css({
						'position': 'absolute',
						'top': _calc.top + 'px',
						'left': _calc.left + 'px'
					});
				}
			};
			return this;
		},
		removeBubbletip: function(tips) {
			var tipsActive;
			var tipsToRemove = new Array();
			var tipsActiveAdjusted = new Array();
			var arr, i, ix;
			var elem;

			tipsActive = $.makeArray($(this).data('bubbletip_tips'));

			// convert the parameter array of tip id's or elements to id's
			arr = $.makeArray(tips);
			for (i = 0; i < arr.length; i++) {
				tipsToRemove.push($(arr[i]).get(0).id);
			}

			for (i = 0; i < tipsActive.length; i++) {
				ix = null;
				if ((tipsToRemove.length == 0) || ((ix = $.inArray(tipsActive[i][0], tipsToRemove)) >= 0)) {
					// remove all tips if there are none specified
					// otherwise, remove only specified tips

					// find the surrounding table.bubbletip
					elem = $('#' + tipsActive[i][0]).get(0).parentNode;
					while (elem.tagName.toLowerCase() != 'table') {
						elem = elem.parentNode;
					}
					// attach the tip element to body and hide
					$('#' + tipsActive[i][0]).appendTo('body').hide();
					// remove the surrounding table.bubbletip
					$(elem).remove();

					// unbind show/hide events
					$(this).unbind('.bubbletip' + tipsActive[i][1]);

					// unbind window.resize event
					$(window).unbind('.bubbletip' + tipsActive[i][1]);
				} else {
					// tip is not being removed, so add it to the adjusted array
					tipsActiveAdjusted.push(tipsActive[i]);
				}
			}
			$(this).data('bubbletip_tips', tipsActiveAdjusted);

			return this;
		}
	});
})(jQuery);

//Configures Bubble Tip for inline QDF pop-up
$(document).ready(function() {
	var qdfHtml = $("#qdf-div").html();
	$.each($('.qdf-pop'), function(i, val){
		$(this).addClass( "qdf-pop"+i );
		$("#moreQdfs").html($("#moreQdfs").html() + '<div id="qdf-div-' + i + '" style="display:none;">' + qdfHtml + '</div>');
		$('.qdf-pop'+i).bubbletip($('#qdf-div-'+i));
	});
	$('.close-QDF').click(function() {
		$('.bubbletip').fadeOut(500);
		return false;
	});
});


//Comments
var Comments = new Object();
Comments.statusMessage = function(text, alertOnNull){
    var result = $('#comment_status');
    if(result != null){
        result.show();
        result.html(text);
		$(".comment_status_container").show(300)
    }
    else if(alertOnNull){
        alert(text);
    }
    if(typeof decrementComments == 'function')
        decrementComments();
}

//Add New Comment
Comments.submitComment = function(url){
    Comments.statusMessage('Sending... please wait',true);
    $.ajax({
        type: "POST",
        url: url + '?command=newComment',
        data: $("#comment_form").serialize(),
        success: function(transport) {
            var response = transport || "no response text";
            Comments.statusMessage(response, true);
            $('#comment').value = '';
			
			//Status Message
			if($('#comment_status').text()==='Your comment has been received and will be published shortly. Thanks!') {
				$('#comment_form_container').slideUp();
				$(".comment_status_container").addClass("Comment_thank_you");
			}
        },
        error: function() {
            Comments.statusMessage('Something went wrong. The comment was likely not saved.', true);
        }
    });
}




//QDF Web Service
function Querystring(qs) { 
	this.params = new Object();
	this.get=Querystring_get;
	if (qs == null)	qs=location.search.substring(1,location.search.length);
	qs=qs.toLowerCase();
	if (qs.length == 0) return;
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=');
		var name = unescape(pair[0]);
		if (pair.length == 2)
		{
			value = unescape(pair[1]);
		}
		else
		{
			value = name;
		}	
		this.params[name] = value;
	}
}
function Querystring_get(key, default_) {
	if (default_ == null) default_ = null;
	var value=this.params[key];
	if (value==null) value=default_;
	return value;
}

var qs = new Querystring();
var DefEduLvl;
var DefCategory;
var DefSubject;
var ExecuteNextStep=false;
SetQSValues();

function SetQSValues(){
    DefEduLvl=qs.get("edulvl","-1");
    DefCategory=qs.get("category","-1");   
    DefSubject=qs.get("subject","-1");        
}

function IsAsyncEduLvlCall(){
    return true;
//    return DefEduLvl=="-1";
}

function IsAsyncCategoryCall(){
    return true;
//    return DefCategory=="-1";
}

//var xmlhttp=null;
var xml;
var doc;
var str;

function SetXMLHttp(){
    var xmlhttp=null;
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	    try {
		    xmlhttp = new XMLHttpRequest();
	    } catch (e) {
		    xmlhttp=false;
	    }
    }
    if (!xmlhttp && window.ActiveXObject) {
	    try {
		    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (e) {
		    xmlhttp=false;
	    }
    }
    return xmlhttp;
}

function PopulateDegreeLevel(result){

    ExecuteNextStep=false;
    xml = result;
    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);
            if (nodeval==DefEduLvl)
            { 
                document.myform.eduLvl.selectedIndex = index;                
                ExecuteNextStep=true;
            }
            index++;
        }
    }
    if (ExecuteNextStep) DegreeChanged();

}

function PopulateCategory(result){

    ExecuteNextStep=false;
    xml = result;
    var nodes = xml.split("<Category>");
    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);
           	
            if(nodetext.indexOf("&amp;") > -1) 
            {
                nodetext = nodetext.substr(0, nodetext.indexOf("&amp;")) + "&" + nodetext.substr(nodetext.indexOf("&amp;")+5)
            }
            document.myform.optone[index] = new Option(nodetext, nodeval);
            if (nodeval.toUpperCase()==DefCategory.toUpperCase())
            { 
                document.myform.optone.selectedIndex = index;
                ExecuteNextStep=true;
            }
            index++;
        }
    }
    if (ExecuteNextStep) CategoryChanged();

}

function PopulateSubjects(result){

    xml = result;
    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);
            if (nodeval.toUpperCase()==DefSubject.toUpperCase())
            { 
                document.myform.industry.selectedIndex = index;                
            }                
            index++;
        }
    }

}
/*
function LoadDegrees(){
    var dtmNow = new Date();
    var strMS = dtmNow.valueOf();
    
    SetQSValues();
    xmlhttp=SetXMLHttp();
    xmlhttp.open("POST", "/WebServices/external/ELearnersWebService.asmx?time=" + strMS,IsAsyncEduLvlCall());
    xmlhttp.setRequestHeader("SOAPAction", "http://elearners.com/GetEDULevel_ByCampaign");
    xmlhttp.setRequestHeader("Content-Type", "text/xml");
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4) 
        {
            PopulateDegreeLevel(xmlhttp.responseText);
        }
    }

    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() {
    SetQSValues();
    xmlhttp=SetXMLHttp();
    document.myform.optone.disabled=false;
    document.myform.industry.disabled=true;
    document.myform.industry.selectedIndex=0;
    var x;
    for(x=document.myform.optone.length-1;x>0;x--)
    {
	    document.myform.optone[x] = null;
    }
    xmlhttp.open("POST", "/WebServices/external/ELearnersWebService.asmx",IsAsyncCategoryCall());
    xmlhttp.setRequestHeader("SOAPAction", "http://elearners.com/GetCategories_SSOProfile");
    xmlhttp.setRequestHeader("Content-Type", "text/xml");
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4) 
        {
            PopulateCategory(xmlhttp.responseText);
        }
    }
    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>" +
		    "<GetCategories_SSOProfile xmlns=\"http://elearners.com/\">" +
		    "<Degree>" + document.myform.eduLvl[document.myform.eduLvl.selectedIndex].value + "</Degree>" +
		    "<RPCamp_GUID>" + document.myform.cid.value + "</RPCamp_GUID>" +
		    "</GetCategories_SSOProfile>" +
		    "</soap12:Body>" +
		    "</soap12:Envelope>";
    xmlhttp.send(str);
}

function CategoryChanged() {
    SetQSValues();
    xmlhttp=SetXMLHttp();
    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",IsAsyncCategoryCall());
    xmlhttp.setRequestHeader("SOAPAction", "http://elearners.com/GetSubjects_SSOProfile");
    xmlhttp.setRequestHeader("Content-Type", "text/xml");
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4) 
        {
            PopulateSubjects(xmlhttp.responseText);
        }
    }
    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[document.myform.optone.selectedIndex].value + "</Category>" + 
		    "<RPCamp_GUID>" + document.myform.cid.value + "</RPCamp_GUID>" +
		    "</GetSubjects_SSOProfile>" +
		    "</soap12:Body>" +
		    "</soap12:Envelope>";
    xmlhttp.send(str);
}

