
// Function for showing (bFlag=true) / hiding (bFlag=false) categories names
// in index search page (סיווגים).
// Created by Eran Dekel on the 10/04/2006
function ShowAllCategories(bFlag, sImagesURL, sPixelURL, optionalLen, optinalClass)
{
	var iMaxLen = 245; // Maximal characters of categories names to show
	var sClassColor = "C_3";
	var sCatStr = "";
	var sHtmlCatStr = "";
	
	if (typeof optionalLen != "undefined") {
		iMaxLen = optionalLen ;
	}
	if (typeof optinalClass != "undefined") {
		sClassColor = optinalClass ;
	}
	var i, iLastCat = 0, iTagsCounter = 0, iHtmlPos = 0;
	
	if(document.getElementById('DivCategories') != null && document.getElementById('DivCategories') != null) {
		sCatStr		= document.getElementById('DivCategories').innerText;
		sHtmlCatStr = document.getElementById('DivCategories').innerHTML;
	}
	
	if(sCatStr != ""){
		if(sCatStr.lastIndexOf(',') < iMaxLen && sCatStr.length >= iMaxLen)
		{
				bFlag = true;
		}
		
		if(!bFlag && sCatStr.length > iMaxLen)
		{
			for(i=0; i < sCatStr.length && i < iMaxLen; i++)
			{
				if(sCatStr.charAt(i) == ",")
				{
					iLastCat = iLastCat + 1;
				}
			}
			
			for(i=0; i < sHtmlCatStr.length; i++)
			{
				if(sHtmlCatStr.substring(i,i+3) == "/A>")
				{
					iTagsCounter = iTagsCounter + 1;
					
					if(iTagsCounter == iLastCat)
					{
						iHtmlPos = i + 3;
						break;
					}
				}
			}
			document.getElementById('DivCategories').innerHTML = sHtmlCatStr.substring(0,iHtmlPos) + ',<span style="padding-left:1px;padding-right:5px;color:white;"></span><A class="L_12 '+ sClassColor +' U" style="font-weight:normal;color:#000000;textdecoration:none;" title="הצג את כל הסיווגים" href="javascript:ShowAllCategories(' + (!bFlag) + ')"><nbr>לסיווגים נוספים...</nbr></A>';
			
			document.getElementById('DivAllCategories').innerHTML = sHtmlCatStr;
		}
		else
		{
			// First call to the function - get all categories from original list
			if(document.getElementById('DivAllCategories').innerHTML == '')
				document.getElementById('DivAllCategories').innerHTML = sHtmlCatStr;
			
			document.getElementById('DivCategories').innerHTML = document.getElementById('DivAllCategories').innerHTML;
		}
	}
}

//this function pass parameters for more results from specific domain
					function fnLoadRelativeResults(domain)
					{
						var q = document.SearchBar.q.value;
						document.location.href='/Google.asp?cr=1&#38;sType=3&#38;q=' + q + '&#38;domain='+ domain;
					}
					//this function pass parameters for cache
					function fnLoadCacheResults(domain,cacheID)
					{
						var q = document.SearchBar.q.value;
						window.open('http://index<xsl:value-of select="$naENVIRONMENT_NAME"/>.nana10.co.il/GCache.aspx?domain=' + domain + '&#38;cId=' + cacheID);
					}
					//this function pass parameters for similar pages
					function fnLoadSimilarPages(domain)
					{
						var q = document.SearchBar.q.value;
						document.location.href='/Google.asp?cr=1&#38;sType=4&#38;q=' + q + '&#38;domain='+ domain;
					}
					
					function StatusBar(str){
						window.status = str;
						return true;
					}
					
					
				
function google_afs_request_done(google_ads)
{	
	if (typeof(google_ads)=="undefined") return;
    var google_num_ads = google_ads.length;
    if (google_num_ads <= 0) {
        return;
    }

	try {
		$("#GoogleAFSContainerTop").setTemplateElement("GoogleAFSTemplate", null, {filter_data: false});
		$("#GoogleAFSContainerTop").processTemplate(google_ads);
		$("#GoogleAFSContainerTop").show();
	} catch (ex) {}


}					
