diff --git a/app/assets/javascripts/kernel.js b/app/assets/javascripts/kernel.js
index a05a7f40..6821079f 100644
--- a/app/assets/javascripts/kernel.js
+++ b/app/assets/javascripts/kernel.js
@@ -1,30 +1,58 @@
+var banners = [];
+var banner_index = 0;
+
$(document).ready(function() {
-
$.each($(".dymanic_load"),function(){
- if($(this).attr("path")==''){$(this).html("App setting Failed");}
-
- if($(this).attr("path")!=''){
- ajax_load_proc($(this),$(this).attr("path"));
- }
+ if($(this).attr("path")==''){
+ $(this).html("App setting Failed");
+ }else{
+ // Check if this App is AD_Banner
+ if($(this).attr("path").indexOf("show_banner")>0){
+ ajax_load_proc($(this),$(this).attr("path"),"true");
+ }else{
+ ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
}
- );
- $("#main_content").addClass("module");
+ }
});
-function ajax_load_proc(wapper,url){
+ $("#main_content").addClass("module");
+});
+
+function ajax_load_proc(wapper,url,isBanner){
$.get(encodeURI(url), {}, function(respText,textSta,XML){
- if (textSta == 'success') {
- wapper.html(respText);
- };
- if(textSta == 'error')
- wapper.html("Loading Failed
Go See");
+ if (textSta == 'success') {
+ if(isBanner=="true"){
+ wapper.html(respText);
+ var banner = banners[banner_index];
+ $(banner.banner_name+" > img").each(function(){
+ $(this).load(function(){ banner.image_loaded++; });
+ });
+ BannerCycle(banner_index);
+ banner_index++;
+ }else{
+ wapper.html(respText);
+ }
+ };
+ if(textSta == 'error')
+ wapper.html("Loading Failed
Go See");
});
}
-// Ad Banner FX code [start]
-function getTimeout() {
- return $(this).attr('time_to_next');
-}
+function BannerCycle(banner_index){
+ var banner = banners[banner_index];
+ // Wait untill all images are loaded
+ if (banner.image_loaded==$(banner.banner_name+" img").length){
+ $(banner.banner_name).cycle({
+ delay: -1000,
+ fx: banner.banner_fx,
+ timeout: banner.time_to_next,
+ pager: banner.banner_pager,
+ pagerAnchorBuilder: function(idx, slide) { return "