//*****************************************************************
// LZN JavaScript Functions
//*****************************************************************

//A method to handle the usual DropDownList and its related OtherBox and OtherPanel
//common issue.
//
function LZN_HandleOtherBoxByID2 (SourceDropDownListID) {
    var SourceDropDownList = LZN_GetElementFromDOM (SourceDropDownListID);
    var SelectedValue = LZN_GetSelectedValue (SourceDropDownList);
    
    var OtherLabelID   = SourceDropDownList.id + 'Label';   //FIXME: Should be global in both JS and C#
    var OtherTextBoxID = SourceDropDownList.id + 'TextBox'; //FIXME: Should be global in both JS and C#
    
    
    if (SelectedValue == '2') {                             //FIXME: Should be global in both JS and C#
        LZN_SetVisible (OtherLabelID, true);
        LZN_SetVisible (OtherTextBoxID, true);
        
        //Set focus on the other box
        //var OtherTextBox = LZN_GetElementFromDOM (OtherTextBoxID);
        //OtherTextBox.select();
        //OtherTextBox.focus();
    }
    else {
        LZN_SetVisible (OtherLabelID, false);
        LZN_SetVisible (OtherTextBoxID, false);
    }
}
/*
function LZN_HandleOtherBox (SourceDropDownList) {
    var OtherPanelID = SourceDropDownList.id + 'OtherPanel';
    var SelectedValue = LZN_GetSelectedValue (SourceDropDownList);
    
    if (SelectedValue == '2') { //FIXME: Should be global in both JS and C#
        LZN_SetVisible (OtherPanelID, true);
        
        var OtherBoxID = SourceDropDownList.id + 'OtherBox';
        var OtherBox = LZN_GetElementFromDOM (OtherBoxID);
        OtherBox.select();
        OtherBox.focus();
    }
    else {
        LZN_SetVisible (OtherPanelID, false);
    }
}
function LZN_HandleOtherBoxByID (SourceDropDownListID) {
    var v = LZN_GetElementFromDOM (SourceDropDownListID);
    LZN_HandleOtherBox (v);
}
*/



//A Cross Browser method to get an element from the DOM given its id
//FIXME: Check if this is truly cross browser
//
function LZN_GetElementFromDOM (id) {    
    var Element = null;
    if (document.getElementById) {
        Element = document.getElementById (id);
    }
    else if (document.all) {
        Element = document.all (id);
    }
    
    return Element;
}



//A Cross Browser method to get the Selected Value of a given DropDownList
//FIXME: Check if this is truly cross browser
//
function LZN_GetSelectedValue (DropDownList) {
    return DropDownList.options[DropDownList.selectedIndex].value;
}



//A Cross Browser method to hide/show an element
//    ElementID: The id of the gui element
//    IsVisible: A boolean indicating weither to show/hide the element
//FIXME: Check if this is truly cross browser
//
function LZN_SetVisible (ElementID, IsVisible) {
    var Element = LZN_GetElementFromDOM(ElementID);
    if (IsVisible) {
        //Element.style.visibility = 'visible';
        Element.style.display = 'inline';
    }
    else {
        //Element.style.visibility = 'hidden';
        Element.style.display = 'none';
    }
}



//A Cross Browser method to enable/disable an element
//    ElementID: The id of the gui element
//    IsVisible: A boolean indicating weither to enable/disable the element
//FIXME: Check if this is truly cross browser (No: Doesn't work in firefox for DIV elements)
//
function LZN_SetEnabled (ElementID, IsEnabled) {
    var Element = LZN_GetElementFromDOM(ElementID);
    if (IsEnabled) {
        Element.disabled = false;
    }
    else {
        Element.disabled = true;
    }
}



//A function that helps limiting the number of characters in one
//textbox while displaying the number of remaining characters in the other.
//Mainly used when sending SMS
//FIXME: Check if this is truly cross browser
//
function LZN_LimitAndShowCount(InputBoxId, CountBoxId, Limit) {
    var InputBox = LZN_GetElementFromDOM(InputBoxId);
    var CountBox = LZN_GetElementFromDOM(CountBoxId);
    
    var MsgLen = Limit - InputBox.value.length;
    CountBox.value = MsgLen;

    if (CountBox.value < 0) {	
        InputBox.value = InputBox.value.substring (0, Limit);
	    CountBox.value = 0;
    }
}










//*****************************************************************
// LZN JavaScript Functions END
//*****************************************************************











