	function linkTo(optVal, newWindow){
		if (newWindow == "") { newWindow = false; }
		if(optVal=="") return false;
		if (newWindow) {
			window.open(optVal); return false;
		}
		else {
			window.location=optVal;
		}
	}

	$(document).ready(function() {
	   //Product : Product selector
		if ($('#product-selector')) {			
			var links = new Array();
			$('#product-selector a').each(function(id, item){
				links.push(item);
			});
			if (links.length > 0) {
				var html = '<select>';
				html += '<option value="#">'+$('h4.product-selector-label').text()+'</option>';
				for (i = 0; i < links.length; i++) {
					html += '<option value="'+links[i].href+'">'+links[i].innerHTML+'</option>';
				}
				html += '</select>';
				$('#product-selector h4').remove();
				$('#product-selector a').remove();
				$('#product-selector').append(html);
			}
			$('#product-selector select').change(function() {
				linkTo($(this).val());
			});
		}

	   //Product datasheets
		if ($('#product-datasheets')) {			
			var links = new Array();
			$('#product-datasheets a').each(function(id, item){
				links.push(item);
			});
			if (links.length > 0) {
				var html = '<select>';
				html += '<option value="">'+$('h4.datasheets-label').text()+'</option>';
				for (i = 0; i < links.length; i++) {
					html += '<option value="'+links[i].href+'">'+links[i].innerHTML+'</option>';
				}
				html += '</select>';
				$('#product-datasheets a').remove();
				$('#product-datasheets').append(html);
			}
			$('#product-datasheets select').change(function() {
				linkTo($(this).val(), true);
			});
		}
	});
