﻿//------------------------------------------------
function Global_Call_ManageOU()
{
	var args = new Function();
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Membership/ManageOU/default.htm?forcessl=y";
	if (window.showModalDialog(url, args, 'dialogWidth:850px; dialogHeight:580px; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
	}
}
//------------------------------------------------
function Global_Call_ManageRoles()
{
	var args = new Function();
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Membership/ManageRoles/default.htm?forcessl=y";
	if (window.showModalDialog(url, args, 'dialogWidth:850px; dialogHeight:580px; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
	}
}
//------------------------------------------------
function Global_ChangeMode(clientID,mode)
{
	document.getElementById(clientID+"_hidCommand").value	= mode;
	eval( document.getElementById(clientID+"_lbCommand").href );
}
//------------------------------------------------
function Global_ResetPersonalization(clientID)
{
	if (confirm("You are about to resume all your personalized changes " + 
		"you've made so far under content (webparts, text) and layout on this page. " + 
		"Do you want to proceed and reset all personalizations?"))
	{
		document.getElementById(clientID+"_hidCommand").value	= "ResetPersonalization";
		eval( document.getElementById(clientID+"_lbCommand").href );
	}
}
//------------------------------------------------
function Global_RunAs(clientID)
{
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Panels/SelectPrincipal/default.htm?forcessl=y";
	var args = new Function();
	args.Mode = "OnlyUser";
	args.SiteScope = "AllSites";
	args.SelectionMode = "single";
	if (window.showModalDialog(url, args, 'dialogWidth:700px; dialogHeight:500px; center:yes; edge:raised; scroll:no; status:no;'))
	{
		document.getElementById(clientID+"_hidCommand").value = "RunAs";
		document.getElementById(clientID+"_hidValue").value = args.xRoot.selectSingleNode("I").getAttribute("id");
		eval( document.getElementById(clientID+"_lbCommand").href );
	}
}
//------------------------------------------------
function Global_RestoreUser(clientID)
{
	if (confirm("Do you want to restore original user's credentials?"))
	{
		document.getElementById(clientID+"_hidCommand").value = "RestoreUser";
		eval( document.getElementById(clientID+"_lbCommand").href );
	}
}
//------------------------------------------------
function Global_ChangePassword(returnUrl)
{
	window.location = "/Login_ChangePassword.aspx?forcessl=y&ReturnUrl=" + returnUrl;
}
//------------------------------------------------
function Global_DesignPage(clientID,siteID,pagePath)
{
//alert(clientID + "    " + siteID + "    " + pageID);
	var args = new Function();
	args.SiteID = siteID;
	args.PagePath = pagePath;
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Panels/SiteDesigner/default.aspx?forcessl=y";
	if (window.showModalDialog(url, args, 'dialogWidth:65em; dialogHeight:55em; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
		//document.getElementById(clientID+"_hidCommand").value	= "Refresh";
		//document.getElementById(clientID+"_lbCommand").click();
	}
}
//------------------------------------------------
function Global_SiteDesigner(clientID,siteID,pagePath)
{
	var ww = window.screen.availWidth - 80;
	var hh = window.screen.availHeight - 80;
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + 
			"/Panels/SiteDesignerAJAX/default.aspx?forcessl=y&ww="+ww+"&hh="+hh+"&siteID="+siteID+"&pagePath="+pagePath;

	window.open(url, "_blank", "width="+ww+"px,height="+hh+"px,location=no,menubar=no,toolbar=no,resizable=yes");


/*
	$get(clientID+"_lModalWinCaption").innerHTML = "Site Designer";
	
	var p = document.getElementById(clientID+"_panModal");
	p.style.height = "550px";
	p.style.width = "1000px";
	var fr = document.getElementById(clientID+"_ifrModal1");
//	fr.src = "./NewItem/default.aspx?type=" + type + 
//					"&sessid=" + document.getElementById("hidSessionID").value +
//					"&selItemPath=" + document.getElementById("hidSelectedItemPath").value;
//alert(document.getElementById(clientID+"_lbCallPopup")==null);
	g_global.FireMouseEvent( document.getElementById(clientID+"_lbCallPopup"), "click");
//alert(4);
*/
/*
//alert(clientID + "    " + siteID + "    " + pageID);
	var args = new Function();
	args.SiteID = siteID;
	args.PagePath = pagePath;
	if (window.showModalDialog("/Panels/SiteDesigner/default.aspx", args, 'dialogWidth:65em; dialogHeight:55em; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
		//document.getElementById(clientID+"_hidCommand").value	= "Refresh";
		//document.getElementById(clientID+"_lbCommand").click();
	}
	*/
}
//------------------------------------------------
function Global_AskToLogout()
{
	return confirm('Do you want to logout?');
}
//------------------------------------------------
function Global_SysInfo(clientID)
{
	var args = new Function();
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Panels/SysInfo/default.htm?forcessl=y";
	if (window.showModalDialog(url, args, 'dialogWidth:780px; dialogHeight:580px; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
	}
}
//------------------------------------------------
function Global_ViewStat()
{
	var args = new Function();
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Panels/SiteStatistics/default.htm?forcessl=y";
	if (window.showModalDialog(url, args, 'dialogWidth:900px; dialogHeight:700px; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
	{
	}
}
//------------------------------------------------
function Global_SetFocus(c)
{
	try{c.click();}catch(e){}
	try{c.focus();}catch(e){}
	try{c.select();}catch(e){}
}
//------------------------------------------------
function Global_SiteExplorer(clientID,siteID,pagePath)
{
//alert(clientID + "    " + siteID + "    " + pageID);
//	var args = new Function();
//	args.SiteID = siteID;
//	args.PagePath = pagePath;
//	if (window.showModalDialog("/Panels/SiteDesigner/default.aspx", args, 'dialogWidth:65em; dialogHeight:55em; center:yes; edge:raised; resizable:yes; scroll:no; status:yes;'))
//	{
		//document.getElementById(clientID+"_hidCommand").value	= "Refresh";
		//document.getElementById(clientID+"_lbCommand").click();
//	}
}


function Global_CloneSite(clientID)
{
	var url = C_GLOBALBARIABLES.CurrentProtocolAndHost + "/Panels/CloneSite/Default.aspx" + 
		"?clientID=" + clientID +
		"&sessid=" + g_global.sessionID +
		"&forcessl=y" + 
		"&callback=Global_CloneSite_Done" + 
		"&tm=" + (new Date()).getTime();
	g_global.OpenAJAXModalWindow(clientID,url,"Clone Site",700,500);
}
function Global_CloneSite_Done(clientID, res)
{
}