﻿ // Survey Modules Loader
 
 // Description 
 //    Loads data from different survey queries (from Stored Procs) into
 //    the modules within the website.  Updates these modules based
 //    on the refresh variable set at the top of this file.  
 //    This JS file links the modules static pages into the site using jQuery 

 // Usage
 //    Include this js file within a page that uses the following
 //    DIV tags and the data will automatically update within that module
 //    Tags currently in use are:
 //                 liveView -  Survies that are currently live
 //              popularView -  [X] Most popular Live Survies based on views
 //                 soonView -  Survies that are going to start soon
 //       popularAllTimeView -  [X] mosy popular all-time survies
 //                mySurveys -  My current Survies in the system.
 //
  
 // Module Loader 
 jQuery(function() {
        jQuery("#liveView").load("./modules/survey/livesurvey.aspx");
   	    var refreshId = setInterval(function() { jQuery("#liveView").load('./modules/survey/livesurvey.aspx'); }, 120000);

   	    jQuery("#popularView").load("./modules/survey/mostpopular.aspx");
   	    var refreshId = setInterval(function() { jQuery("#popularView").load('./modules/survey/mostpopular.aspx'); }, 10000);

   	    jQuery("#soonView").load("./modules/survey/startingsoon.aspx");
   	    var refreshId = setInterval(function() { jQuery("#soonView").load('./modules/survey/startingsoon.aspx'); }, 10000);

   	    jQuery("#popularAllTimeView").load("./modules/survey/mostpopular.aspx?id=1");
        var refreshId = setInterval(function() { jQuery("#popularAllTimeView").load('./modules/survey/mostpopular.aspx?id=1'); }, 10000);

        jQuery("#mySurveys").load("./modules/survey/mysurveys.aspx");
        var refreshId = setInterval(function() { jQuery("#mySurveys").load('./modules/survey/mysurveys.aspx'); }, 10000);

        jQuery(".scrollable").scrollable({ circular: true }).autoscroll(5000);    
});
