﻿// JScript File

var newWindow; 

function OpenCalendar(idname, postBack)
{
    //alert(idname);
	newWindow = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'calendar', 
		'width=170,height=270,left=250,top=200');
}
function OpenUpload(idname, idname2, filepath, filetypes, filesize, prefix)
{
	newWindow = window.open('Upload.aspx?id=' + idname + '&id2=' + idname2 + '&filepath=' + filepath + '&filetypes=' + filetypes + '&filesize=' + filesize + '&prefix=' + prefix,
	    'upload',
		'resizable=yes,width=650,height=350,left=250,top=200');
}
function OpenViewFile(filepath)
{   
	newWindow = window.open('DisplayUpload.aspx?filepath=' + filepath,
	    'view',
		'scrollbars=yes,resizable=yes,width=700,height=550,left=20,top=20');
}
function OpenPDFFile(filepath)
{   
	newWindow = window.open('DisplayPDF.aspx?filepath=' + filepath,
	    'view',
		'scrollbars=yes,resizable=yes,width=700,height=550,left=20,top=20');
}
function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	newWindow.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}

function getElementsByClassName(oElm, strTagName, strClassName, toStrClassName) {
    var arrElements = (strTagName == "*" && document.all) ? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for (var i = 0; i < arrElements.length; i++) {
        oElement = arrElements[i];
        //alert(oElement.getAttribute("class")); 
        if (oRegExp.test(oElement.getAttribute("class"))) {
            arrReturnElements.push(oElement);
        }
    }
    for (var i = 0; i < arrReturnElements.length; i++) {
        oElement = arrReturnElements[i];
        oElement.setAttribute("class", toStrClassName);
    }

    return false;
}

	
