var page_not_details = true;

$(function(){

	var msie = false;
	
	$('#inline').mouseover(
		
		function(){
			$('#add_to_cal_popup').fadeIn(0)
		}	
	
	);
	
	function hoverUP(){
		$('#add_to_cal_popup').fadeIn(0)
	}
	
	function hoverDown(){
	
		$('#add_to_cal_popup').animate({opacity: 1.0}, 300).fadeOut(0);
	}
	
	$('#inline').bind("mouseover", hoverUP);
	$('#inline').bind("mouseout", hoverDown);
	
	$('#add_to_cal_popup').hover(
		
		function()
			{
			$('#add_to_cal_popup').fadeIn(0);
			},
		hoverDown
		
	);    

    jQuery.each(jQuery.browser, function(i) {
     if(($.browser.version == "6.0") && ($.browser.msie)){
     
     msie = true;
     
     }

    });

	$('html').addClass('page_not_details');

	$("#categories_ul li").hover(
		
		function() {
			$(this).addClass("over");
		}, 
		
		function() {
			$(this).removeClass("over");
		}
		
	
		);
	
	
	$("div.content_node").hover(
		
		function() {
				
				if(page_not_details)
				{
				
			$(this).addClass("hover");
			
			}
		},
		
		function() {
			$(this).removeClass("hover");
			
		}
		
		);
		
		Date.format = 'dd-mmm-yy';
		
		$(function()
		{
			$('.date-pick').datePicker({clickInput:true})
			
			$('#from_input').bind(
				'dpClosed',
				function(e, selectedDates)
				{
					var d = selectedDates[0];
					if (d) {
						d = new Date(d);
						$('#end-date').dpSetStartDate(d.addDays(1).asString());
					}
				}
			);
			$('#to_input').bind(
				'dpClosed',
				function(e, selectedDates)
				{
					var d = selectedDates[0];
					if (d) {
						d = new Date(d);
						$('#start-date').dpSetEndDate(d.addDays(-1).asString());
					}
				}
			);
		});

		
		$('#change_journal').hover(
			
		function(){
			$('ul.sub.wide, ul.sub.wide table').css('display', 'block');
			
		},
		
		function(){
			$('ul.sub.wide, ul.sub.wide table').css('display', 'none');
		}
			
		);
		
	$('ul.sub.wide').hover(
		 
			function(){
				$('ul.sub.wide, ul.sub.wide table').css('display', 'block');

			},
			
			function(){
				$('ul.sub.wide, ul.sub.wide table').css('display', 'none');
			}
			
		);
	
	if(loginShow == true)
	{
		$('#floating_login_form').show();
	}
	
	$('#login_conferences').click(
		
		function(){
			$('#floating_login_form').fadeIn(200);
			return false;
		}		
	);
	
	$('#close_login').click(
	
		function(){
			$('#floating_login_form').fadeOut(200);
			return false;
		}	
		
	);
	
	var footer_width_to_divide = $('#container_1_footer').width();
	$('#container_1_footer h4').css('padding-left', (footer_width_to_divide / 2) - (391 /2));
	
	$(window).resize(
		function(){
			
			var footer_width_to_divide = $('#container_1_footer').width();
			$('#container_1_footer h4').animate({paddingLeft: (footer_width_to_divide /2) - (391 /2)});
	}
	);
	

});

/* SCC UI Redesign : CPPE 145: Refine filters and Are you Going widget*/
$(document).ready(function() {
								
if ($('#showRefineSearch').val() == 'true')
		 {
    		$('#searchcalendar').show();
			$('#hiderefineresults').show();
			$('#refineresults').hide();
			$('#showRefineSearch').val('true');
 		 }

		 $('#refineresults').click(function() {
    		$('#searchcalendar').show();
			$('#hiderefineresults').show();
			$('#refineresults').hide();
			$('#showRefineSearch').val('true');
 		 });
	
 		 
  		 $('#hiderefineresults').click(function() {
    		$('#searchcalendar').hide();
			$('#refineresults').show();
			$('#hiderefineresults').hide();
			$('#showRefineSearch').val('false');
 		 });
 		 
		 $('.areyougoingbutton').click(function(e) {
			thisnum = this.id.split('_');
    		$('#Choices_'+thisnum[1]).show();
 			e.stopPropagation();
 		 });

		$(document).click(function() {
			$('.areyougoingchoices').hide();
		});
		
 		$('.areyougoingchoices').click(function() {
			$('.areyougoingchoices').hide();
		});

	 });

$(document).ready(function(){
	$(".expander a").hover(
			function(){
				var tabId = $(this).attr("id");
				thissubtab = $("#"+tabId+"SubTab").show();
				thisoffset = $(this).offset();
				thissubtab.css("left",thisoffset.left);
				thissubtab.css("top",thisoffset.top + 20);
				if(document.getElementById(tabId+"SubTab")){
					document.getElementById(tabId+"SubTab").style.display = 'block';
				}
			},
			function(){
				var tabId = $(this).attr("id");
				$("#"+tabId+"SubTab").hide();
			});
	$(".globalsubtab").hover(
			function(){
				$(this).show();
			},
			function(){
				$(this).hide();
			});
});
