summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/Presentation/Shared/scripts/samples.js
blob: f0c8527e6a11c3b994a14fafda3108b71feb5f65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

function closeMe()
{
	window.close();
}

function ChangeViewCodeIcon(key)
{
	var i;
	var imageElements = document.getElementsByName("vcImage");
	for(i=0; i<imageElements.length; ++i)
	{
		if(imageElements[i].parentElement == key)
		{
			if(imageElements[i].src == viewImage.src)
				imageElements[i].src = viewHoverImage.src;
			else
				imageElements[i].src = viewImage.src;
		}
	}
}

function ChangeDownloadCodeIcon(key)
{
	var i;
	var imageElements = document.getElementsByName("dcImage");
	for(i=0; i<imageElements.length; ++i)
	{
		if(imageElements[i].parentElement == key)
		{
			if(imageElements[i].src == downloadImage.src)
				imageElements[i].src = downloadHoverImage.src;
			else
				imageElements[i].src = downloadImage.src;
		}
	}
}

function ViewSampleSource(name)
{
	// variables
	var wConfig;
	var oSelectBox = document.all.item(name);
	var url;
	var sIndex;
	
	// Get the selectedIndex
	sIndex = oSelectBox.selectedIndex;
	
	if (sIndex >= 0)
	{
		// Get the URL to the file
		url = oSelectBox.options[sIndex].value;

		// Set the configuration
		wConfig += 'directories=0,';
		wConfig += 'location=0,';
		wConfig += 'menubar=0,';
		wConfig += 'resizable=1,';
		wConfig += 'scrollbars=1,';
		wConfig += 'status=0,';
		wConfig += 'toolbar=0';

		// Launch the window
		window.open(url, 'ViewSampleSource', wConfig);
	}
}