﻿// JScript File
$(document).ready(function () {

    //Top Nav Drop Down
      $("#top-nav-parent li").hover(
      function () {
        $(this).children(".top-nav-child").fadeIn(); 
             //last nav position
             var pos = $(this).offset();
            $("#menu_5").css({ 'position':'absolute', top: pos.top + 55 , left: pos.left - 56  }); 
      }, 
      function () {
      //alert($(this).attr("class"));
        $('.top-nav-child').hide();
      });
      $('#top-nav-parent li:first').css({'background':'none'});
      //$('#menu_4').css({'padding-left':'-50px', 'border':'1px solid red'});

    //General Tabs 
	$('#view-tabs li a').click(function() {
		if( $('#view-tabs li:last').attr('id') == $(this).parent().attr('id')) {
		    $('#view-tabs li:last').css({'background':'url(/images/tab-middle-right-btn.jpg) no-repeat top right','border-top':'none','border-right':'none'});
		}
		else
		{
    		$('#view-tabs li:last').css({'background':'url(/images/tab-middle-right-btn.jpg) no-repeat bottom right','border-top':'none','border-right':'none'});
		}
		if( $('#view-tabs li:first').attr('id') == $(this).parent().attr('id')) {
		    $('#view-tabs li:first').css({'background':'url(/images/tab-middle-left-btn.jpg) no-repeat top left','border-top':'none','border-left':'none'});
		}
		else
		{
    		$('#view-tabs li:first').css({'background':'url(/images/tab-middle-left-btn.jpg) no-repeat bottom left','border-top':'none','border-left':'none'});
		}
		//Show the content
		$('.view-tabs-content:visible').hide();
		$($(this).attr('href')).show();
		
		//Switch the active tab style
		$(this).parent().siblings('.active').removeClass('active');
		$(this).parent().addClass('active');

		return false;
	});
	
	$('#view-tabs li:first').css({'background':'url(/images/tab-middle-left-btn.jpg) no-repeat','border-top':'none','border-left':'none'});
	$('#view-tabs li:last').css({'background':'url(/images/tab-middle-right-btn.jpg) no-repeat bottom right','border-top':'none','border-right':'none'});


    //Home Tabs
	$('#home-view-tabs li a').click(function() {
		if( $('#home-view-tabs li:last').attr('id') == $(this).parent().attr('id')) {
		    $('#home-view-tabs li:last').css({'background':'url(/images/home-tab-3-btn.jpg) no-repeat top left'});
		}
		else
		{
    		$('#home-view-tabs li:last').css({'background':'url(/images/home-tab-3-btn.jpg) no-repeat bottom left'});
		}
		if( $('#home-view-tabs li:first').attr('id') == $(this).parent().attr('id')) {
		    $('#home-view-tabs li:first').css({'background':'url(/images/home-tab-1-btn.jpg) no-repeat top left'});
		}
		else
		{
    		$('#home-view-tabs li:first').css({'background':'url(/images/home-tab-1-btn.jpg) no-repeat bottom left'});
		}
		
		//Show the content
		$('.home-view-tabs-content:visible').hide();
		$($(this).attr('href')).show();
		
		//Switch the active tab style
		$(this).parent().siblings('.active').removeClass('active');
		$(this).parent().addClass('active');

		return false;
	});
	
	$('#home-view-tabs li:first').css({'background':'url(/images/home-tab-1-btn.jpg) no-repeat','border-top':'none','border-left':'none'});
	$('#home-view-tabs li:last').css({'background':'url(/images/home-tab-3-btn.jpg) no-repeat bottom left','border-top':'none','border-right':'none'});

    //Remove border from home tabs list
       $('#tab1 .home-tabs-sub-list li:last').css({'border':'none'});
       $('#tab2 .home-tabs-sub-list li:last').css({'border':'none'});
       $('#tab3 .home-tabs-sub-list li:last').css({'border':'none'});

	//alert($('#left-content').html().replace("®",""));
	//$('div').html($('div').html().replace("®",""));
	//$('.menuItem').html().replace("®","");
});

function ReadMore(moreClick)
{
     //alert(moreClick.id);
     //alert(moreClick.id.replace("Link","Tab"));
     TabReadMore = document.getElementById(moreClick.id.replace("Link","Tab"));
     TabReadMore.style.display = 'block';
     $(document.getElementById(moreClick.id)).parent().hide();
     return false;
}

function ektLocalizeDate(date, id) {
	setTimeout(function() {
	if (document.getElementById && 10 == date.length) {
		var oTempDate = new Date(date.substr(0,4), parseInt(date.substr(5,2),10)-1, date.substr(8,2));
		document.getElementById(id).innerHTML=(oTempDate.toLocaleDateString ? oTempDate.toLocaleDateString() : oTempDate.toLocaleString());
	}
	}, 1); 
}
