function checkEnter(e){ //e is event object passed from function invocation

	var characterCode //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		document.forms[0].submit() //submit the form
		return false
	}
	else{
		return true
	}
}


menu_status = new Array();

function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}



function show(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);
           switch_id.className = 'show';
    }
}
function hide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

switch_id.className = 'hide';
    }
}



function markAll( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('div');
    var checkbox;
    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            if ( checkbox.disabled == false ) {
                checkbox.checked = true;
            }
        }
    }

    return true;
}

/**
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 *
 * @param    container    DOM element
 */
function unMarkAll( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('div');
    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            checkbox.checked = false;
        }
    }

    return true;
}



function mark(container_id,check_name){
	var check_name_=document.getElementById(check_name);
    var rows = document.getElementById(container_id).getElementsByTagName('tr');

	if (check_name.checked!='checked'){
    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            if ( checkbox.disabled == false ) {
                checkbox.checked = true;
            }
        }
    }

	}else{
    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            checkbox.checked = false;
        }
    }

	}

    return true;
}

function popup(file,theid){
	switch(file){
		case 'send' :
			window.open("send.php?id="+theid, "", "status = 0,  width = 500,height = 350, resizable = 0, scrollbar=1" );
			break;
		case 'print':
			window.open("print.php?id="+theid, "", "status = 0,  width = 800,height = 600, resizable = 0,scrollbar=1" );
		case 'zoom':
			window.open("zoom.php?id="+theid, "", "status = 0,  width = 500,height = 400, resizable = 0,scrollbar=1" );
	}
}