/*Button Code in OU <a id="de" href="^0">&copy;</a>*/
function directedit() {
	if(document.getElementById("de") != null && document.getElementById("directedit")) {
		var link = document.getElementById("de").parentNode.innerHTML;
		document.getElementById("de").parentNode.innerHTML = "";
		document.getElementById("directedit").innerHTML = link;
	}
}
window.onload = function() {
	directedit()
};
//jQuery option, if available..
$(document).ready(function () {
   // $("#directedit").html(jQuery("#de"));
	$("#vaxStatus").click(function(){
	$('#vaxiFrame').css("display","block");
});
	$("#closeVaxAttest").click(function(){
	$('#vaxiFrame').css("display","none");
});
	
	
	$(document).ready(function () {
		/*
		
		if(window.location.href == 'https://www.shoreline.edu/'){
			$('.header-alert.alert.alert-unstyled.bg-secondary ').css('display','none');
		}
		*/
		
		
   // $("#directedit").html(jQuery("#de"));
		
	$(".accordion-card .collapse.show .accordion  .accordion-header").click(function(){

        var collapseId =  $(this).closest(".collapse").attr("id");
        var idselector = "div#"
        var queryString = idselector.concat(collapseId,".collapse.show");
        console.log(queryString);
        $(queryString).addClass("forceShow");

    
    
});	
	
	$('.keyDatesTable > tbody > tr').each(function(){
		var today = new Date();
		var dd = today.getDate();
        var mm = today.getMonth() + 1;
  
        var yyyy = today.getFullYear();
        if (dd < 10) {
            dd = '0' + dd;
        }
        if (mm < 10) {
            mm = '0' + mm;
        }
        var today = mm + '/' + dd + '/' + yyyy;
		
		var ElemStartDate = $(this).children("td").first().text();
		var ElemEndDate = $(this).children("td").eq(1).text();
		
		
		
		var Startparts = ElemStartDate.split('/');
		var myStartdate = new Date(Startparts[2], Startparts[0] - 1, Startparts[1]); 
		var Endparts = ElemEndDate.split('/');
		var myEnddate = new Date(Endparts[2], Endparts[0] - 1, Endparts[1]); 
		
		var todayDate = new Date (today);
		
		console.log("today " + todayDate.getTime());
		console.log("start date " + myStartdate.getTime());
		console.log("end date "+ myEnddate.getTime());
		
		if(myStartdate <= todayDate && todayDate < myEnddate){
			$(this).children("td").css('border-color','#d43c00');
			$(this).children("td").css('border-width','3px');
			$(this).children("td:even").css('border-bottom-style','solid');
			$(this).children("td:even").css('border-left-style','solid');
			$(this).children("td:even").css('border-top-style','solid');
			$(this).children("td:even").css('border-right-style','none');
			$(this).children("td:odd").css('border-bottom-style','solid');
			$(this).children("td:odd").css('border-right-style','solid');
			$(this).children("td:odd").css('border-top-style','solid');
			$(this).children("td:odd").css('border-left-style','none');
		}
		
	});
	
	
	
	
	
	
	
	
	$("#vaxStatus").click(function(){
	$('#vaxiFrame').css("display","block");
});
	$("#closeVaxAttest").click(function(){
	$('#vaxiFrame').css("display","none");
});
		
	$("#tutorialMobileDesktopSwitch").keydown(function(){
		 var flag = false;
  console.log(event);
  switch (event.keyCode) {
    case 32:
      handelClick();
      flag = true;
      break;
    case 13:
      handelClick();
      flag = true;
      break;
    default:
      break;
  }
  if (flag) {
    event.stopPropagation();
    event.preventDefault();
  }
		
	});
		
		
		
		
		
		
	
	$(".tutorialSectionImg > img:not(.tutorialMobileScreenshot)").hover(function(){
		$(this).parent('.tutorialSectionImg').css("display","block");
		$(this).parent('.tutorialSectionImg').css("width","100%");
		$(this).parent('.tutorialSectionImg').siblings(".tutorialSectionText").css("display","block");	
		$(this).parent('.tutorialSectionImg').siblings(".tutorialSectionText").css("width","100%");	
	});
	$(".tutorialSectionImg > img.activationScreenshot").hover(function(){
		$(this).css("width","55%");
		$(this).css("margin-left","22.5%");
		$(this).parent('.tutorialSectionImg').css("display","block");
		$(this).parent('.tutorialSectionImg').siblings(".tutorialSectionText").css("display","block");	
		$(this).parent('.tutorialSectionImg').siblings(".tutorialSectionText").css("width","100%");	
	});
	if($(window).width() <= 768){
		$('#tutorialMobileDesktopSwitch').prop("checked", true);
	}
	else{
		$('#tutorialMobileDesktopSwitch').prop("checked", false);
	}
	
	$('#tutorialMobileDesktopSwitch').change(function() {
        if(this.checked) {
			
            $(this).closest('.tutorialCont').find('.tutorialDesktopText').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialDesktopScreenshot').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialMobileText').css('display','block');
			$(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','100%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','0%');
            
			if($(window).width() >= 768){
		$(this).closest('.tutorialCont').find('.tutorialSectionImg').css("display","inline-block");
			$(this).closest('.tutorialCont').find('.tutorialSectionImg').css("width","50%");
			$(this).closest('.tutorialCont').find('.tutorialSectionText').css("display","inline-block");
			$(this).closest('.tutorialCont').find('.tutorialSectionText').css("width","40%");
				$(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','70%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','15%');
	}
			
			
        }
        else{
            $(this).closest('.tutorialCont').find('.tutorialDesktopText').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialDesktopScreenshot').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileText').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','100%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','0');
        }    
    });
	$('.tutorialMobileDesktopSwitch').change(function() {
        if(this.checked) {
			
            $(this).closest('.tutorialCont').find('.tutorialDesktopText').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialDesktopScreenshot').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialMobileText').css('display','block');
			$(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','100%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','0%');
            
			if($(window).width() >= 768){
		$(this).closest('.tutorialCont').find('.tutorialSectionImg').css("display","inline-block");
			$(this).closest('.tutorialCont').find('.tutorialSectionImg').css("width","50%");
			$(this).closest('.tutorialCont').find('.tutorialSectionText').css("display","inline-block");
			$(this).closest('.tutorialCont').find('.tutorialSectionText').css("width","40%");
				$(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','70%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','15%');
	}
			
			
        }
        else{
            $(this).closest('.tutorialCont').find('.tutorialDesktopText').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialDesktopScreenshot').css('display','block');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileText').css('display','none');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('width','100%');
            $(this).closest('.tutorialCont').find('.tutorialMobileScreenshot').css('margin-left','0');
        }    
    });
	
});
	
	
	
	
});