﻿// JScript File
        var url1 ="http://www.lehighoutfitters.com/Products/search/Mens_steel_toe_boots/";
		var url3 ="http://www.lehighoutfitters.com/Products/search/Shirts/b-CARHARTT/View-50/";
		var url4 ="http://www.lehighoutfitters.com/Products/search/Search-columbia/";
        var url5 ="http://www.lehighoutfitters.com/products/search/Search-hunting/";
        var url6 ="http://www.lehighoutfitters.com/products/search/High_visibility/";
        
        var url7 = "http://www.lehighoutfitters.com/carhartt/"
        var url8 = "http://www.lehighoutfitters.com/products/search/View-50/Search-flx/"
        var url9 ="http://www.lehighoutfitters.com/womensworkboots/";
        
		// Initialize Slides
		ss = new slideshow("ss");

		// Setup Slide Show
		ss.set_timer(14000);							// Set Time Limit
		ss.slide_image_object("SlideShow_image");	// Set Image Object
		ss.slide_div_object("SlideShow_div");		// Set Div Object
		ss.slide_text_object("SlideShow_text");		// Set Text Object
		ss.slide_url_object("SlideShow_url");		// Set URL Object
        
  		ss.add_slide("images/slideshow/slide_07.jpg",url7,"<a href='http://www.lehighoutfitters.com/carhartt/'>Beat the heat with a brand you love! <br/>Gear up for summer with our full line of Carhartt apparel</a>","");
        ss.add_slide("images/slideshow/slide_08.jpg",url8,"<a href='http://www.lehighoutfitters.com/products/search/View-50/Search-flx/'>Wet feet got you down? FLXpoint waterproof <br/>work boots will keep you dry and happy!</a>","");
		ss.add_slide("images/slideshow/slide_09.jpg",url9,"<a href='http://www.lehighoutfitters.com/womensworkboots/'>Are you the one bringing home the bacon? <br/>Why not do it in style with our wide variety of Women's Work Boots.</a>","");

// Slide show End


    var PrevId;
    var BrandPrevId;
    function ShowDiv(ShowId)
    {
        var ShowId = "div" + ShowId;
        document.getElementById(ShowId).style.display = "block";
        
        if (PrevId != null)
        {
           document.getElementById(PrevId).style.display = "none"; 
        }
        PrevId = ShowId;
    }
    function ShowDivbrands(ShowId)
    {
        var ShowId = "div_" + ShowId;
        document.getElementById(ShowId).style.display = "block";
        
        if (BrandPrevId != null)
        {
           document.getElementById(BrandPrevId).style.display = "none"; 
        }
        BrandPrevId = ShowId;
    }
    
    function SetBgColor(Id,AncId)
    {
        document.getElementById(Id).style.backgroundColor="#E0DED1";
        document.getElementById(AncId).style.backgroundColor="#A3A284";
    }
    
    function setAnchorBgcolor(AncId)
    {
        document.getElementById(AncId).style.backgroundColor="#A3A284";
    }
    
    function RemoveBgColor(Id,AncId)
    {
        document.getElementById(Id).style.backgroundColor="#F3F3F3";
        document.getElementById(AncId).style.backgroundColor="";
    }
    
    function RemoveAnchorBgcolor(AncId)
    {
        document.getElementById(AncId).style.backgroundColor="";
    }
    
     document.onkeypress = KeyHandler;
    var blnFocusSearch=false;
        function KeyHandler(e) 
        {
           if (window.event) keycode = window.event.keyCode; //ie
           else if (e) keycode = e.which; //ff     
           if (keycode && keycode == 13 && !blnFocusSearch)
           { 
                  return searchVal();                   
	        }	               
        }
               
        
         function searchVal()
        {
            if ((document.getElementById('txtSearch').value == "enter search term or item #") || (document.getElementById('txtSearch').value == ""))
            {
                alert("Please enter Style or Product Name");
                document.getElementById('txtSearch').focus();
                return false;
            }
            else
            {
                CleanString();
                //__doPostBack('btnSearchGo','');
                //window.location.href='http://www.lehighoutfitters.com/Products/search/Search-' + document.getElementById('txtSearch').value + '/'
                 window.location.href='/Products/search/Search-' + document.getElementById('txtSearch').value + '/'
               // alert('test')
                return true;    
            }
        }
        
        
        function CleanString()
        {  
            var str =document.getElementById('txtSearch').value;
            while(str.charAt(0) == (" ") )
            {  
                str = str.substring(1);
            }
            while(str.charAt(str.length-1) == " " )
            {  
                str = str.substring(0,str.length-1);
            }
           
            if(str.length>1)
            { 
                if((str.charAt(str.length-1)=='”' || str.charAt(str.length-1)=='“' ) && (str.charAt(0)=='“' || str.charAt(0)=='”'))
                {
                    str=str.substring(1);
                    str=str.substring(0,str.length-1);
                }
            } 
            document.getElementById('hidSearch').value=str;
            return str;
            
        } 
        
        function setBrand()
        {
        var response;
        response= _Default.FillBrandsNew(document.getElementById('ddlcategory').value)
        result=response.value;
        if(result!=null)
            document.getElementById('spnBrand').innerHTML=result
       
         response= _Default.FillSizesNew(document.getElementById('ddlcategory').value)
        result=response.value;
             if(result!=null)
            document.getElementById('spanSizes').innerHTML=result    
       
        }
        
        function  setBrandVal()
        {
          document.getElementById('hidBrand').value=document.getElementById('ddlBrand').options[document.getElementById('ddlBrand').selectedIndex].text;
          return false;
        }
        
          function setSizeVal()
        {
        document.getElementById('hidSizes').value=document.getElementById('ddlSize').options[document.getElementById('ddlSize').selectedIndex].value;
          return false;
        
        }