//This will make jQuery accessible under its default alias - $ while still loading from Telerik DLL
var jQuery = window.jQuery = window.$ = $telerik.$;

//SUCKER MENU//
sfHover = function() {
    var sfEls = document.getElementById("menuDrop").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);

//'*******************************************************************************
//'Function:      GetNewPage
//'Description:   automatically loads page from a dropdown SELECT list
//'*******************************************************************************

function getNewPage(form) {
	var f = form.urlList;
	var selectedUrl = f.options[f.selectedIndex].value;
	return location.href = selectedUrl;
}

//'*******************************************************************************
//'Function:      LaunchExternal
//'Parameters:    strURL
//'Return:
//'Description:   function to launch a new window set to a specific size
//
//'Parameters:    strURL,strName,intMenubar,intToolbar,intLocation,
//'               intDirectories,intStatus,intScrollbars,intResizable,
//'               intWidth,intHeight
//'*******************************************************************************

function LaunchExternal(strURL,width,height)
{
   if(width==null)
   {
   width=750;
   }
   
   if(height==null)
   {
   height=525;
   }
   NewWindow(strURL,'',0,0,0,0,1,1,1,width,height);
}

//'*******************************************************************************
//'Function:      NewWindow
//'Parameters:    strURL,strName,intMenubar,intToolbar,intLocation,
//'               intDirectories,intStatus,intScrollbars,intResizable,
//'               intWidth,intHeight
//'Return:
//'Description:   function to launch a new window set to specific parameters
//'*******************************************************************************

function NewWindow(strURL,intWidth,intHeight,strName,intMenubar,intToolbar,intLocation,intDirectories,intStatus,intScrollbars,intResizable)
{
   var objNewWindow;
   if (strURL == '' && strName == 'print')
   {  
		strURL = window.location + "&Print=True";
   }
   
   if (strURL == '' && strName == 'print2')
   {  
		strURL = window.location + "?Print=True";
   }
   var strParameters
   strParameters = 'menubar=' + intMenubar;
   strParameters += ',toolbar=' + intToolbar;
   strParameters += ',location=' + intLocation;
   strParameters += ',directories=' + intDirectories;
   strParameters += ',status=' + intStatus;
   strParameters += ',scrollbars=' + intScrollbars;
   strParameters += ',resizable=' + intResizable;
   strParameters += ',width=' + intWidth;
   strParameters += ',height=' + intHeight;
   strParameters += ',screenX=' + 10;
   strParameters += ',screenY=' + 10;
   strParameters += ',left=' + 10;
   strParameters += ',top=' + 10;
   objNewWindow = window.open(strURL,strName,strParameters);
   objNewWindow.focus();
}

//'*******************************************************************************
//'Function:      MultilineCount
//'Return:
//'Description:   function to count chars for textbox in multiline mode
//'*******************************************************************************

function MultilineCount(text,long,msg) 

{
	var maxlength = new Number(long); // Change number to your max length.
	var alertMsg= new String(alertMsg);
	
	if (msg == null) // if alertMsg wasn't passed in use generic msg
	{
		alertMsg = "Maximum length";
	}
	else
	{
		alertMsg = msg;
	}

	if (text.value.length > maxlength){

		text.value = text.value.substring(0,maxlength);
		alert(" " + alertMsg + " [" + long + "]");
	}
}

