
if (document.images)
{
	srcbase = "/forum/images/";
  pic1= new Image(384,28); 
  pic1.src=srcbase+"search_1.gif"; 

  pic2= new Image(384,28);  
  pic2.src=srcbase+"search_2.gif"; 

  pic3=new Image(384,28);  
  pic3.src=srcbase+"search_3.gif"; 
  
  pic4= new Image(384,28);  
  pic4.src=srcbase+"search_4.gif"; 

  pic5=new Image(384,28);  
  pic5.src=srcbase+"search_5.gif"; 
  
  pic6= new Image(384,28);  
  pic6.src=srcbase+"search_6.gif"; 

  pic7=new Image(384,28);  
  pic7.src=srcbase+"search_7.gif"; 
}



g_SearchSelected = "search_news";
    /*
הכל:
search_forums הכל
 
חדשות:search_news
http://www.iphones.co.il/forum/forum27.html
http://www.iphones.co.il/forum/forum109.html
http://www.iphones.co.il/forum/forum40.html
 
אפליקציות:search_app
http://www.iphones.co.il/forum/forum57.html
http://www.iphones.co.il/forum/forum77.html
http://www.iphones.co.il/forum/forum91.html
http://www.iphones.co.il/forum/forum101.html
http://www.iphones.co.il/forum/forum108.html
http://www.iphones.co.il/forum/forum86.html
 
מדריכים:search_guides
http://www.iphones.co.il/forum/forum36.html 36,46,52,45,48,49,40,41
http://www.iphones.co.il/forum/forum46.html
http://www.iphones.co.il/forum/forum52.html
http://www.iphones.co.il/forum/forum45.html
http://www.iphones.co.il/forum/forum48.html
http://www.iphones.co.il/forum/forum49.html
http://www.iphones.co.il/forum/forum40.html
http://www.iphones.co.il/forum/forum41.html
 
לוחות:search_boards
http://www.iphones.co.il/forum/forum16.html
http://www.iphones.co.il/forum/forum34.html
http://www.iphones.co.il/forum/forum35.html
http://www.iphones.co.il/forum/forum28.html
http://www.iphones.co.il/forum/forum95.html
http://www.iphones.co.il/forum/forum62.html
 
מאק:search_mac
http://www.iphones.co.il/forum/forum30.html
 
אביזרים:search_acc
http://www.iphones.co.il/forum/forum87.html
http://www.iphones.co.il/forum/forum17.html
http://www.iphones.co.il/forum/forum65.html
http://www.iphones.co.il/forum/forum66.html
http://www.iphones.co.il/forum/forum67.html
http://www.iphones.co.il/forum/forum68.html
 
 
 
 
     */
    function search_exe()
    {
        var searchinput = document.getElementById("nws_search_input");
        if (searchinput.value.length >0)
        {
            if (g_SearchSelected == "search_news")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=27,109,40,115&query="+searchinput.value;
            if (g_SearchSelected == "search_forums")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&query="+searchinput.value;
            if (g_SearchSelected == "search_acc")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=17,67,66,68,65,87&query="+searchinput.value;
             if (g_SearchSelected == "search_app")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=86,91,101,77,108,57&query="+searchinput.value;
            if (g_SearchSelected == "search_guides")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=36,46,52,45,48,49,41&query="+searchinput.value;
            if (g_SearchSelected == "search_boards")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=16,34,35,28,95,62&query="+searchinput.value;
            if (g_SearchSelected == "search_mac")
                document.location.href = "/forum/search.php?do=process&replyless=0&replylimit=0&forumchoice[]=30&query="+searchinput.value;
            
                
        }
    }
    function search_over(obj,state)
    {
        if (obj.getAttribute("selected") == "true")
        {
        }
        else
        {
            if (state)
            {
                obj.className = "search_sub_over";
            }
            else
            {
                obj.className = "search_sub";
            }
        }
    }
    
    function search_select(obj)
    {
        if (obj.getAttribute("selected") == "true")
        {
            return;
        }
        else
        {
            var selected = document.getElementById(g_SearchSelected);
            selected.className = "search_sub";
            selected.removeAttribute("selected");
            g_SearchSelected = obj.id;
            obj.className = "search_sub_selected";
            obj.setAttribute("selected","true");
            
            var searchbg = document.getElementById("searchbg");
            searchbg.className = "search_input_"+obj.getAttribute('orderid');
            
            set_cookie("nws_search",obj.id);
            
        }
    }
    YAHOO.util.Event.on(window, "load", init_search)
    function init_search()
    {
		try {
			var search_id = fetch_cookie("nws_search");
			if (search_id != null && search_id.length > 1) {
				search_select(document.getElementById(search_id));
			}
			else {
				search_select(document.getElementById(g_SearchSelected));
			}
			fixForum();
			initAd2();
		}
		catch (eee){}

    }
    
    function fixForum()
    {
    	try
    	{
	    var x = document.getElementsByTagName("div")
	
	    x[x.length-1].style.display="none";
	    x[x.length-2].style.display="none";
	
	    var y = document.getElementsByTagName("br")
	
	    y[y.length-1].style.display="none";
	
    	}
    	catch(ee){}
    }
    
    function search_keydown(e)
    {
    	if ((e.which && e.which == 13) || 
    		    (e.keyCode && e.keyCode == 13))
    	{
    		search_exe(); 
    	}
    }
    function buttonover(obj,state)
    {
        if (state)
        {
            obj.src = obj.src.replace(/.gif/,"_over.gif");
        }
        else
        {
            obj.src = obj.src.replace(/_over.gif/,".gif");
        }
    }
    
  function menu_over(obj,state)
    {
        if (obj.getAttribute("selected") == "true")
        {
        }
        else
        {
            if (state)
            {
                obj.className = "tab_over";
            }
            else
            {
                obj.className = "tab";
            }
        }
    }
   
  g_MenuSelected=null;
    function menu_selected(obj)
    {
        if (obj.getAttribute("selected") == "true")
        {
            return;
        }
        else
        {
            var selected = document.getElementById(g_MenuSelected);
            if (selected)
            {
                selected.className = "tab";
                selected.removeAttribute("selected");
            }
            g_MenuSelected = obj.id;
            obj.className = "tab_selected";
            obj.setAttribute("selected","true");
            //todo - goto other page
            var hrefTag = obj.getElementsByTagName("a")[0];
            if (hrefTag)
            {
            	document.location.href = hrefTag;
            }
            
           
            
        }
    }
    
    function loginOnEnter(e)
    {
    	if ((e.which && e.which == 13) || 
    		    (e.keyCode && e.keyCode == 13))
    	{
    		document.getElementById('loginform').submit();void(0);
    	}
    }
    
    
	function initAd()
	{
		if (screen.width>1000 && show_floating_ad )
		{
			$("#floaterAd").show("slow");
			var params = new Object();
			params.x =5;
			params.y = 5;
			params.speed="fast";
			$("#floaterAd").makeFloat(params);
			$("#closeme").click(function(){ $("#floaterAd").hide("slow"); });
		}
	}
	
	var minPageWidthToShowAnAd = 1150;
	
	function initAd2(){
		try {
			var windowWidth = $(window).width();
			if (windowWidth > minPageWidthToShowAnAd && show_floating_ad) {
				$("#floaterAd").show("slow");
				$("#floaterAd2").show("slow");
				var docWidth = windowWidth - 163;
				$('#floaterAd').css('right', docWidth);
				$('#floaterAd2').css('right', 3);
			}
			$("#closeme").click(function(){
				$("#floaterAd").hide("slow");
			});
			
			
			$(window).resize(function(){
				var windowWidth = $(window).width();
				
				$('#floaterAd').css('right', windowWidth - 163);
				if (windowWidth < minPageWidthToShowAnAd) {
					$("#floaterAd").hide("fast");
					$("#floaterAd2").hide("fast");
				}
				else {
					//$("#floaterAd").show("fast");
					//$("#floaterAd2").show("fast");
				}
			});
			if (windowWidth < minPageWidthToShowAnAd && show_floating_ad)
			{
				$("#mainBannerSponsers").show("slow");

			}
			
		}
		catch(eee){}
		
	}
    
