/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/Projects/Packer/
*/

// C:\TeamCity\buildAgent\work\d1c97f83e5a869da\FleetConnect\ShiftACar\Server\www\_scripts\fleetconnect.js

function confirm_delete_vehicle(){return confirm("Are you sure you want to delete this vehicle?");}
function confirm_cancel_bid(){return confirm("Are you sure you want to withdraw this quote?");}
function confirm_delete_handler(){return confirm("Are you sure you want to delete this handler?");}
function confirm_delete_draft_job(){return confirm("Are you sure you want to delete this draft job?");}
function confirm_delete_ratecard(){return confirm("Are you sure you want to delete this ratecard?");}
function confirm_cancel_job(){return confirm("Are you sure you want to cancel this job?");}
function confirm_delete_contact(){return confirm("Are you sure you want to delete this contact?");}
function confirm_clear_all_alerts(){return confirm("Are you sure you want to clear all alerts?");}
function confirm_recalculate_quotes(){return confirm("Recalculating will overwrite any existing quotes.\r\n\r\nAre you sure?");}
function confirm_book_job(){return confirm("Booking a job indicates to the transport company that you agree to the price indicated and would like the job to go ahead.\r\n\r\nWould you like to book this job?");}
function limitChars(textid,limit,infodiv){var text=jayQ(textid).val();var textlength=text.length;if(textlength>limit){jayQ(textid).val(text.substr(0,limit));if(infodiv!=null)
jayQ(infodiv).html('You cannot enter more then '+limit+' characters');return false;}
else{if(infodiv!=null)
jayQ(infodiv).html((limit-textlength)+' characters remaining');return true;}}
function confirmArchiveDialog(dialogId,openerId,jobUid,navigateOnClose){jayQ(dialogId).dialog({autoOpen:false,resizable:false,height:170,modal:true,buttons:{'Delete quote':function(){jayQ.ajax({url:'CdnAjaxHandler.ashx?method=archivejob&uid='+jobUid,cache:false,async:false,success:function(){}});window.location.href=navigateOnClose;},Cancel:function(){jayQ(this).dialog('close');}}});jayQ(openerId).click(function(){jayQ(dialogId).dialog('open');return false;});}
function checkLength(errorDiv,o,n,min,max){if(o.val().length>max||o.val().length<min){o.addClass("ui-state-error");updateTips(errorDiv,"Length of "+n+" must be between "+
min+" and "+max+".");return false;}else{return true;}}
function checkPopulated(errorDiv,o,n){if(o==null||o.val().length==0){o.addClass("ui-state-error");updateTips(errorDiv,n+" must be populated")
return false;}else{return true;}}
function checkRegexp(errorDiv,o,regexp,n){if(!(regexp.test(o.val()))){o.addClass("ui-state-error");updateTips(errorDiv,n);return false;}else{return true;}}
function updateTips(div,t){div.jGrowl(t,{theme:'orange',life:10000});}
function allocateJob(currentUrl,uid,to){jayQ.ajax({cache:false,async:false,url:"CdnAjaxHandler.ashx?method=allocatejob",data:({uid:uid,allocateto:to}),success:function(data){window.location.href=currentUrl;}});}
function requestTradeBids(currentUrl,uid,network){jayQ.ajax({cache:false,async:false,url:"CdnAjaxHandler.ashx?method=requestTradeBids",data:({uid:uid,network:network}),success:function(data){window.location.href="xmlgrid.aspx?g=xuMyVDEX";}});}
function sendJourney(uid,driver,jobId){jayQ.ajax({cache:false,async:false,url:"CdnAjaxHandler.ashx?method=sendjourney",data:({uid:uid,driver:driver,jobid:jobId}),success:function(data){window.location.href="xmlgrid.aspx?g=muOpenJobs";}});}
function cancelJob(currentUrl,uid,reason){jayQ.ajax({cache:false,async:false,url:"CdnAjaxHandler.ashx?method=cancelJob",data:({uid:uid,reason:reason}),success:function(data){window.location.href=currentUrl;}});}
function reconfirmCancelJob(currentUrl,uid){jayQ.ajax({cache:false,async:false,url:"CdnAjaxHandler.ashx?method=reconfirmCancelJob",data:({uid:uid}),success:function(data){window.location.href=currentUrl;}});}

