/**
* @author    JoomlaShine.com http://www.joomlashine.com
* @copyright Copyright (C) 2008 - 2011 JoomlaShine.com. All rights reserved.
* @license   GNU/GPL v2 http://www.gnu.org/licenses/gpl-2.0.html
*/

	var JSNTemplate = {
		_templateParams:		{},

		initOnDomReady: function()
		{
			// Typography setup
			JSNUtils.createExtList("list-number-", "span", "jsn-listbullet", true);
			JSNUtils.createExtList("list-icon", "span", "jsn-listbullet", false);

			// Smooths effect for go top link
			JSNUtils.setSmoothScroll(_templateParams.enableJQuery);

			// Fade in / Fade out effect when scrolling
			JSNUtils.setFadeScroll(_templateParams.enableJQuery);

			if (!_templateParams.enableMobile) {
				if (!_templateParams.mobileDevice) {
					// Menu dropdown setup
					JSNUtils.setDropdownMenu("menu-mainmenu", (_templateParams.enableMMFX?1:0), { duration:250, delay:500, orientation: 'h' }, _templateParams.enableJQuery);
					JSNUtils.setDropdownMenu("menu-sidemenu", (_templateParams.enableSMFX?1:0), { duration:250, delay:500, orientation: 'v' }, _templateParams.enableJQuery);
					JSNUtils.setDropdownMenuFX("jsn-sitetools-menu", (_templateParams.enableMMFX?1:0), { duration:250, delay:500, orientation: 'h' }, _templateParams.enableJQuery);
				}

				// General layout setup
				JSNUtils.setInnerLayout(["jsn-content_inner3", "jsn-leftsidecontent", "jsn-rightsidecontent", "jsn-pos-innerleft", "jsn-pos-innerright"]);

				// Menu layout setup
				JSNUtils.setSidemenuLayout("menu-sidemenu", _templateParams.enableRTL);
				JSNUtils.setSitetoolsLayout("jsn-sitetools-menu", _templateParams.enableRTL);

				// Typography setup
				JSNUtils.createGridLayout("DIV", "grid-layout", "grid-col", "grid-lastcol");
			} else {
				JSNUtils.setMobileMenu("menu-mainmenu");
			}
		},

		initOnLoad: function()
		{
			if (!_templateParams.enableMobile) {
				// Setup vertical positions of stickleft, stickright positions
				JSNUtils.setVerticalPosition("jsn-pos-stick-leftmiddle", 'middle');
				JSNUtils.setVerticalPosition("jsn-pos-stick-rightmiddle", 'middle');

				// Fix IE6 PNG issue
				if (JSNUtils.isIE6()) {
					DD_belatedPNG.fix('#jsn-logo img, #jsn-sitetools-menu li, #jsn-sitetools-menu a, #jsn-sitetools-menu ul, ul.menu-mainmenu a, ul.menu-mainmenu a span, ul.menu-mainmenu ul, .menu-treemenu span, .menu-sidemenu a, .menu-sidemenu a span, .menu-sidemenu ul, .breadcrumbs a, .breadcrumbs span, .createdate, .link-button, .text-alert, .text-info, .text-download, .text-tip, .text-comment, .text-attachment, .text-video, .text-audio, .list-number-bullet .jsn-listbullet, .list-arrow li, #jsn-gotoplink, .jsn-top, .jsn-top_inner, .jsn-middle, .jsn-middle_inner, .jsn-bottom, .jsn-bottom_inner');
				}
			}
		},

		initTemplate: function(templateParams)
		{
			// Store template parameters
			_templateParams = templateParams;
			
			// Init template on "domready" event
			if (_templateParams.enableJQuery) {
				$j(document).ready(function(){
					JSNTemplate.initOnDomReady();
				});
			} else if (typeof(MooTools) != 'undefined') {
				window.addEvent('domready', JSNTemplate.initOnDomReady);
			}

			// Init template on "load" event
			JSNUtils.addEvent(window, 'load', JSNTemplate.initOnLoad);
		}
	}
