﻿
    //confirmdelete is used by calendar.aspx.cs
	<!--
	function confirmdelete(target,x) {
		var theform;
		if (confirm("Are you sure?")) {
			return true;
		}
		else { return false; }
	}
	// -->

	// manageCatSetVal used by managecat.aspx.cs - originally called just setVal
	//<!--
	function manageCatSetVal(newval,g,c) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms["Form1"];
		}
		theform.buttonpressed.value = newval;
		theform.globalval.value = g;
		theform.submit();		
	}
	// -->

	// managePendingSetVal used by managepending.aspx.cs - originally called just setVal
	<!--
	function managePendingSetVal(newval) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms["Form1"];
		}
		theform.buttonpressed.value = newval;
		theform.submit();		
	}
	// -->

	// manageUsersSetVal used by manageusers.aspx.cs - originally called just setVal
	<!--
	function manageUsersSetVal(newval) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms["Form1"];
		}
		theform.buttonpressed.value = newval;
		theform.submit();		
	}
	// -->

	// rmacreateConfirmDelete used by rmacreate.aspx.cs - originally called confirmDelete
	<!--
	function rmacreateConfirmDelete() {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms["Form1"];
		}
		if (confirm("Are you sure?")) {
			return true;
		}
		else { return false; }
	}
	// -->
	
    // this will be used to reset the scroll position to the top, 
    // this function uses the hidden inputs PageX and PageY
    // could not rectify Maintain Scroll on Postback = true with this function, 
    // will need some kind of override to accomplish this, button 
    // in TechSupportRequests disabled invisible for now
    function ScrollIt(){
        window.scrollTo(document.Form1.PageX.value, document.Form1.PageY.value);
        }

    function checkSubmit()
    {
        // _ctl0_HFSubmitForm
        // HFSubmitForm
    
        // support clientside validation - if page is not valid framework wont fire
        // postback
        if ((typeof(Page_IsValid )!="undefined")&&(Page_IsValid == false))
        {
            document.getElementById("_ctl0_HFSubmitForm.ClientID").value = 0;
            return true;
        }

        // if postback - return false
        if (document.getElementById("_ctl0_HFSubmitForm.ClientID").value == 1)
            return false;
        else
        {
            // mark that submit is to be done and return true
            document.getElementById("_ctl0_HFSubmitForm.ClientID").value = 1;
            return true;
        }
    }

    function getScreenSize()
    {
        //document.getElementById("_ctl0_screenWidth").value = screen.availWidth;
        if(navigator.appName == "Netscape")
        { 
            document.getElementById("_ctl0_screenWidth").value = window.innerWidth;
        }
        else if(navigator.appName == "Microsoft Internet Explorer")
        { 
            document.getElementById("_ctl0_screenWidth").value = document.body.clientWidth;
        } 
    }

    function ok(sender, e)
    {
        $find('mpeLogin').hide();
        __doPostBack('btnMPLoginGo', e); 
    }
    function OnKeyPress(args)
    {
        if(args.keyCode == Sys.UI.Key.esc)
        {
            $find("mpeLogin").hide();
        }
    }
    
    //Menu functions.
     $(document).ready(function(){	        
	        $('ul.AspNet-Menu').supersubs({
		        minWidth:   22,  //Sub menu minimum width
		        maxWidth:   60,  //Sub menu max width
		        extraWidth: 1,
		        autoArrows: true
		    }).superfish({delay: 300, animation: {opacity:'show'}, speed: 'fast'});

            //Test for mobile
		    $("ul.AspNet-Menu li a").click(function(e){
		        if(isMobile == true)
		        {
		            if($(this).hasClass('current'))
		            {
		                if($(this).parent().children('ul').is(':visible'))
		                {
		                    $(this).removeClass('current');
		                    $(this).parent().children('ul').hide().css('visibility','hidden');
		                    e.preventDefault();
		                }
		            }else{
		                if($(this).parent().children('ul').length > 0 )
		                {
		                    $("ul.AspNet-Menu li a").removeClass('current');
		                    $(this).addClass('current');	                    
		                    if($(this).parent().children('ul').is(':visible') == false)
		                    {
		                        $(this).parent().children('ul').show().css('visibility','visible');
		                    }
		                    e.preventDefault();		                    
		                }
		            }
		        }
		        else
		        {
		            if($(this).attr('href') == "#")
		            {
		                e.preventDefault();
		                window.location = $(this).attr("rel");
		            }
		        }
		    });
		    
		    //If IE 6.0 then we want to make some adjustments so the menus show properly.
		    if($.browser.msie && $.browser.version.slice(0,3) == "6.0")
		    {
		        //Gets the width of the UL adds 19px for each LI in the UL; this centers the menu on the page.
		        $("#menuContainer").width($('ul.AspNet-Menu').width() + ($('ul.AspNet-Menu > li').length * 35) + "px");
		        $('ul.AspNet-Menu > li').css({"width":"1%","white-space":"nowrap"});
		    }
		    else
		    {
		        //Gets the width of the UL adds 19px for each LI in the UL; this centers the menu on the page.
	            $("#menuContainer").width($('ul.AspNet-Menu').width() + ($('ul.AspNet-Menu > li').length * 33) + "px");
	        }
	        
	        //If Mobile then adjust some of the padding and font sizes.
	        if(isMobile == true)
	        {
	            $('.AspNet-Menu a').css({'font-size':'1.125em'});				
	            $('.AspNet-Menu li li a').css({'padding':'.75em .75em'});
	            $('.AspNet-Menu li li li a').css({'padding':'.75em .75em'});
		        $('.button').css({'font-size':'1.125em','padding':'7px','padding-bottom':'6px'});
		        $('.small_calendar').css({'width':'200px'});
		        $('.small_calendar td').css({'font-size':'1.75em','padding': '4px'});
		        $('.checkbox input:checkbox').css({'width':'30px','height':'30px'});
	        }
	    });

         
	    



