﻿//Input type class inserter.
window.onload = function() { 
    var coll = document.getElementsByTagName('input'); 
    for(var i=0; i<coll.length; i++) { 
        if(coll[i].type) { 
            coll[i].className += ' ' + coll[i].type + ' '; 
        } 
    } 
}



// Contains General Java Script Functions for Venue Wise Pages.
function EditorAttachTo(controlId) { WYSIWYG.setSettings(controlId); WYSIWYG_Core.includeCSS(WYSIWYG.config[controlId].CSSFile);WYSIWYG._generate(controlId); return false; } 
function EditorLoadValue(controlId, value){ return false; }

function ShowViewStateSize() { var buf = document.forms[0]["__VIEWSTATE"].value; alert("View state is " + buf.length + " bytes"); }

//The follwing two functions ensures that only one node in treeView with checkboxes can be selected.
function client_OnTreeNodeChecked_AllowOnlySingleCheck(event) { var TreeNode = event.srcElement || event.target ; if (TreeNode.tagName == "INPUT" && TreeNode.type == "checkbox") { if(TreeNode.checked){ client_OnTreeNodeChecked_AllowOnlySingleCheck_UnCheckOther(TreeNode.id); } } }

function client_OnTreeNodeChecked_AllowOnlySingleCheck_UnCheckOther(id) { var elements = document.getElementsByTagName('input'); /* loop through all input elements in form */ for(var i = 0; i < elements.length; i++){ if(elements.item(i).type == "checkbox"){ if(elements.item(i).id!=id){ elements.item(i).checked=false; } } } }

//Function displays a FileDownload PopUpDialog.
function AttemptFileDownloadDialog(title, extention, date, size, mime,url) { $("<div title=\"File Download\">" + "<table>" + "<tr><th>Title:</th><td>"+title+"</td></tr>"+ "<tr><th>File extention:</th><td>"+extention+"</td></tr>"+ "<tr><th>Upload date:</th><td>"+date+"</td></tr>"+ "<tr><th>Size:</th><td>"+size+"</td></tr>"+ "<tr><th>Mime type:</th><td>"+mime+"</td></tr>"+ "</table>" + "</div>").dialog({modal: true,  buttons: { "Cancel": function() { $(this).dialog("close"); },"Start download": function() { window.open(url, "_blank"); $(this).dialog("close"); } }});return false;}
