﻿//var __images = new Array();var __curr = 0;var __newItems = new Array();var __currNewsItem = 0;
//function __showNext(){$(__images[__curr]).fadeOut("slow");__curr++;if (__curr >= __images.length){__curr = 0;}$(__images[__curr]).fadeIn("slow");setTimeout("__showNext()", 5000);}function __showNextNews(){$(__newItems[__currNewsItem]).fadeOut("slow");__currNewsItem++;if (__currNewsItem >= __newItems.length){__currNewsItem = 0;}$(__newItems[__currNewsItem]).fadeIn("slow");setTimeout("__showNextNews()", 8000);}
$(document).ready(
	function() {
		tlc.sideNav();
		//		__figureMenu();

		// Home Page Image Rotation Setup
		//		$("div#body div#images img").each(function() { __images.push($(this)); });
		//		$("div#body div#images img:first").css("display", "block");
		//		if (__images.length > 1) { setTimeout("__showNext()", 5000); }

		// Navigation Highlighting
		//		$("#nav a").each(function() { var location = window.location.href; location = location.substring(location.lastIndexOf('/')); if ($(this).attr('href') == location) { $(this).addClass("selected"); } else { $(this).removeClass("selected"); } });

		// Searchbar Functionality
		//		$("#searchterms").keyup(function(event) { if (event.keyCode == 13) { window.location.href = "/search/?q=" + $("#searchterms").attr("value"); } }).focus(function() { $(this).attr("value", ""); });
		//		$("#go-search").click(function() { window.location.href = "/search/?q=" + $("#searchterms").attr("value"); });

		// News Ticker Functionality
		//		$("div.headline:first").css("display", "block");
		//		var __headlineHeight = 0;
		//		$("div.headline").each(function() { if ($(this).height() > __headlineHeight) { __headlineHeight = $(this).height(); } __newItems.push($(this)); });
		//		__headlineHeight += 150;
		//		$("#headlines").height(__headlineHeight);
		//		if (__newItems.length > 1) { setTimeout("__showNextNews()", 8000); }

		$("table#loads").tablesorter(
		{
			cssAsc: "headerSortUp",
			cssDesc: "headerSortDown",
			cssHeader: "header"
		});

		if (typeof (jQuery.url) != 'undefined') {

			var path = jQuery.url.attr("path").toLowerCase();

			//the default is this file ../images/layout/landing/landing_head.jpg for the janil url
			if (path.match(/\/mayil$/)) {
				$("#head.landing").css({
					background: 'transparent url(../images/layout/landing/landing_head_mayil.jpg) no-repeat scroll center bottom'
				})
			}
			else if (path.match(/\/trans$/)) {
				$("#head.landing").css({
					background: 'transparent url(/userfiles/image/landing/trans_head.jpg) no-repeat scroll center bottom'
				})
			}
		}

	}
);

	var tlc = {
		sideNav: function() {
			var sidebar = $("#sidebar");
			var loc = $("a", sidebar);
			loc.each(function(index, item) {
				var me = $(item);
				var href = me.attr("href");
				if (location.href.substr(-1 * href.length) === href) {
					me.addClass("selected");
					me.parents("ul, li").addClass("child-selected");
				}
			});
		}
	};

//function __figureMenu()
//{
//	$("#nav ul ul ul").each(
//		function()
//		{
//			if ($(this).offset().left + $(this).width() > $(window).width())
//			{
//				$(this).css( {
//					left: -1 * $(this).width()
//					});
//			}
//		}
//	);
//}

