function showDiv(nombreDiv) {
    document.getElementById(nombreDiv).style.display = "block";
}

function hideDiv(nombreDiv) {
   	document.getElementById(nombreDiv).style.display = "none";
}

function addZero(vNumber){
    return ((vNumber < 10) ? "0" : "") + vNumber
}

function formatDate(vDate, vFormat){
    var vDay                      = addZero(vDate.getDate());
    var vMonth            = addZero(vDate.getMonth()+1);
    var vYearLong         = addZero(vDate.getFullYear());
    var vYearShort        = addZero(vDate.getFullYear().toString().substring(3,4));
    var vYear             = (vFormat.indexOf("yyyy")>-1?vYearLong:vYearShort)
    var vHour             = addZero(vDate.getHours());
    var vMinute           = addZero(vDate.getMinutes());
    var vSecond           = addZero(vDate.getSeconds());
    var vDateString       = vFormat.replace(/dd/g, vDay).replace(/MM/g, vMonth).replace(/y{1,4}/g, vYear)
    vDateString           = vDateString.replace(/hh/g, vHour).replace(/mm/g, vMinute).replace(/ss/g, vSecond)
    return vDateString
}

//Funciones para desplegar el div flotante con el mensaje de alerta antes de efectuar la aotuasignación
function verificarAccionAutoassing (idService, companyServiceCompanyId) {
	var complementoUrl = idService + '/' + companyServiceCompanyId;
	document.getElementById('fade').style.display = "block";
	document.getElementById('divArchivo').style.display = "block";
	document.frm_pagina.action = '/company_services/listQualificationProcess';
	document.frm_mensaje.complementoUrl.value = complementoUrl;
    submitForm = 0;
}

function autoAsignar (accion, newaction) {
		switch (accion) {
			case 'ACEPTAR' :
					document.getElementById('divArchivo').style.display = "none";
					document.getElementById('fade').style.display = "none";
					document.frm_pagina.action = newaction + document.getElementById('complementoUrl').value;
					document.frm_pagina.submit();
				break;
			case 'CANCELAR' :
				document.getElementById('divArchivo').style.display = "none";
				document.getElementById('fade').style.display = "none";
				break;
			default: null;
				break;
		}
}
//Funciones para desplegar el div flotante con el mensaje de confirmación antes de eliminar un proveedor
function verificarAccionDelSupplier (idClientSupplierService, servicetype) {
	var complementoUrl = idClientSupplierService + '/' + servicetype;
	document.getElementById('fade').style.display = "block";
	document.getElementById('divArchivo').style.display = "block";
	document.frm_pagina.action = '/companies/listQualificationProcessSupplier';
	document.frm_mensaje.complementoUrl.value = complementoUrl;
    submitForm = 0;
}

function delSupplier (accion, newaction) {
		switch (accion) {
			case 'ACEPTAR' :
					document.getElementById('divArchivo').style.display = "none";
					document.getElementById('fade').style.display = "none";
					document.frm_pagina.action = newaction + document.getElementById('complementoUrl').value;
					document.frm_pagina.submit();
				break;
			case 'CANCELAR' :
				document.getElementById('divArchivo').style.display = "none";
				document.getElementById('fade').style.display = "none";
				break;
			default: null;
				break;
		}
}