﻿function gridviewSynhronizeHeight(gridView, gridParentControl) {

	var rootTable = gridView.GetRootTable();
	var scrollDiv = gridView.getScrollableControl();

	if (IsNullOrUndefined(gridParentControl) || IsNullOrUndefined(rootTable) || IsNullOrUndefined(scrollDiv)) return;
	
	var height = (scrollDiv.offsetHeight + (gridParentControl.clientHeight - rootTable.offsetHeight));

	gridView.SetHeight(height);
}

function OnMainSplitterResized(s, e) {

	if ( window.ImplHandleMainSplitterResized ) {
		ImplHandleMainSplitterResized(s, e);
	}
	
	/*
	var height = e.pane.GetClientHeight();
	var name = e.pane.name;

	if (name == 'NavBarSplitterPane') {
		if (window.NavBarSplitterPane_SetHeight) {
			NavBarSplitterPane_SetHeight(height - 6 * 26);
		}
	}

	if (name == 'MainContentSplitterPane') {
		if (window.MainRightControl_ResizeContent) {
			MainRightControl_ResizeContent(MainRightControl_ResizeContent - 160);
		}
	}*/
}

function OnMainSplitterInit(s, e) {
	if (window.ImplHandleMainSplitterInit) {
		ImplHandleMainSplitterInit(s, e);
	}

	/*
	var pane = MS.GetPaneByName("NavBarSplitterPane");
	if (window.NavBarSplitterPane_SetWidth) {
	NavBarSplitterPane_SetWidth(pane);
	}
	*/
}

function IsNullOrUndefined(control) {
	if (control == null) {
		return true;
	}
	if (typeof control == "undefined") {
		return true;
	}
	return false;
}

function ExistASPxClientControl(editorClientId) {
	var control = ASPxClientControl.GetControlCollection().GetByName(editorClientId);
	return !IsNullOrUndefined(control);
}

document.getElementsByClassName = function (cl) {
	var retnode = [];
	var myclass = new RegExp('\\b' + cl + '\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
};

var ChangeProjectIsLoaded = false;

function SuccessMessage(message) {
    $(function () {
        $.notifyBar({
            html: message,
            delay: 5000,
            cls: 'nfb-success'
        });
    });
}


	
