// **********************************************************
//  Sitemap switcher
//  GhOUL
//  ghoul@stablebeast.com
// **********************************************************

//in case there are no opened groups initially
function openSelectSitemapBranch(id)
{
	s = document.getElementById('i_'+id).src;
	if (document.getElementById('m_'+id).style.display=="none")
	{
		document.getElementById('m_'+id).style.display="block";
		if (s.charAt(s.length-15)=='n' || s.charAt(s.length-15)=='g')
			document.getElementById('i_'+id).src="/Images/DownBranchClosingBlackMinus.gif";	
		else
			document.getElementById('i_'+id).src="/Images/DownBranchBlackMinus.gif";	
	}
	else
	{
		document.getElementById('m_'+id).style.display="none";
		if (s.charAt(s.length-15)=='n' || s.charAt(s.length-15)=='g')
			document.getElementById('i_'+id).src="/Images/DownBranchClosingBlackPlus.gif";	
		else
			document.getElementById('i_'+id).src="/Images/DownBranchBlackPlus.gif";	
	}
}
function openSitemapPopUp(args)
{
	Popup = window.open("/Smarty/SmartyComponent/SelectFromSiteMap/SiteMapPopUp.php?args="+args, 'info', 'scrollbars=no,width=350,height=550');
}
function submitToParent(id, string, name, returnLink)
{
	if (returnLink == 1)
	{
		var url = id;
		var oRegex = new Object();
		oRegex.UrlOnChangeProtocol = new RegExp('') ;
		oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi') ;
		var sProtocol = oRegex.UrlOnChangeProtocol.exec(url) ;
		if (sProtocol)		
			id = url.substr(sProtocol[0].length);		
		window.opener.document.getElementById(name).value=id;
	    window.close();
	}
	else
	{
	    window.opener.document.getElementById(name+'String').innerHTML=string;
	    window.opener.document.getElementById(name).value = id;
	    window.close();
	}
}