//**********************************************
// LZN_Tasksheet Module Functions
//**********************************************


function calc1(){ 
    one = LZN_GetElementFromDOM(hmon11).value;
    two = LZN_GetElementFromDOM(htues11).value;
    three = LZN_GetElementFromDOM(hwed11).value;
    four = LZN_GetElementFromDOM(hthurs11).value;
    five = LZN_GetElementFromDOM(hfri11).value;
    six = LZN_GetElementFromDOM(hsat11).value;
    seven = LZN_GetElementFromDOM(hsun11).value;
    LZN_GetElementFromDOM(htotal11).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}
 

function calc2(){ 
    one = LZN_GetElementFromDOM(hmon22).value;
    two = LZN_GetElementFromDOM(htues22).value;
    three = LZN_GetElementFromDOM(hwed22).value;
    four = LZN_GetElementFromDOM(hthurs22).value;
    five = LZN_GetElementFromDOM(hfri22).value;
    six = LZN_GetElementFromDOM(hsat22).value;
    seven = LZN_GetElementFromDOM(hsun22).value;
    LZN_GetElementFromDOM(htotal22).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc3(){ 
    one = LZN_GetElementFromDOM(hmon33).value;
    two = LZN_GetElementFromDOM(htues33).value;
    three = LZN_GetElementFromDOM(hwed33).value;
    four = LZN_GetElementFromDOM(hthurs33).value;
    five = LZN_GetElementFromDOM(hfri33).value;
    six = LZN_GetElementFromDOM(hsat33).value;
    seven = LZN_GetElementFromDOM(hsun33).value;
    LZN_GetElementFromDOM(htotal33).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc4(){ 
    one = LZN_GetElementFromDOM(hmon44).value;
    two = LZN_GetElementFromDOM(htues44).value;
    three = LZN_GetElementFromDOM(hwed44).value;
    four = LZN_GetElementFromDOM(hthurs44).value;
    five = LZN_GetElementFromDOM(hfri44).value;
    six = LZN_GetElementFromDOM(hsat44).value;
    seven = LZN_GetElementFromDOM(hsun44).value;
    LZN_GetElementFromDOM(htotal44).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc5(){ 
    one = LZN_GetElementFromDOM(hmon55).value;
    two = LZN_GetElementFromDOM(htues55).value;
    three = LZN_GetElementFromDOM(hwed55).value;
    four = LZN_GetElementFromDOM(hthurs55).value;
    five = LZN_GetElementFromDOM(hfri55).value;
    six = LZN_GetElementFromDOM(hsat55).value;
    seven = LZN_GetElementFromDOM(hsun55).value;
    LZN_GetElementFromDOM(htotal55).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc6(){ 
    one = LZN_GetElementFromDOM(hmon66).value;
    two = LZN_GetElementFromDOM(htues66).value;
    three = LZN_GetElementFromDOM(hwed66).value;
    four = LZN_GetElementFromDOM(hthurs66).value;
    five = LZN_GetElementFromDOM(hfri66).value;
    six = LZN_GetElementFromDOM(hsat66).value;
    seven = LZN_GetElementFromDOM(hsun66).value;
    LZN_GetElementFromDOM(htotal66).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc7(){ 
    one = LZN_GetElementFromDOM(hmon77).value;
    two = LZN_GetElementFromDOM(htues77).value;
    three = LZN_GetElementFromDOM(hwed77).value;
    four = LZN_GetElementFromDOM(hthurs77).value;
    five = LZN_GetElementFromDOM(hfri77).value;
    six = LZN_GetElementFromDOM(hsat77).value;
    seven = LZN_GetElementFromDOM(hsun77).value;
    LZN_GetElementFromDOM(htotal77).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc8(){ 
    one = LZN_GetElementFromDOM(hmon88).value;
    two = LZN_GetElementFromDOM(htues88).value;
    three = LZN_GetElementFromDOM(hwed88).value;
    four = LZN_GetElementFromDOM(hthurs88).value;
    five = LZN_GetElementFromDOM(hfri88).value;
    six = LZN_GetElementFromDOM(hsat88).value;
    seven = LZN_GetElementFromDOM(hsun88).value;
    LZN_GetElementFromDOM(htotal88).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc9(){ 
    one = LZN_GetElementFromDOM(hmon99).value;
    two = LZN_GetElementFromDOM(htues99).value;
    three = LZN_GetElementFromDOM(hwed99).value;
    four = LZN_GetElementFromDOM(hthurs99).value;
    five = LZN_GetElementFromDOM(hfri99).value;
    six = LZN_GetElementFromDOM(hsat99).value;
    seven = LZN_GetElementFromDOM(hsun99).value;
    LZN_GetElementFromDOM(htotal99).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}

function calc10(){ 
    one = LZN_GetElementFromDOM(hmon110).value;
    two = LZN_GetElementFromDOM(htues110).value;
    three = LZN_GetElementFromDOM(hwed110).value;
    four = LZN_GetElementFromDOM(hthurs110).value;
    five = LZN_GetElementFromDOM(hfri110).value;
    six = LZN_GetElementFromDOM(hsat110).value;
    seven = LZN_GetElementFromDOM(hsun110).value;
    LZN_GetElementFromDOM(htotal110).value = (one * 1) + (two * 1) + (three * 1) + (four 
		* 1) + (five * 1) + (six * 1) + (seven * 1); 
}







function addTask() {
    var count1_v = LZN_GetElementFromDOM(count1);
    i = count1_v.value;
    i++;
    count1_v.value = i;
    
    var t = table;
    t = t + i;
    LZN_SetVisible(t, true);

    return false;
}









//**********************************************
// LZN_Tasksheet Module Functions END
//**********************************************














//General
//for example: instead of each module writing out script found in moduleMaxMin_OnClick have the functionality cached
//

var DNN_COL_DELIMITER = String.fromCharCode(16);
var DNN_ROW_DELIMITER = String.fromCharCode(15);
var __dnn_m_bPageLoaded = false;

window.onload = __dnn_Page_OnLoad;

function __dnn_ClientAPIEnabled()
{
	return typeof(dnn) != 'undefined';
}


function __dnn_Page_OnLoad()
{
	if (__dnn_ClientAPIEnabled())
	{
		var sLoadHandlers = dnn.getVar('__dnn_pageload');
		if (sLoadHandlers != null)
			eval(sLoadHandlers);
		
		dnn.dom.attachEvent(window, 'onscroll', __dnn_bodyscroll);
	}
	__dnn_m_bPageLoaded = true;
}

function __dnn_KeyDown(iKeyCode, sFunc, e)
{
	if (e == null)
		e = window.event;

	if (e.keyCode == iKeyCode)
	{
		eval(unescape(sFunc));
		return false;
	}
}

function __dnn_bodyscroll() 
{
	var oF=document.forms[0];	
	if (__dnn_ClientAPIEnabled() && __dnn_m_bPageLoaded)
		oF.ScrollTop.value=document.documentElement.scrollTop ? document.documentElement.scrollTop : dnn.dom.getByTagName("body")[0].scrollTop;
}

function __dnn_setScrollTop(iTop)
{
	if (__dnn_ClientAPIEnabled())
	{
		if (iTop == null)
			iTop = document.forms[0].ScrollTop.value;
	
		var sID = dnn.getVar('ScrollToControl');
		if (sID != null && sID.length > 0)
		{
			var oCtl = dnn.dom.getById(sID);
			if (oCtl != null)
			{
				iTop = dnn.dom.positioning.elementTop(oCtl);
				dnn.setVar('ScrollToControl', '');
			}
		}
		window.scrollTo(0, iTop);
	}
}

//Focus logic
function __dnn_SetInitialFocus(sID)
{
	var oCtl = dnn.dom.getById(sID);	
	if (oCtl != null && __dnn_CanReceiveFocus(oCtl))
		oCtl.focus();
}	

function __dnn_CanReceiveFocus(e)
{
	//probably should call getComputedStyle for classes that cause item to be hidden
	if (e.style.display != 'none' && e.tabIndex > -1 && e.disabled == false && e.style.visible != 'hidden')
	{
		var eParent = e.parentElement;
		while (eParent != null && eParent.tagName != 'BODY')
		{
			if (eParent.style.display == 'none' || eParent.disabled || eParent.style.visible == 'hidden')
				return false;
			eParent = eParent.parentElement;
		}
		return true;
	}
	else
		return false;
}

//Max/Min Script
function __dnn_ContainerMaxMin_OnClick(oLnk, sContentID)
{
	var oContent = dnn.dom.getById(sContentID);
	if (oContent != null)
	{
		var oBtn = oLnk.childNodes[0];
		var sContainerID = oLnk.getAttribute('containerid');
		var sCookieID = oLnk.getAttribute('cookieid');
		var sCurrentFile = oBtn.src.toLowerCase().substr(oBtn.src.lastIndexOf('/'));
		var sMaxFile;
		var sMaxIcon;
		var sMinIcon;

		if (dnn.getVar('min_icon_' + sContainerID))
			sMinIcon = dnn.getVar('min_icon_' + sContainerID);
		else
			sMinIcon = dnn.getVar('min_icon');

		if (dnn.getVar('max_icon_' + sContainerID))
			sMaxIcon = dnn.getVar('max_icon_' + sContainerID);
		else
			sMaxIcon = dnn.getVar('max_icon');

		sMaxFile = sMaxIcon.toLowerCase().substr(sMaxIcon.lastIndexOf('/'));

		var iNum = 5;
		if (oLnk.getAttribute('animf') != null)
			iNum = new Number(oLnk.getAttribute('animf'));
			
		if (sCurrentFile == sMaxFile)
		{
			oBtn.src = sMinIcon;				
			//oContent.style.display = '';
			dnn.dom.expandElement(oContent, iNum);
			oBtn.title = dnn.getVar('min_text');
			if (sCookieID != null)
			{
				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
					dnn.dom.setCookie(sCookieID, 'true', 365);
				else
					dnn.dom.deleteCookie(sCookieID);
			}
			else
				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'true');
		}
		else
		{
			oBtn.src = sMaxIcon;				
			//oContent.style.display = 'none';
			dnn.dom.collapseElement(oContent, iNum);
			oBtn.title = dnn.getVar('max_text');
			if (sCookieID != null)
			{
				if (dnn.getVar('__dnn_' + sContainerID + ':defminimized') == 'true')
					dnn.dom.deleteCookie(sCookieID);
				else
					dnn.dom.setCookie(sCookieID, 'false', 365);				
			}
			else
				dnn.setVar('__dnn_' + sContainerID + '_Visible', 'false');			
		}
		
		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

function __dnn_Help_OnClick(sHelpID)
{
	var oHelp = dnn.dom.getById(sHelpID);
	if (oHelp != null)
	{
		if (oHelp.style.display == 'none')
			oHelp.style.display = '';
		else
			oHelp.style.display = 'none';

		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

function __dnn_SectionMaxMin(oBtn, sContentID)
{
	var oContent = dnn.dom.getById(sContentID);
	if (oContent != null)
	{
		var sMaxIcon = oBtn.getAttribute('max_icon');
		var sMinIcon = oBtn.getAttribute('min_icon');
		if (oContent.style.display == 'none')
		{
			oBtn.src = sMinIcon;				
			oContent.style.display = '';
			dnn.setVar(oBtn.id + ':exp', 1);
		}
		else
		{
			oBtn.src = sMaxIcon;				
			oContent.style.display = 'none';
			dnn.setVar(oBtn.id + ':exp', 0);
		}
		return true;	//cancel postback
	}
	return false;	//failed so do postback
}

//Drag N Drop
function __dnn_enableDragDrop()
{
	var aryConts = dnn.getVar('__dnn_dragDrop').split(";");	
	var aryTitles;

	for (var i=0; i < aryConts.length; i++)
	{
		aryTitles = aryConts[i].split(" ");
		if (aryTitles[0].length > 0)
		{			
			var oCtr = dnn.dom.getById(aryTitles[0]);
			var oTitle = dnn.dom.getById(aryTitles[1]);
			if (oCtr != null && oTitle != null)
			{
				oCtr.setAttribute('moduleid', aryTitles[2]);
				dnn.dom.positioning.enableDragAndDrop(oCtr, oTitle, '__dnn_dragComplete()', '__dnn_dragOver()');
			}	
		}
	}
}

var __dnn_oPrevSelPane;
var __dnn_oPrevSelModule;
var __dnn_dragEventCount=0;
function __dnn_dragOver()
{
	__dnn_dragEventCount++;
	if (__dnn_dragEventCount % 75 != 0)	//only calculate position every 75 events
		return;
	
	var oCont = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);

	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
		
	if (__dnn_oPrevSelPane != null)	//reset previous pane's border
		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;

	if (oPane != null)
	{		
		__dnn_oPrevSelPane = oPane;
		oPane.pane.style.border = '4px double ' + DNN_HIGHLIGHT_COLOR;
		var iIndex = __dnn_getPaneControlIndex(oCont, oPane);

		var oPrevCtl;
		var oNextCtl;
		for (var i=0; i<oPane.controls.length; i++)
		{
			if (iIndex > i && oPane.controls[i].id != oCont.id)
				oPrevCtl = oPane.controls[i];
			if (iIndex <= i && oPane.controls[i].id != oCont.id)
			{
				oNextCtl = oPane.controls[i];
				break;
			}
		}			
		
		if (__dnn_oPrevSelModule != null)
			dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
			

		if (oNextCtl != null)
		{
			__dnn_oPrevSelModule = oNextCtl;
			dnn.dom.getNonTextNode(oNextCtl.control).style.borderTop = '5px groove ' + DNN_HIGHLIGHT_COLOR;
		}
		else if (oPrevCtl != null)
		{
			__dnn_oPrevSelModule = oPrevCtl;
			dnn.dom.getNonTextNode(oPrevCtl.control).style.borderBottom = '5px groove ' + DNN_HIGHLIGHT_COLOR;
		}
	}
}

function __dnn_dragComplete()
{
	var oCtl = dnn.dom.getById(dnn.dom.positioning.dragCtr.contID);
	var sModuleID = oCtl.getAttribute('moduleid');
	
	if (__dnn_oPrevSelPane != null)
		__dnn_oPrevSelPane.pane.style.border = __dnn_oPrevSelPane.origBorder;

	if (__dnn_oPrevSelModule != null)
		dnn.dom.getNonTextNode(__dnn_oPrevSelModule.control).style.border = __dnn_oPrevSelModule.origBorder;
		
	var oPane = __dnn_getMostSelectedPane(dnn.dom.positioning.dragCtr);
	var iIndex;
	if (oPane == null)
	{
		var oPanes = __dnn_Panes();
		for (var i=0; i<oPanes.length; i++)
		{
			if (oPanes[i].id == oCtl.parentNode.id)
				oPane = oPanes[i];
		}
	}	
	if (oPane != null)
	{
		iIndex = __dnn_getPaneControlIndex(oCtl, oPane);
		__dnn_MoveToPane(oPane, oCtl, iIndex);

		dnn.callPostBack('MoveToPane', 'moduleid=' + sModuleID, 'pane=' + oPane.paneName, 'order=' + iIndex * 2); 
	}
}

function __dnn_MoveToPane(oPane, oCtl, iIndex)
{

	if (oPane != null)
	{
		var aryCtls = new Array();
		for (var i=iIndex; i<oPane.controls.length; i++)
		{
			if (oPane.controls[i].control.id != oCtl.id)
				aryCtls[aryCtls.length] = oPane.controls[i].control;

			dnn.dom.removeChild(oPane.controls[i].control);
		}
		dnn.dom.appendChild(oPane.pane, oCtl);
		oCtl.style.top=0;
		oCtl.style.left=0;
		oCtl.style.position = 'relative';
		for (var i=0; i<aryCtls.length; i++)
		{
			dnn.dom.appendChild(oPane.pane, aryCtls[i]);
		}
		__dnn_RefreshPanes();
	}
	else
	{
		oCtl.style.top=0;
		oCtl.style.left=0;
		oCtl.style.position = 'relative';
	}
}

function __dnn_RefreshPanes()
{
	var aryPanes = dnn.getVar('__dnn_Panes').split(';');
	var aryPaneNames = dnn.getVar('__dnn_PaneNames').split(';');
	__dnn_m_aryPanes = new Array();
	for (var i=0; i<aryPanes.length; i++)
	{
		if (aryPanes[i].length > 0)
			__dnn_m_aryPanes[__dnn_m_aryPanes.length] = new __dnn_Pane(dnn.dom.getById(aryPanes[i]), aryPaneNames[i]);
	}
}

var __dnn_m_aryPanes;
var __dnn_m_aryModules;
function __dnn_Panes()
{
	if (__dnn_m_aryPanes == null)
	{
		__dnn_m_aryPanes = new Array();
		__dnn_RefreshPanes();
	}
	return __dnn_m_aryPanes;
}

function __dnn_Modules(sModuleID)
{
	if (__dnn_m_aryModules == null)
		__dnn_RefreshPanes();
	
	return __dnn_m_aryModules[sModuleID];
}

function __dnn_getMostSelectedPane(oContent)
{
	var oCDims = new dnn.dom.positioning.dims(oContent);
	var iTopScore=0;
	var iScore;
	var oTopPane;
	for (var i=0; i<__dnn_Panes().length; i++)
	{
		var oPane = __dnn_Panes()[i];
		var oPDims = new dnn.dom.positioning.dims(oPane.pane);
		iScore = dnn.dom.positioning.elementOverlapScore(oPDims, oCDims);
		
		if (iScore > iTopScore)
		{
			iTopScore = iScore;
			oTopPane = oPane;
		}
	}
	return oTopPane;
}

function __dnn_getPaneControlIndex(oContent, oPane)
{
	if (oPane == null)
		return;
	var oCDims = new dnn.dom.positioning.dims(oContent);
	var oCtl;
	if (oPane.controls.length == 0)
		return 0;
	for (var i=0; i<oPane.controls.length; i++)
	{
		oCtl = oPane.controls[i];
		var oIDims = new dnn.dom.positioning.dims(oCtl.control);
		if (oCDims.t < oIDims.t)
			return oCtl.index;
	}
	if (oCtl != null)
		return oCtl.index+1;
	else
		return 0;
}

//Objects
function __dnn_Pane(ctl, sPaneName)
{
	this.pane = ctl;
	this.id = ctl.id;
	this.controls = new Array();
	this.origBorder = ctl.style.border;
	this.paneName = sPaneName;
	
	var iIndex = 0;
	var strModuleOrder='';
	for (var i=0; i<ctl.childNodes.length; i++)
	{
		var oNode = ctl.childNodes[i];
		if (dnn.dom.isNonTextNode(oNode))	
		{
			if (__dnn_m_aryModules == null)
				__dnn_m_aryModules = new Array();

			//if (oNode.tagName == 'A' && oNode.childNodes.length > 0)
			//	oNode = oNode.childNodes[0];	//DNN now embeds anchor tag 
				
			var sModuleID = oNode.getAttribute('moduleid');
			if (sModuleID != null && sModuleID.length > 0)
			{
				strModuleOrder += sModuleID + '~';
				this.controls[this.controls.length] = new __dnn_PaneControl(oNode, iIndex);
				__dnn_m_aryModules[sModuleID] = oNode.id;
				iIndex+=1;
			}
		}
	}
	this.moduleOrder = strModuleOrder;

}

function __dnn_PaneControl(ctl, iIndex)
{
	this.control = ctl;
	this.id = ctl.id;
	this.index = iIndex;
	this.origBorder = ctl.style.border;
	
}

/*
function __dnn_TableRowReorder(ctl, bUp, sKey)
{
	var oTR;
	var oPTR;
	var oP = ctl.parentNode;

	while (oP != null)
	{
		if  (oP.tagName.toLowerCase() == 'tr')
		{
			oTR = oP;
			break;
		}		
		oP = oP.parentNode;
	}
	if (oTR != null)
	{
		oPTR = oTR.parentNode;
		var iIndex = oTR.rowIndex;
		if (oTR.getAttribute('origidx') == '-1')
			__dnn_TableRowSetOrigIndex(oPTR);

		var iNextIdx;
		if (bUp)
			iNextIdx = __dnn_TableRowGetPrevNodeIdx(oPTR, iIndex-1);
		else
			iNextIdx = __dnn_TableRowGetNextNodeIdx(oPTR, iIndex+1);
		if (iNextIdx > -1)
		{
			dnn.dom.removeChild(oTR);
			if (oPTR.childNodes.length > iNextIdx)
				oPTR.insertBefore(oTR, oPTR.childNodes(iNextIdx));
			else
				oPTR.appendChild(oTR);
			
			dnn.setVar(sKey,__dnn_GetTableRowOrder(oPTR));
		}
		return true;//handled
	}
}

function __dnn_TableRowGetNextNodeIdx(oParent, iStartIndex)
{
	for (var i=iStartIndex; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
			return i;
	}
	return -1;
}

function __dnn_TableRowGetPrevNodeIdx(oParent, iStartIndex)
{
	for (var i=iStartIndex; i>=0; i--)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
			return i;
	}
	return -1;
}

function __dnn_TableRowSetOrigIndex(oParent)
{
	var iIdx=0;
	for (var i=0; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		if (oCtl.getAttribute('origidx'))
		{
			oCtl.setAttribute('origidx', iIdx.toString());
			iIdx++;
		}
	}
}

function __dnn_GetTableRowOrder(oParent)
{
	var sIdx;
	var sRet='';
	for (var i=0; i<oParent.childNodes.length; i++)
	{
		var oCtl = oParent.childNodes(i);
		sIdx = oCtl.getAttribute('origidx');
		if (sIdx)
			sRet+= (sRet.length>0 ? ',':'') + sIdx;
	}
	return sRet;
}
*/
