$(document).ready(function(){
$('#btnLogin').click(function(){
if($('#txtUser').val()=='') {
alert("Please provide your user ID");
$('#txtUser').focus();
return false;
}
if($('#txtPassword').val()=='') {
alert("Please provide your Password");
$('#txtPassword').focus();
return false;
}
$('#frmLogin').submit();
});
/*QUOTE SECTION*/
$('input[name=rdQuote]').click(function(){
var row = $(this).parent().parent();
$('#qDetails').html(row.find('td:nth-child(8)').html());
$('#qDetails').css({"display":"block"});
});
$('#btnRead').click(function(){
if($('input[name=rdQuote]:checked').attr('id')){
var cRadio = $('input[name=rdQuote]:checked');
var itemId = cRadio.attr('id');
window.location.href="qMarkRead.php?qId="+itemId;
}
else{
alert("Please choose a quote to mark");
}
});
$('#btnReply').click(function(){
if($('input[name=rdQuote]:checked').attr('id')){
var cRadio = $('input[name=rdQuote]:checked');
var itemId = cRadio.attr('id');
window.location.href="qMarkReply.php?qId="+itemId;
}
else{
alert("Please choose a quote to mark");
}
});
$('#btnDeleteQuote').click(function(){
if($('input[name=rdQuote]:checked').attr('id')){
var cRadio = $('input[name=rdQuote]:checked');
var itemId = cRadio.attr('id');
if(confirm("Are you wish to delete this Quote?")){
window.location.href="deleteQuote.php?qId="+itemId;}
}
else{
alert("Please choose a Quote to delete");
}
});
/*END OF QUOTE SECTION*/
/*MANAGE PROJECT SECTION*/
$('#btnAddProj').click(function(){
window.location.href="manageproj3.php?Client="+$('#optClient').val();
});
$('#btnEdProj').click(function(){
window.location.href="manageproj2.php?Action=edit&Client="+$('#optClient').val();
});
$('#btnSaveProj').click(function(){
if($('#txtProjName').val()==''){
alert("Please enter project name");
$('#txtProjName').focus();
return false;
}
if($('#txtContractorName').val()==''){
alert("Please enter contractor name");
$('#txtContractorName').focus();
return false;
}
if($('#txtVolume').val()==''){
alert("Please enter project volume");
$('#txtVolume').focus();
return false;
}
$('#frmSaveProj').submit();
});
$('#btnEditProj').click(function(){
if($('input[name=rdProject]:checked').attr('id')){
var cRadio = $('input[name=rdProject]:checked');
var itemId = cRadio.attr('id');
$('#editArea').css({"display":"block"});
$('#txtPrId').val(itemId);
var cRow = $(cRadio.parent().parent());
var itemProjName = $(cRadio.parent().parent()).find('td:nth-child(2)').html();
var itemContractor = $(cRadio.parent().parent()).find('td:nth-child(3)').html();
var itemVolume = $(cRadio.parent().parent()).find('td:nth-child(4)').html();
$('#txtProjName').val(itemProjName);
$('#txtContractorName').val(itemContractor);
$('#txtVolume').val(itemVolume);
}
else{
alert("Please choose a Project to edit");
}
});
$('#btnDeleteProj').click(function(){
if($('input[name=rdProject]:checked').attr('id')){
var cRadio = $('input[name=rdProject]:checked');
var itemId = cRadio.attr('id');
var clId = $('#txtClientId').val();
if(confirm("Are you wish to delete this project?")){
window.location.href="deleteProj.php?prId="+itemId+"&Client=" +clId;}
}
else{
alert("Please choose a Project to delete");
}
});
/*END OF MANAGE PROJECT SECTION*/
/*MANAGE FACTS SECTION*/
$('#btnEditFact').click(function(){
if($('input[name=rdFact]:checked').attr('id')){
var cRadio = $('input[name=rdFact]:checked');
var itemId = cRadio.attr('id');
//window.location.href="apIssueresponse.php?isId="+itemId;
$('#editArea').css({"display":"block"});
$('#txtFactId').val(itemId);
var cRow = $(cRadio.parent().parent());
//alert(cRow.find())
var itemDesc = $(cRadio.parent().parent()).find('td:nth-child(3)').html();
$('#txtEFact').val(itemDesc);
}
else{
alert("Please choose a fact to edit");
}
});
$('#btnDeleteFact').click(function(){
if($('input[name=rdFact]:checked').attr('id')){
var cRadio = $('input[name=rdFact]:checked');
var itemId = cRadio.attr('id');
window.location.href="deleteFact.php?fId="+itemId;
}
else{
alert("Please choose a fact to delete");
}
});
$('#btnAdd').click(function(){
$('#editArea').css({"display":"block"});
$('#txtFactId').val('0');
$('#txtEFact').val('');
$('#txtEFact').focus();
});
$('input[name=rdFact]').click(function(){
$('#editArea').css({"display":"none"});
});
$('#btnSaveFact').click(function(){
if($('#txtEFact').val()==""){
alert("Facts Should not be Empty");
$('#txtEFact').focus();
return false;
}
$('#frmEditFact').submit();
});
/*END OF MANAGE FACTS SECTION*/
/*MANAGE VACANCY SECTION*/
$('#btnEditVac').click(function(){
if($('input[name=rdVac]:checked').attr('id')){
var cRadio = $('input[name=rdVac]:checked');
var itemId = cRadio.attr('id');
//window.location.href="apIssueresponse.php?isId="+itemId;
$('#editArea').css({"display":"block"});
$('#txtVacId').val(itemId);
var cRow = $(cRadio.parent().parent());
//alert(cRow.find())
var itemPos = $(cRadio.parent().parent()).find('td:nth-child(3)').html();
var itemDesc = $(cRadio.parent().parent()).find('td:nth-child(4)').html();
$('#txtEpos').val(itemPos);
$('#txtEVac').val(itemDesc);
}
else{
alert("Please choose a Vacancy to edit");
}
});
$('#btnCloseVac').click(function(){
if($('input[name=rdVac]:checked').attr('id')){
var cRadio = $('input[name=rdVac]:checked');
var itemId = cRadio.attr('id');
if(confirm("Closing a Vacancy will not remove item from admin section. But it will not be shown to the viewer.\n Are you wish to continue?")){
window.location.href="closevac.php?vId="+itemId;}
}
else{
alert("Please choose a vacancy to close");
}
});
$('#btnAddVac').click(function(){
$('#editArea').css({"display":"block"});
$('#txtVacId').val('0');
$('#txtEpos').val('');
$('#txtEVac').val('');
$('#txtEpos').focus();
});
$('input[name=rdVac]').click(function(){
$('#editArea').css({"display":"none"});
});
$('#btnSaveFact').click(function(){
if($('#txtEpos').val()==""){
alert("Position Should not be Empty");
$('#txtEpos').focus();
return false;
}
if($('#txtEVac').val()==""){
alert("Requirement Should not be Empty");
$('#txtEVac').focus();
return false;
}
$('#frmEditVac').submit();
});
$('#btnBreakVac').click(function(){
insertAtCaret('txtEVac','
');
return false;
});
/*END OF MANAGE VACANCY SECTION*/
/*MANAGE NEWS SECTION*/
$('#btnEditNews').click(function(){
if($('input[name=rdNews]:checked').attr('id')){
var cRadio = $('input[name=rdNews]:checked');
var itemId = cRadio.attr('id');
//window.location.href="apIssueresponse.php?isId="+itemId;
$('#editArea').css({"display":"block"});
$('#txtNewsId').val(itemId);
var cRow = $(cRadio.parent().parent());
//alert(cRow.find())
var itemCap = $(cRadio.parent().parent()).find('td:nth-child(3)').html();
var itemDesc = $(cRadio.parent().parent()).find('td:nth-child(4)').html();
$('#txtCaption').val(itemCap);
$('#txtNews').val(itemDesc);
}
else{
alert("Please choose a News to edit");
}
});
$('#btnDeleteNews').click(function(){
if($('input[name=rdNews]:checked').attr('id')){
var cRadio = $('input[name=rdNews]:checked');
var itemId = cRadio.attr('id');
if(confirm("Are you wish to delete this news?")){
window.location.href="deleteNews.php?nId="+itemId;}
}
else{
alert("Please choose a News to delete");
}
});
$('#btnAddNews').click(function(){
$('#editArea').css({"display":"block"});
$('#txtNewsId').val('0');
$('#txtCaption').val('');
$('#txtNews').val('');
$('#txtCaption').focus();
});
$('input[name=rdNews]').click(function(){
$('#editArea').css({"display":"none"});
});
$('#btnSaveNews').click(function(){
if($('#txtCaption').val()==""){
alert("Caption Should not be Empty");
$('#txtCaption').focus();
return false;
}
if($('#txtNews').val()==""){
alert("News Should not be Empty");
$('#txtNews').focus();
return false;
}
$('#frmEditNews').submit();
});
$('#btnBreakNews').click(function(){
insertAtCaret('txtNews','
');
return false;
});
$('#btnPara').click(function(){
insertAtCaret('txtNews','