﻿//
function is_ie() {
    if(navigator.appName == "Microsoft Internet Explorer")
        return true;
    return false;
}

//
function is_ns() {
    if(navigator.appName == "Netscape")
        return true;
    return false;
}


//
function is_webtv() {
    if(navigator.appName == "WebTV")
        return true;
    return false;
}

function openWindow(url, width, height ) {

    var left = ( screen.availWidth / 2 ) - ( width / 2 );
    var top = ( screen.availHeight / 2 ) - ( height / 2 );
    var config = "top=" + top + ",left=" + left + ",width="+ width +",height="+ height +",menubar=no,location=no,toolbar=no,resizable=no,scrollbars=auto,titlebar=no,status=false";

    oWindow = window.open(url,"o_window",config);
    oWindow.focus();

}


//
function toggleSection(section_id) {
	var oSection = document.getElementById(section_id);

	with(oSection) {
		if(style.visibility=="hidden") {
			style.visibility = "visible";
			style.display = "block";
		}
		else {
			style.visibility = "hidden";
			style.display = "none";
		}
	}
}

function findAspControlById( form, id ) {
    
    for( i = 0; i < form.elements.length; i ++ ) {
        elem = form.elements[ i ];
        if( elem.id.length > 0 )
            if ( elem.id.substring( elem.id.length - id.length, elem.id.length ) == id )
                return elem
    }
}


//
function confirmDelete(url, msg) {
	if(confirm(msg)) {
		if(url != null) {
			window.location.href = url;
		}

		return true;
	}
	
	return false;
}




//
function changeStyle(elm, prop, new_style) {
	elm.style[prop] = new_style;
}


//
function toggleCheckboxes(oCheckBox) {
	var aCB = document.getElementsByTagName("input");

	for(var i=0; i < aCB.length; i++) {
		if(aCB[i].type=="checkbox") {
			if(oCheckBox.checked)
				aCB[i].checked = true;
			else
				aCB[i].checked = false;
		}
	}

}

