
//'*******************************************************************************
// DROPDOWN MENU
 sfHover = function() {
	var sfEls = document.getElementById("menu").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
			this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//'*******************************************************************************


// THESE FUNCTIONS HIDE AND UNHIDE THE FLASH FOR MODAL POPUP
function hideFlash(){
	//hide flash
	flashbox = document.getElementById('flashBox');
	flashbox.style.visibility = "hidden";
}

function showFlash(){
	//hide flash
	flashbox = document.getElementById('flashBox');
	flashbox.style.visibility = "visible";
}

//'*******************************************************************************
//'Function:      MultilineCount
//'Return:
//'Description:   function to count chars for textbox in multiline mode
//'*******************************************************************************

function MultilineCount(text,long) 

{
	var maxlength = new Number(long); // Change number to your max length.
	if (text.value.length > maxlength){

		text.value = text.value.substring(0,maxlength);
		alert(" Max length is " + long + " chars");
	}
}

//'*******************************************************************************
//'Function:      Reset .NET Maintainscrollbackposition flag
//'Description:   if maintainscrollback is set to true but you'd like to override for certain functions
// register the line below on that function:
//
// Page.ClientScript.RegisterStartupScript(Page.Clien tScript.GetType(), Page.ClientID, "resetDotNetScrollPosition();", true);
//
//'*******************************************************************************

function resetDotNetScrollPosition()
{
var scrollX = document.getElementById('__SCROLLPOSITIONX');
var scrollY = document.getElementById('__SCROLLPOSITIONY');

if(scrollX != null && scrollY != null)
{
scrollX.value = 0;
scrollY.value = 0;
}
}

//'*******************************************************************************
// Can be called from .CS file like this
// Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), Page.ClientID, "resetScroll();", true);
// OR
// RadAjaxManager.GetCurrent(Page).ResponseScripts.Add("resetScroll();");

function resetScroll() {
    window.document.body.scrollTop = 0;
    window.document.documentElement.scrollTop = 0;
}

//'*******************************************************************************
//' USED TO RESIZE RADLOADINGPANEL IF CONTENT IS BIGGER THAN VIEWPORT

function ResizeLoader(sender, args) {

    // resize
    var loadingPanel = $get("ctl00_ajaxLoading");
    var pageHeight = document.documentElement.scrollHeight;
    var viewportHeight = document.documentElement.clientHeight;

    if (pageHeight > viewportHeight) {
        loadingPanel.style.height = pageHeight + "px";
    }

    var pageWidth = document.documentElement.scrollWidth;
    var viewportWidth = document.documentElement.clientWidth;

    if (pageWidth > viewportWidth) {
        loadingPanel.style.width = pageWidth + "px";
    }

    // center bg
    if ($telerik.isSafari) {
        var scrollTopOffset = document.body.scrollTop;
        var scrollLeftOffset = document.body.scrollLeft;
    }
    else {
        var scrollTopOffset = document.documentElement.scrollTop;
        var scrollLeftOffset = document.documentElement.scrollLeft;
    }

    var loadingImageWidth = 60;
    var loadingImageHeight = 48;

    loadingPanel.style.backgroundPosition = (parseInt(scrollLeftOffset) + parseInt(viewportWidth / 2) - parseInt(loadingImageWidth / 2)) + "px " + (parseInt(scrollTopOffset) + parseInt(viewportHeight / 2.7) - parseInt(loadingImageHeight / 2.7)) + "px";
}

