function OnRegistrateClick()
{
	window.parent.DataFrame.location.replace('Registration.aspx');
	OnShowTreeClick(null);
}

function OnShowTreeClick(type)
{
	window.parent.OnShowTreeClick(type);
}

function OnSubMenuClick(path)
{
	window.parent.DataFrame.location.replace(path);
	OnShowTreeClick(null);
}

function SubmitData()
{
    var strPost = "Registrator.aspx?un=" + escape(document.getElementById('txtUserName').value) + "&pwd=" + escape(document.getElementById('txtPassword').value);
    var objHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    objHTTP.open("GET", strPost, false);
    objHTTP.send();
    var res = objHTTP.responseText;
    
    if(res==("<b>!" + String.fromCharCode(1) + "!</b>"))
    {
		window.parent.DataFrame.location.reload();
		window.parent.OnRegister(document.getElementById('txtUserName').value);
		window.document.forms["ContentForm"].submit();
		//window.parent.location.replace('BackOffice\\Default.aspx');
    }
    else if(res==("<b>!" + String.fromCharCode(2) + "!</b>"))
    {
		window.parent.DataFrame.location.reload();
		window.parent.OnRegister(document.getElementById('txtUserName').value);
		window.document.forms["ContentForm"].submit();
    }
    else
    {
		document.getElementById('txtUserName').value = res;
		document.getElementById('txtPassword').value = "";
    }
}

function OnContentClick(location)
{
	window.parent.DataFrame.location.href=location;
	OnShowTreeClick(null);
}

function OnCollapse(id)
{
	var img = document.getElementById(id + '_i');
	var menuItem = document.getElementById(id).nextSibling;
	if(img.src.split('/')[img.src.split('/').length-1]=='DownArrow.gif')
	{
		//Toggle menu item
		img.src='images\\UpArrow.gif'
		
		while(menuItem!=null && menuItem.id.split('_')[0]==id)
		{
			menuItem.style.display='block';
			menuItem = menuItem.nextSibling;
		}
	}
	else
	{
		//Collapse menu item
		img.src='images\\DownArrow.gif'

		while(menuItem!=null && menuItem.id.split('_')[0]==id)
		{
			menuItem.style.display='none';
			menuItem = menuItem.nextSibling;
		}
	}

	ChangeHeight();
}

function ChangeHeight()
{
	window.parent.ContentFrame.frameElement.style.pixelHeight = document.getElementById('contentTable').scrollHeight;
}

function OnOpenClick(path,height,width)
{
	window.open(path,'','status=no, scrollbars=yes, resizable=yes');
}
