
///<summary>
/// copy the code block immediately below the copyCode hyperlink
/// <param name="copyLink">copyLink is the id or the object to the current copy hyperlink</param>
///</summary>
function copy(element) {
    var code = element;

    if (typeof(code) == "string") {
        code = document.getElementById(code);
    }

    if (code.createTextRange) {
        var range = code.createTextRange();
        alert(range.value);
        if (range && BodyLoaded==1) {
            range.execCommand('Copy');
        }
    }
    
    alert('code copied');
}

///<summary>
///toggle between the different code output
///</summary>
function toggleCodeBlock(codeBlockId, activeCodeClass) {
	var codeBlock = $("#" + codeBlockId);
	
	codeBlock.children().each(function() {
		$(this).hide();
		});
		
	codeBlock.children("." + activeCodeClass).each(function() {
		$(this).show();
		});
}

function showPopup(popupId) {
	var popup = $("#" + popupId);
	
	popup.toggle();
}

function closePopup(popupId) {
	var popup = $("#" + popupId);
	
	popup.toggle();
}

function openWindow(uri, width, height) {
	window.open(uri, null, "height=" + height + ", width=" + width + ", resizable=yes, status=no, toolbar=no, menubar=no, location=no");
}