﻿var _editMode = false;
var onDemand = {
	/* central path to load plugins from */
	CDNPath : '/_layouts/1033/jScripts/',
	/* jQuery file */
	jQueryJS : 'jquery.v1.2.6.js',
	/* triggers for editing */
	editModeTrigger : '.ms-formfieldcontainer',
	jQueryEditTrigger : '.jQueryEdit, #jQueryEdit',
	/* load sIFR? */
	/*RM Changed sIFR to false*/
	sIFR : false,
	/* jQuery Plugins config */
	jQueryPlugin : {
		/*
		skeleton example:
		
		fnName : {
			selector : '.fnSelector',
			scripts : 'jquery.script.to.load.js',
			callback : function(){ $('.fnSelector').fnName(); }
		}
		
		IMPORTANT NOTE: fnName must be the same in the
		declaration as in the callback function usage!
		*/
		corner	: {
			selector : '.roundCorner',
			scripts : 'jquery.corner.js',
			callback: function(){ $('.roundCorner').corner(); }
		},
		lightBox : {
			selector : '.thumbnail_gallery a, .jQslider li a, a.lightbox, .loadLightbox',
			scripts : 'jquery.lightbox.js',
			callback : function(){ $('.thumbnail_gallery a, .jQslider li a, a.lightbox').lightBox(); }
		},
		accordion : {
			selector : '.accordion, .loadAccordion',
			scripts : ['jquery.ui.core.js', 'jquery.ui.accordion.js'],
			callback : function(){
				$('.accordion.general').accordion({ 
					autoHeight: false,
					header: ".header",
					navigation: true
				});
				$('.accordion.themeroller:not(.collapsed)').accordion({
					header: ".ui-accordion-header",
					clearStyle: true,
					navigation: true
				});
				$('.accordion.collapsed').accordion({
					header: ".ui-accordion-header",
					autoheight: false,
					clearStyle: true,					
					collapsible: true,					
					alwaysOpen: false,
                    active: false,
					navigation: true
				});
			}
		},
		thickBox : {
			selector : '.thickbox',
			scripts : 'jquery.thickbox.js',
			callback : function(){  }
		},
		facebox : {
			selector : 'a[rel*=facebox], .facebox',
			scripts : 'jquery.facebox.js',
			callback : function(){ $('a[rel*=facebox], .facebox').facebox(); }
		},
//Eugene's Function call below
		quickpaginate : {
			selector : '#paginate_pages, .paginate1,#paginate_list li, .loadPagination',
			scripts : 'jquery.quickpaginate.js',
			callback : function(){ 	
				$('#paginate_pages > div').quickpaginate();
				$('#paginate_pages > div').quickpaginate({ perpage: 1, showcounter: true, pager : 							$('.pagination_counter.page') });
				$('#paginate_list li').quickpaginate({ perpage: 12, showcounter: true, pager : 								$('.pagination_counter.list') });
				$('.paginate1 li').quickpaginate();
			}
		},
			flash : {
			selector : 'a[title=video]',
			scripts : 'jquery.flash.js',
			callback : function() { 
			$('a[title=video]').flash(
				{height: 370, width: 450},
				{version: 8},
				function(htmlOptions) {
					$this = $(this);
           			htmlOptions.src = $this.attr('href');
            		$this.before($.fn.flash.transform(htmlOptions));
				}													  
			);			
			}
		},
		fancybox : {
			selector : '.iframe, a#movie, a#movie2, .fancyboxContent, .fblaunch',
			scripts : 'jquery.fancybox-1.2.1.js',
			callback : function() {
			$("a#movie, a#movie2").fancybox({ 
			'frameWidth': 640, 'frameHeight': 480, 'overlayOpacity':0.6,
			'hideOnOverlayClick': false,
			'callbackOnClose': function() {
       			$("#fancy_content").empty();
       			} 
			});	
			$('.fblaunch').fancybox({ 
			'frameWidth': 800, 'frameHeight': 500, 'overlayOpacity':0.6,
			'hideOnOverlayClick': false
			
			});
			
		
			}
		},	
		
			fancybox : {
			selector : '.inlineLightBox',
			scripts : 'jquery.fancybox-1.2.1.js',
			callback : function(){  
			
				$('.inlineLightBox').fancybox({ 
			 'overlayOpacity':0.8,
			'hideOnOverlayClick': false,
			'frameWidth': 800,
			'frameHeight': 500
			});
			}
		},	
		
	
		
		makeacolumnlists: {
		selector : '.majorgrid',
		scripts : 'jquery.columnizer.js',
		callback : function () { $('.majorgrid').makeacolumnlists({cols:4,colWidth:0,equalHeight:false,startN:1}); }
		},

		accessSlider : {
			selector : '.jQslider, .jQslider_full, .loadSlider',
			scripts : 'jquery.slider.js',
			callback : function(){
				$('.jQslider_full, .jQslider').accessSlider({
					sliderHeadline: "",
					sliderSpeed: "normal"
				});
			}
		},
		galleria : {
			selector : 'ul#after_gallery',
			scripts : 'jquery.galleria.js',
			callback : function(){ $('ul#after_gallery').galleria(); }
		},
		galleria2 : {
			selector : '#galleria',
			scripts : ['jquery-1.4.min.js','jquery.galleria2.js'],
			callback : function(){  }
		},		
		tabs : {
			selector : '#tabs-horiz, #tabs, .loadTabs',
			scripts : ['jquery.ui.core.js', 'jquery.ui.tabs.js'],
			callback : function(){ 
				$('#tabs-horiz > ul, #tabs > ul').tabs();
				$('#main ul#tabs').tabs();
				}
		},
		jFeed : {
			selector : '#jfeed_announcements, .jFeed_hide, .loadjFeed',
			scripts : 'jquery.jfeed.js',
			callback : function(){  }
		},
		tablesorter : {
			selector : '.tablesorter, .tablestriper',
			scripts : 'jquery.tablesorter.min.js',
			callback : function(){
				$('.tablesorter').tablesorter({widgets: ['zebra']});
				$('.tablestriper').tablesorter({widgets: ['zebra'],headers: {0: {sorter: false}, 1: {sorter: false}, 2: { sorter: false }, 3: { sorter: false }, 4: { sorter: false }, 5: { sorter: false }, 6: { sorter: false }, 7: { sorter: false }, 8: { sorter: false }, 9: { sorter: false }, 10: { sorter: false }} });
			}
		},
		columnhover : {
			selector : '.columnhover',
			scripts : 'jquery.columnhover.js',
			callback : function(){ $('.columnhover').columnHover({eachCell:true}); }
		},
		jCarouselLite : {
			selector : '.jCarousel',
			scripts : 'jquery.jcarousellite1.0.1.js',
			callback : function() { 
				$(".jCarousel").jCarouselLite({ btnNext: ".next", btnPrev: ".prev", auto: 900, speed: 3000 }); //, auto: 900, speed: 3000
			//	$(".jCarouselauto").jCarouselLite({ auto: 800, speed: 800 });	
			}
		},	
//RM added stuff below
		jCarousel : {
			selector : '.jCarouselFull',
			scripts : 'jquery.jcarousel.js',
			callback : function() {}
		},		
//RM added stuff below
		stepWizard : {
			selector : '.wizard',
			scripts : 'jquery.stepwizard.js',
			callback : function(){ }
		},
		kwicks : {
			selector : '.kwicks',
			scripts : 'jquery.kwicks.js',
			callback : function(){ $('.kwicks').kwicks({max:405,spacing:8}); }
		},
		photoSlider : {
			selector : '.photoslider',
			scripts : 'jquery.photoslider.js',
			callback : function(){ $('.photoslider').photoSlider(); }
		},
		codaSlider : {
			selector : '.slider-wrap',
			scripts : ['jquery.easing.1.2.js','jquery.easing-compatibility.1.2.js','jquery.coda-slider.1.1.1.js'],
			callback : function(){ $('div#slider1').codaSlider(); }
		},
		slidebox : {
			selector : '.boxgrid',
			scripts : 'jquery.slidebox.js',
			callback : function(){  }
		},
		jTip : {
			selector : '.jTip',
			scripts : 'jquery.jtip.js',
			callback : function(){  }
		},
		listnav : {
			selector : '#listnav, .loadListNav',
			scripts : 'jquery.listnav.pack-2.0.js',
			callback : function(){ $('#listnav').listnav({showCounts:false,includeAll:true}); }
		},
		cluetip : {
		selector: '.socialNetworkingLinks, .cluetipLoad',
			scripts : 'jquery.cluetip.js',
			callback : function(){ 
			$('a.clueTip').cluetip({sticky: true, width: 175, activation: 'click', closePosition: 'bottom', positionBy: 'bottomTop', dropShadow: true, dropShadowSteps: 2, arrows: true, local: true, cursor: 'pointer', showTitle: true});		
			}			
		},
		MegaMenu : {
			selector : '.MegaMenuContent',
			scripts : 'jquery.megamenu.js',			
			callback : function(){  }
		},
		SlidingMenu : {
			selector : '.menu_class, .the_menu, .menu_class2, .the_menu2',
			scripts : 'jquery.sliding_menu.js',			
			callback : function(){  }
		},		
		quicksearch : {
			selector : 'input#id_search',
			scripts : 'jquery.quicksearch.js',
			callback : function(){ 
		    $('input#id_search').quicksearch('ul li.ms-vb');  
			}
		},						
		history : {
			selector : '.jQhistory',
			scripts : 'jquery.history.js',
			callback : function(){  }
		}
	}
};

