var PageID = null;
var Path = null;

function Content_Load(title, pageID, path)
{
	try
	{
		CheckForFrameset();
		ChangeTitle(title);
		//ReloadNavMenu(pageID, path);
	}
	catch(e)
	{
		self.status = "Error: " + e;
	}
}

function ButtonGo_Click(sender, channel)
{
	var dds = document.getElementById("DropDownSearch");
	
	if(dds != null)
	{
		DropDownSearch_Change(dds, channel);
	}
}

function TextBoxSearchFulltext_KeyDown(sender, channel, force)
{
	if(force || event.keyCode == 13)
	{
		if(sender != null)
		{
		
			var contentFrame = GetContentFrame();
			contentFrame.location = "search.aspx?search=" + sender.value;
			//sender.value = "";
		}
	}
}

function GetContentFrame()
{
	return self.parent.frames["FrameContent"];
}

function ButtonSearchFulltext_Click(sender, clientID, channel)
{
	//alert('DRIN');
	TextBoxSearchFulltext_KeyDown(document.getElementById(clientID + "_TextBoxSearch"), channel, true);
}

function ChangeTitle(title)
{
	if(self.parent != null)
	{
		self.document.title = title;
		self.parent.document.title = title;
	}
}

function CheckForFrameset()
{
	if(self.frameElement == null)
	{
		if(self.location.href.indexOf("Content.aspx") > -1 && self.location.href.indexOf("noframes=true") == -1 && self.location.href.indexOf("editcontrol=") == -1 && self.location.href.indexOf("control=") == -1)
		{
			self.location = self.location.href.replace(/Content.aspx/, "Framework.aspx");
		}
	}
}

/*function ReloadNavMenu(pageID, path)
{
	var naviFrame = self.parent.frames["FrameNavMenu"];
		
	if(naviFrame != null)
	{
		if(naviFrame.document.readyState == "complete")
		{
			naviFrame.ReloadNavMenu(pageID, path);
		}
		else
		{
			PageID = pageID;
			Path = path;
			naviFrame.document.onreadystatechange = RetryReloadNavMenu;
		}
	}
}*/

/*function RetryReloadNavMenu()
{
	var naviFrame = self.parent.frames["FrameNavMenu"];
	
	if(naviFrame.document.readyState == "complete")
	{
		//naviFrame.ReloadNavMenu(PageID, Path);
		//alert("COMPLETE NOW " + PageID + "|" + Path);
	}
}*/

function RemoveScrollBars()
{
	if(document.body.scroll != null)
	{
		document.body.scroll = "auto";
		document.body.style.overflowX = "hidden"; // hidden | scroll | auto
		document.body.style.overflowY = "auto";
	}
	else // #### MG: It's a different Browser (NN)
	{
		document.body.attributes("-moz-scrollbars-horizontal") = "scroll";
		document.body.attributes("-moz-scrollbars-vertical") = "no";
	}
}

function OpenCustomPopUpApp(base, url, width, height, resizable, location, menubar, scrollbars, status, titlebar, toolbar)
{
	var path = base + "Apps/PopUps/Framework.aspx?url=" + escape(url);
	var options = "width=" + width + ", height=" + height + ", resizable=" + (resizable ? 1 : 0) + ", location=" + (location ? 1 : 0) + ", menubar=" + (menubar ? 1 : 0) + ", scrollbars=" + (scrollbars ? 1 : 0) + ", status=" + (status ? 1 : 0) + ", titlebar=" + (titlebar ? 1 : 0) + ", toolbar=" + (toolbar ? 1 : 0);
	var win = window.open(path, "PopUp", options);
	win.focus();
}

function jumpTo(anchor)
{
	JumpToAnchor(anchor);
}

function JumpToAnchor(anchor)
{
	window.navigate("#" + anchor);
}

function JumpTo(obj)
{
	obj.scrollIntoView();
}

function JumpToControl(controlName)
{
	document.getElementById(controlName).scrollIntoView();
}

function Druckansicht(url)
{
	//var win = window.open("Apps/PopUps/Framework.aspx?pfv=true&url=" + escape(url), "Druckansicht", "toolbar=no, width=632, height=700, directories=no, status=no, scrollbars=no, resizable=no, menubar=no");
	//win.focus();
	self.print();
}

function Redaktion(pageID)
{
	var win = window.open("Apps/PopUps/Framework.aspx?url=" + escape("Editorial.aspx?id=" + pageID), "Redaktion", "toolbar=no, width=400, height=360, directories=no, status=no, scrollbars=no, resizable=no, menubar=no");
	win.focus();
}

function lexikon()
{
	window.open('http://lexikon.products.successnet.de/koenigslutter/index.html','Lexikon','width=592,height=431,resizeable=No,screenX=10,screenY=10,location=no,menubar=no');
}