function ShowElement(id) {

	var e = document.getElementById(id);

	e.style.display = (e.style.display != "block") ? "block" : "none";

}

function changeMyImage() {
		fileUrl = document.frm.img.value;
		document.images.img.src = fileUrl;

	}

function isNotEmpty(elem) {
    var str = elem.value;
	var re = /.+/;
    if(!str.match(re)) {
        alert("Please fill in the required field!");
		elem.focus();
        return false;
    } else {
        return true;
    }
}

function isNotRezo(elem) {
    var str = elem.value;
	var re = /.+/;
    if(str <=0) {
        alert("Please select a value!");
		elem.focus();
        return false;
    } else {
        return true;
    }
}

// Check retype password
function checkrepass(elem1,elem2) {
    if(elem1.value != elem2.value) {
        alert("Password not match! Please retype password!");
		elem2.focus();
        return false;
    } else {
        return true;
    }
}

// validates that the entry is formatted as an email address
function isEmailAddr(elem) {

    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Verify the email address format!");
		elem.focus();
        return false;
    } else {
        return true;
    }
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=200,left = 412,top = 284');");
}

///////////////////////////////////////
function view(act,id){
 var arg= "width =550, height=300,";
 arg+="resizable=no,scrollbars=yes,";
 arg+="status=0,top=0,left=450";
 window.open("popup.php?act="+act+"&id="+id,"a",arg);
 }
function nghe(id){
 var arg= "width =500, height=200,";
 var new_window;
 arg+="resizable=no,scrollbars=yes,";
 arg+="status=0,top=0,left=400";
 new_window=window.open("nghe.php?id="+id,"a",arg);
 if (window.focus) {new_window.focus()}
 } 
function check(){
if (confirm("Are you sure?")) return true;
return false;
}
function navigate(t,choice) {
    var url = t+choice.options[choice.selectedIndex].value;
    if (url) {
        location.href = url;
    }
}
