var browserSniff = navigator.userAgent;
if (browserSniff.indexOf("MSIE") != -1) {
	browserType = "ie";
	} else if (browserSniff.indexOf("Gecko") != -1) {
	browserType = "mozilla";
	} else if (browserSniff.indexOf("Opera") != -1) {
	browserType = "opera";
	} else {
	browserType = "notKnown";
}

function GetHelp() {
// Do nothing
}

// Select Code
function selectCode(happy) {
	happy.select();
}


function TWBGhelp(offsetPointer) {
	var y = 0;
	while (offsetPointer) {
		y += offsetPointer.offsetTop;
		offsetPointer = offsetPointer.offsetParent;
	}
     finalOffset = (browserType == "mozilla") ? y - 420 + "px" : y - 410 + "px";
    document.getElementById("TWhelpID").style.display = "block";
	document.getElementById("TWhelpID").style.top = finalOffset;
    document.getElementById("TWhelpID").style.left = "30px";
}

function TWBGcloseHelp() {
	document.getElementById("TWhelpID").style.display = "none";
}

function writeDLbttn() {
	helpSnippet = (browserType == "mozilla") ? "SAVE LINK AS..." : "SAVE TARGET AS...";
	document.write('<img class="DLbutton" src="../pics/download-background.jpg" title="RIGHT CLICK >> ' + helpSnippet + '">');
}


// Sets all full screenshot links to javascript:showScrnShot...
function twitterSet() {
	allLinks = document.getElementsByTagName("a"); // Get all links on page
    for (var i=0; i<allLinks.length; i++) { // Run loop through all links
       	// Is this a screenshot link?
		if (allLinks[i].href.indexOf("background") != -1 && allLinks[i].href.indexOf("screenshots_full") != -1)  {
        	imagePath = allLinks[i].href; // If yes, get value for href.
        	allLinks[i].href = "javascript:showScrnShot('" + imagePath + "')"; // Rewrite link as javascript:showScrnShot
        }
	}
}


/* CREATES NEW WINDOW AND THEN DISPLAYS IMAGE ON PAGE.
This forces the image (screenshot) to display full size overriiding browser feature to resize pics down to fit in browser window. */
function showScrnShot(imagePath) {
    var NewWindow = window.open('','','resizable,scrollbars,top=10,left=10');
    newContent = '<html><body>';
    newContent += '<img src="' + imagePath + '">';
    newContent += '</body></html>';
    NewWindow.document.write(newContent);
    NewWindow.document.close(); // Necessary for FF. Otherwise, page load progress bar sticks.
}
