function open_popup (page) {
    var options="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=760, height=600, top=85, left=140";
    window.open(page,"SchoolnotesCalendar",options);
}

function close_popup () {
   popup.close()
}

function open_preview_popup(page) {
    var options = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=580, height=600, top=70, left=100";
    window.open(page,"",options);
}

function open_editor_popup(page) {
	var options = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=780, height=600, top=70, left=100";
    window.open(page,"editor",options);
}

function popup(url) {
    window.open(url,"ventana1","width=500, height=350, scrollbars=yes, menubar=no, location=yes, resizable=no")
}


function toggleHelp() {
	var elem = document.getElementById('helptxt');

	if(elem.style.display == 'block') {
		elem.style.display = 'none';
	} else {
		elem.style.display = 'block';
    }

    return false;
}

function toggleFieldset(id) {
    var elem = document.getElementById(id);
    var content = document.getElementById(id+'_content');

    if(content.style.display == 'block') {
        content.style.display = 'none';
        elem.className = 'collapsed';
    } else {
        content.style.display = 'block';
        elem.className = 'expanded';
    }

    return false;
}

function rn(str) {
	var newstr = "";
	for (var _i=0;_i<str.length;_i++) {
		if (str.charCodeAt(_i) != 13 && str.charCodeAt(_i) != 10 && str.charCodeAt(_i) != 34 && str.charCodeAt(_i) != 32) {
	    	newstr += str.charAt(_i);
	    }
	}

	return newstr;
}

function showConfirm(element) {
	var r = confirm("Change style may cause lost of data from the flashcards on this deck. Are you sure you want to change the style?");
	if (r != true) {
		if (element.value == 'O') {
			window.document.flashcardGroupEdit.version_N.checked = 'checked';
		} else if (element.value == 'N') {
			window.document.flashcardGroupEdit.version_O.checked = 'checked';
		}
	}
}
