function alertDeleteProperty(type){
    return confirm('Are you sure that delete this '+type+'?');
}
function incorrectText(id,msg){
    if(document.getElementById(id).value == ''){
        alert(msg);
        document.getElementById(id).focus();
        return true;
    }
    return false;
}
function validateNumber(id,msg){
    var value = document.getElementById(id).value;
    var noValue = true;
    if(noValue){
        alert(msg);
        document.getElementById(id).focus();
        return false;
    }
    return true;
}
function incorrectImgFile(id, field, msg, required){
    var file = document.getElementById(id).value;
    if(required && file == ""){
        alert("The " + field + " image is required");
        document.getElementById(id).click();
        return true;
    }else if(file != ""){
        var exts = new Array(".gif",".jpg",".jpeg",".png");
        var extension = (file.substring(file.lastIndexOf("."))).toLowerCase();
        var noPerm = true;
        for(var i=0; i<exts.length; i++){
            if(extension == exts[i])
                noPerm = false;
        }
        if(noPerm){
            alert(msg + "\nAllow only files with the following extensions: " + exts.join());
            document.getElementById(id).focus();
        }
        return noPerm;
    }
}
function incorrectPdfFile(id, field, msg, required){
    var file = document.getElementById(id).value;
    if(required && file == ""){
        alert("The " + field + " image is required");
        document.getElementById(id).focus();
        return true;
    }else if(file != ""){
        var ext = ".pdf";
        var extension = (file.substring(file.lastIndexOf("."))).toLowerCase();
        var noPerm = (extension != ext);
        if(noPerm){
            alert(msg + "\nAllow only files with " + ext + " extension");
            document.getElementById(id).click();
        }
        return noPerm;
    }
}
var wO;
function openPdf(type, code){
    wO = window.open("/pdf.php?pdfCode="+code+"&pdfType="+type,"wO","channelmode=0,directories=0,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,width=800,height=800");
}
function openPicture(type,code){
    wO = window.open("/picture.php?pictureCode="+code+"&pictureType="+type,"wO","channelmode=0,directories=0,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,width=700,height=600");
}
function previousProperty(idProperty)
{
	alert(idProperty);
	window.open(idProperty,"wO","location=yes");
}