/*
  =====================================
	DO NOT MODIFY BEYOND THIS POINT!
	changing things below this line
	can be hazardous to your health.
  =====================================
FOR REFERNCE - EUGENE's old code
LazyLoad.loadOnce([onDemand.CDNPath+onDemand.jQueryJS],function(){_editMode=$(onDemand.editModeTrigger).length;
if(!_editMode&&onDemand.sIFR){LazyLoad.loadOnce([onDemand.CDNPath+"sifr.js",onDemand.CDNPath+"sifr-debug.js",onDemand.CDNPath+"sifr-config.js","/jscripts/sifr-config.js"]);}$(function(){_editMode=$(onDemand.editModeTrigger).length;var _1=$(onDemand.jQueryEditTrigger).length;if(!_editMode||_1){var _2=new Array();for(var i in onDemand.jQueryPlugin){if(typeof onDemand.jQueryPlugin[i].selector=="object"){onDemand.jQueryPlugin[i].selector=onDemand.jQueryPlugin[i].selector.join(",");}onDemand.jQueryPlugin[i].selector=$(onDemand.jQueryPlugin[i].selector);if(onDemand.jQueryPlugin[i].selector.length&&onDemand.jQueryPlugin[i].scripts!=null){if(typeof onDemand.jQueryPlugin[i].scripts=="object"){for(var k in onDemand.jQueryPlugin[i].scripts){_2.push(onDemand.CDNPath+onDemand.jQueryPlugin[i].scripts[k]);}}else{_2.push(onDemand.CDNPath+onDemand.jQueryPlugin[i].scripts);}}}_2.push(onDemand.CDNPath+"jquery.controls.js");_2.push("/jscripts/jquery.controls.local.js");LazyLoad.loadOnce(_2,function(){for(var i in onDemand.jQueryPlugin){if(onDemand.jQueryPlugin[i].selector.length&&eval("typeof $.fn."+i+"==\"function\"")&&typeof onDemand.jQueryPlugin[i].callback=="function"){onDemand.jQueryPlugin[i].callback();}}});}});});

*/

