var b = "";
var realFooterUrl = "";
var url = document.URL;

if (url.indexOf("atomz") == -1)
{
	if (url.indexOf(".com") != -1)
	{
		if (url.indexOf(".html") != -1)
		{
			url = url.substring((url.indexOf(".com/") +5),url.indexOf(".html"));
			defineUrl();
		}
		else
			url = "#index";
	}
	else if ((url.indexOf("alon-2000") != -1) || (url.indexOf("localhost") != -1))
	{
		if (url.indexOf(".html") != -1)
		{
			url = url.substring(17,url.indexOf(".html"));
			defineUrl();
		}
		else
			url = "#index";
	}
	else
		url = "";
}
else
{
	url = "";
	realFooterUrl = "http://www.cti2.com/";
}

function defineUrl()
{
	url = ("terms" == url || "privacy_policy" == url || "search" == url || "advanced_search" == url || "site_map" == url)? "":"#" + url;
	url = (url.indexOf("team_") != -1)? "#management":url;
	url = ((url.indexOf("alliances_VAR_contact") != -1) || (url.indexOf("alliances_VAR_contact_thanks") != -1))? "#alliances_about_channel":url;
	url = (url.indexOf("pr_01") != -1)? "#press_releases_2001":url;
	url = (url.indexOf("pr_02") != -1)? "#press_releases_2002":url;
	url = (url.indexOf("pr_03") != -1)? "#press_releases_2003":url;
	url = (url.indexOf("pr_05") != -1)? "#press_releases_2005":url;
	url = (url.indexOf("pr_06") != -1)? "#press_releases_lobby":url;
	url = ((url.indexOf("news_") && url.indexOf("_06")) != -1)? "#news_lobby":url;
	url = ((url.indexOf("news_") && url.indexOf("_05")) != -1)? "#news_2005":url;
	url = ((url.indexOf("news_") && url.indexOf("_04")) != -1)? "#news_2004":url;
	url = ((url.indexOf("news_") && url.indexOf("_03")) != -1)? "#news_2003":url;
	url = ((url.indexOf("news_") && url.indexOf("_02")) != -1)? "#news_2002":url;
	url = (url.indexOf("contact_thanks") != -1)? "#contact_us":url;
	url = ((url.indexOf("contact_investor_relations") != -1) || (url.indexOf("investor_thanks") != -1))? "#investors_relations":url;
	url = (url.indexOf("Demo_thanks") != -1)? "#Demo_Account_Request":url;
	return url;
}

/*Footer*/
b += "<TABLE WIDTH=\"760\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" NAME=\"footer\">";
	b += "<TR>";
		b += "<TD COLSPAN=\"3\"><IMG SRC=\"" + realFooterUrl + "images/empty.gif\" WIDTH=\"50\" HEIGHT=\"10\"></TD>";
	b += "</TR>";
	b += "<TR>";
		b += "<TD CLASS=\"footer\" WIDTH=\"210\"><A HREF=\"" + realFooterUrl + "terms.html\" CLASS=\"footer\">Terms and Conditions</A></TD>";
		b += "<TD CLASS=\"footer\" WIDTH=\"341\" ALIGN=\"CENTER\"><A HREF=\"" + realFooterUrl + "privacy_policy.html\" CLASS=\"footer\">Privacy Policy</A></TD>";
		b += "<TD CLASS=\"footer\" WIDTH=\"210\" ALIGN=\"right\"><A HREF=\"" + realFooterUrl + "site_map.html" + url + "\" CLASS=\"footer\">Site Map</A></TD>";
	b += "</TR>";
	b += "<TR>";
		b += "<TD BGCOLOR=\"#004274\" COLSPAN=\"3\"><IMG SRC=\"" + realFooterUrl + "images/empty.gif\" WIDTH=\"761\" HEIGHT=\"2\" BORDER=\"0\"></TD>";
	b += "</TR>";
	b += "<TR>";
		b += "<TD CLASS=\"footer\" WIDTH=\"210\">&nbsp;</TD>";
		b += "<TD CLASS=\"footer\" WIDTH=\"341\" align=\"center\" nowrap>Copyright &copy; 2005-2007, CTI&sup2;, An AudioCodes Company.<br>All rights reserved.</TD>";
		b += "<TD CLASS=\"footer\" WIDTH=\"210\" ALIGN=\"right\">&nbsp;</TD>";
	b += "</TR>";
b += "</TABLE>";
/*End Footer*/

function searchSite(searchInt)
{
	var value = document.forms[0].elements['sp-q'].value;
	if ( value != "" )
		document.form1.submit();
	if (searchInt == 0)
		return false;
}

function advancedSearchSite(searchInt)
{
	var value = document.forms[1].elements['sp-q'].value;
	if ( value != "" )
		document.form2.submit();
	if (searchInt == 0)
		return false;
}

function advancedAtomzSearchSite(searchInt)
{
	var value = document.forms[2].elements['sp-q'].value;
	if ( value != "" )
		document.form2.submit();
	if (searchInt == 0)
		return false;
}

function simpleSearchSite(searchInt)
{
	var value = document.forms[1].elements['sp-q'].value;
	if ( value != "" )
		document.form3.submit();

	if (searchInt == 0)
		return false;
}

function siteMap()
{
	if (document.getElementById)
	{
		var endUrl = window.location.hash;
		if ((endUrl.indexOf("#") != -1) && (endUrl != "#"))
		{
			endUrl = endUrl.substring(1,endUrl.length);
			var classNameStr = document.getElementById(endUrl).className;
			eval ("document.getElementById('" + endUrl + "').className = '" + classNameStr + "Highlight'");
		}
	}
}
