﻿function calculateDifference(toDate)
{
    result="";
    now =new Date();
    delta = toDate - now - (30 * 86400000);
    days = String(parseInt(delta/86400000));
    hours = String(parseInt((delta - (days*86400000))/3600000));
    if(hours.length==1)
        hours="0" + hours;
    minutes = String(parseInt((delta - (days*86400000) - (hours*3600000))/60000));
    if(minutes.length==1)
        minutes="0" + minutes;
    seconds = String(parseInt((delta - (days*86400000) - (hours*3600000) - (minutes*60000) )/1000));
    if(seconds.length==1)
        seconds="0" + seconds;
    
    if(days>0)
       result+=days + " ימים ";
       
    result+=hours + ":" + minutes + ":" + seconds;    
    return result;
}