LazyLoad.loadOnce([onDemand.CDNPath+onDemand.jQueryJS],function(){$(function(){_editMode=$(onDemand.editModeTrigger).length;var _1=$(onDemand.jQueryEditTrigger).length;if(!_editMode||_1){var _2=new Array();for(var i in onDemand.jQueryPlugin){if(typeof onDemand.jQueryPlugin[i].selector=="object"){onDemand.jQueryPlugin[i].selector=onDemand.jQueryPlugin[i].selector.join(",");}onDemand.jQueryPlugin[i].selector=$(onDemand.jQueryPlugin[i].selector);if(onDemand.jQueryPlugin[i].selector.length&&onDemand.jQueryPlugin[i].scripts!=null){if(typeof onDemand.jQueryPlugin[i].scripts=="object"){for(var k in onDemand.jQueryPlugin[i].scripts){_2.push(onDemand.CDNPath+onDemand.jQueryPlugin[i].scripts[k]);}}else{_2.push(onDemand.CDNPath+onDemand.jQueryPlugin[i].scripts);}}}_2.push(onDemand.CDNPath+"jquery.controls.js");_2.push("/jscripts/jquery.controls.local.js");LazyLoad.loadOnce(_2,function(){for(var i in onDemand.jQueryPlugin){if(onDemand.jQueryPlugin[i].selector.length&&eval("typeof $.fn."+i+"==\"function\"")&&typeof onDemand.jQueryPlugin[i].callback=="function"){onDemand.jQueryPlugin[i].callback();}}});}});});

