﻿$(document).ready(function(){
$('ul.sf-menu').superfish({ 
            delay:       0,                            // one second delay on mouseout 
              // fade-in and slide-down animation 
            speed:       0,                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false,
            hoverClass:'sfhover'                             // disable drop shadows 
        }); 

    
    
    
    
    $("img.navimages")
        .mouseover(function() { 
            var src = $(this).attr("src").match(/[^\.]+/) + "_over.gif";
            $(this).attr("src", src);
        })
        .mouseout(function() {
            var src = $(this).attr("src").replace("_over", "");
            $(this).attr("src", src);
        });
        
    var pathname = location.href.substring(location.href.lastIndexOf('/')+1);
    
    switch(pathname)
    {
        case "aboutTIF.aspx" :
        case "TIFvsTraditional.aspx" :
        case "AboutTIF.aspx" :
        case "GoodCandidate.aspx" :
        case "WhatToExpect.aspx" :
        case "ClinicalResults.aspx" :
        case "SafetyInformation.aspx" :
        case "InsuranceCoverage.aspx" :
        case "AboutFAQs.aspx" :
        
        $("#NavAboutTIF").css("background-color","#f6eade");
        
        break;
        
        case "AboutGERD.aspx" :
        case "Symptoms.aspx" :
        case "Causes.aspx" :
        case "Diagnosis.aspx" :

        $("#NavAboutGERD").css("background-color","#f6eade");
        break;
        
        case "TreatmentOptions.aspx" :
        case "LifestyleModifications.aspx" :
        case "MedicalTherapy.aspx" :
        case "AntirefluxSurgery.aspx" :
        
        $("#NavTreatment").css("background-color","#f6eade");
        break;
        
        case "PatientResources.aspx" :
        case "PatientStories.aspx" :
        case "PatientFAQs.aspx" :
        case "Questionnaire.aspx" :
        case "Questions.aspx" :
        case "OtherResources.aspx" :
        case "Glossary.aspx" :
        
        $("#NavPatient").css("background-color","#f6eade");
        break;
        
        case "MediaCoverage.aspx" :
        case "ContactUs.aspx" :
        
        $("#NavAboutUs").css("background-color","#f6eade");
        break;
        
        

    }
    $('.GlossaryTable tr:even').addClass('even');
    $('.GlossaryTable tr:odd').addClass('odd');
    $( "#ContainerBrent" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectBrent").clone();
                     $("#DivObjectBrent").remove();
                     $("#ContainerBrent").html(clone);
			    
			    }
			    
			 
			});
			
			$( "#ContainerChris" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectChris").clone();
                     $("#DivObjectChris").remove();
                     $("#ContainerChris").html(clone);
			    
			    }
			    
			 
			});
			$( "#ContainerEffie" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectEffie").clone();
                     $("#DivObjectEffie").remove();
                     $("#ContainerEffie").html(clone);
			    }
			});
			$( "#ContainerJuan" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectJuan").clone();
                     $("#DivObjectJuan").remove();
                     $("#ContainerJuan").html(clone);
			    }
			});
			$( "#ContainerErin" ).dialog({
			autoOpen: false,
			height: 545,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectErin").clone();
                     $("#DivObjectErin").remove();
                     $("#ContainerErin").html(clone);
			    }
			});
			$( "#ContainerJean" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectJean").clone();
                     $("#DivObjectJean").remove();
                     $("#ContainerJean").html(clone);
			    }
			});
			$( "#Media1" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia1").clone();
                     $("#DivObjectMedia1").remove();
                     $("#Media1").html(clone);
			    }
			});
			$( "#Media2" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia2").clone();
                     $("#DivObjectMedia2").remove();
                     $("#Media2").html(clone);
			    }
			});
			$( "#Media3" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia3").clone();
                     $("#DivObjectMedia3").remove();
                     $("#Media3").html(clone);
			    }
			});
			$( "#Media4" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia4").clone();
                     $("#DivObjectMedia4").remove();
                     $("#Media4").html(clone);
			    }
			});
			$( "#Media5" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia5").clone();
                     $("#DivObjectMedia5").remove();
                     $("#Media5").html(clone);
			    }
			});
			$( "#Media6" ).dialog({
			autoOpen: false,
			height: 500,
			width: 700,
			modal: true,
			close: function(event, ui)
			    { 
			        // Remove and re-add video
                     var clone = $("#DivObjectMedia6").clone();
                     $("#DivObjectMedia6").remove();
                     $("#Media6").html(clone);
			    }
			});
            
    // $( "#accordion" ).accordion({
	//		autoHeight: false,
	//		navigation: true
	//	});
	
	
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});


});

