// JavaScript Document

	var dropdownItems1=[];		// Offerings: Services
		var dropdownItems2=[];		// Offerings: Software
		var dropdownItems3=[];		// Industries
		var newsItems=[];           // News & Events items
		
		function onLoad(){
			document.getElementById("resourcesType").disabled=false;
			document.getElementById("topics").disabled=false;
			initializeScroller();
		}
		
		function dropdownItem(Link){
			this.Link= Link;	
			this.OrderKey = this.Link.substring(this.Link.indexOf('">')+2, this.Link.indexOf('</')).replace("&amp;","&");
    	}
    	function newsItem(Title,Link){
    		this.Title= Title;
    		this.Link= Link;
    	}
    	
    	var factItems=[];
    	function factItem(hp_fact_text){
			this.hp_fact_text = hp_fact_text;	
    	}
    	
		function findForm(){
	    	if (document.getElementById("resourcesType").options.length != 0){
				window.location = "/resources/Pages/filterResults.aspx?topic=" + document.forms[0].topics.options[document.forms[0].topics.selectedIndex].value + "&type=" + document.forms[0].resourcesType.options[document.forms[0].resourcesType.selectedIndex].value;
			}
		}
		
		//Disabled by Dhaval on SEO change
		/*function dropLink(flag){
			if(flag == 'o'){
				var theSelect = document.getElementById("offerings_list");
			}
			if(flag=="i"){
				var theSelect = document.getElementById("industries_list");
			}
			if(theSelect.selectedIndex != 0){
				window.location = theSelect.options[theSelect.selectedIndex].value;
			}			
		}*/
		
		function dropLink(flag)
		{
			if(flag == 'o'){
				window.location = document.getElementById("Offerings_List").value;
			}
			if(flag=='i'){
				window.location = document.getElementById("Industry_List").value;
			}
		}

		
		function updateCascade(){
			if(document.forms[0].topics.options[document.forms[0].topics.selectedIndex].value !="alltopics"){
				JQ.ajax({
					url: '/xml_files/Pages/default.aspx?t=' + document.forms[0].topics.options[document.forms[0].topics.selectedIndex].value,
    				type: 'GET',
    				dataType: 'html',
    				timeout: 5000,
    				error: function(){
        				//alert('Error loading cascading dropdown data.');
    				},
    				success: function(data){
        				var flagArray=data.split("||");
						var theSelect = document.getElementById("resourcesType");
						var i = 0;
						theSelect.options.length = 0;
						if(flagArray[1] == 1){
							theSelect.options[i] = new Option('Case Study','Case Study');
							i++;
						}
						if(flagArray[2] == 1){
							theSelect.options[i] = new Option('White Paper','White Paper');
							i++;
						}
						if(flagArray[0] == 1){
							theSelect.options[i] = new Option('Brochure','Brochure');
							i++;
						}
						if(flagArray[0] == 1){
							theSelect.options[i] = new Option('Media','Media');
							i++;
						}
						if(flagArray[0] == 1){
							theSelect.options[i] = new Option('Newsletter','Newsletter');
							i++;
						}
						if(flagArray[0] == 1){
							theSelect.options[i] = new Option('Podcast','Podcast');
							i++;
						}
						if(theSelect.options.length == 0){
							document.getElementById("findButton").style.display = "none";
							document.getElementById("resourcesType").style.display = "none";
							document.getElementById("typeHead").style.display = "none";
							document.getElementById("typeError").style.display = "block";
						}else{
							document.getElementById("typeError").style.display = "none";
							document.getElementById("typeHead").style.display = "block";
							document.getElementById("resourcesType").style.display = "block";
							document.getElementById("findButton").style.display = "block";
							
						}
					}
				});
			}else{
				var theSelect = document.getElementById("resourcesType");
				theSelect.options.length = 0;
				theSelect.options[0] = new Option('Case Study','Case Study');
				theSelect.options[1] = new Option('White Paper','White Paper');
				theSelect.options[2] = new Option('Brochure','Brochure');
				theSelect.options[3] = new Option('Media','Media');
				theSelect.options[4] = new Option('Newsletter','Newsletter');
				theSelect.options[5] = new Option('Podcast','Podcast');
			}
		}
