///////////////////////////////////////////////////////////////////////
//     This script was designed by Kapur Technologies Pvt Ltd        //
//     for Kapur Inc's list2shop.com                                 //
//                                                                   //
//                                                                   //
//     this program is copyrighted, you need prior written           //
//     permission to use or copy this program                           //
///////////////////////////////////////////////////////////////////////
var hasSLChanged=false;
function recordSLChange(){
    hasSLChanged=true; //timer stops
}
function recordSLSave(){
    hasSLChanged=false; //timer starts
 //   alert("hasSLChanged is false now");
}
function startAutoSaveTimer(autosave_timer){
    //alert("start Autosave timer"+autosave_timer);
    setInterval("autoSaveNow()",autosave_timer);//every 10 secs
    //alert("AutoSave Done");
   //setInterval("auto_logout()",1800000);//every 30min
}
function autoSaveNow(){
    if(hasSLChanged){        
        //alert("trying to auto save");
    //   document.getElementById("test").innerHTML="trying to auto save";
    //saveSLAjax_forRegUser('regis_saveSLform','true');
    saveShoppingListAjaxfun('regis_saveSLform','reg_user_auto_save_sl');
    } else {
  //  alert("not trying to auto save");
     //      document.getElementById("test").innerHTML=" not trying to auto save";
}
}
/*var intervals = [];
function startTimer(timerVar){  //CALL IN JSP PAGE, for example in onLoadActivities()
    // alert("startTimer(),timerVar ="+timerVar);
    if(timerVar){
        //    store the interval in intervals array, 10000 is time value in parameter below.
        intervals.push(setInterval("AutoSaveSubmit()", 10000));
        //    alert("startTimer(),timer starts");
    }
}
function AutoSaveSubmit()
{
    try
    {
        //  callByAutoSave_fromJsp()  declared in jsp page  
        callByAutoSave_fromJsp(); 
    }
    catch (exception) {}
}
function stopTimer(timerVar){
    //  alert("stopTimer(),timerVar= "+timerVar);
    if(timerVar==false){
        if(intervals.length==0) return;
        intervals.pop();
        //   alert("stopTimer(),timer stopped?");
    }
    return;
}            
*/
 
var hasFavListChanged=false;
function recordFavL_Stores_Change(){
    hasFavListChanged=true;
    //alert("value of hasFavListChanged ="+hasFavListChanged);
    
}
function recordFavL_Stores_Save(){
    hasFavListChanged=false;
    //alert("value of hasFavListChanged ="+hasFavListChanged);
    
}
function startAutoSaveTimerFav_Stores(autosave_timer){
    //alert("Autosave timer"+autosave_timer);
    setInterval("autoSaveFav_Stores_Now()",autosave_timer);//every 10 secs
  
}
function autoSaveFav_Stores_Now(){
    if(hasFavListChanged){       
    // alert("trying to auto save valueof hasfavlist is ="+hasFavListChanged);
    save_favStores_ajax('auto_save');
    } else {
    }
    }

var hasFavListPChanged=false;
function recordFavL_Products_Change(){
    hasFavListPChanged=true;
}
function recordFavL_Products_Save(){
    hasFavListPChanged=false;
    //alert ("value of hasfavlist changes i s="+hasFavListPChanged);
    
}
function startAutoSaveTimerFav_Products(autosave_timer){
    //alert("start Autosave timer");
   // alert("autosavetime is "+autosave_timer);
    setInterval("autoSaveFav_Products_Now()",autosave_timer);//every 10 secs
   
}
function autoSaveFav_Products_Now(){
     
    if(hasFavListPChanged){       
    //alert("trying to autosave in products, hasfavlist is ="+hasFavListPChanged);
    save_favProducts_ajax('auto_save');
    } else {
    }
}




