$(document).ready(function() {
    //surveyCheck();
    $("#AdvancedSearch span").click(function() {

        $("#srcBox").slideToggle("slow");


        clearSearchParamsGUI();
        $.get("http://" + location.host + "/Handlers/AjaxHandler.ashx?a=ResetSearch", OnResetSuccess);

    });
    if ($.browser.msie && $.browser.version < 7) {

        $("#MidSection ul li:first").addClass("firstChildForIe6");

        $("#MainContent td:first").css({ border: "0px" });


    }
});
    //BUTIKSPUFF LI EXPANDER
 //   $(".NearbyStore").each(function() {     $(this).find("span").click(function() { $(this).parent().find("div.NBSInfo").slideToggle("slow");
       //     $(this).parent().find("div.NBSBullet").toggleClass("NBSBulletSelected");
       // });
    //});

function OnResetSuccess(result) {
    //SkopunktenService.ApplySearchFilter("none", "0", OnSearchFilterAddedSuccess);
    $.post("http://" + location.host + "/Handlers/AjaxHandler.ashx?a=ApplySearchFilter",
                    { filter:'none' , value: '0' },
                    OnSearchFilterAddedSuccess);
}
  function surveyCheck() {
            var allowedClicks = 5;
            var cookieCheck = "SurveyPop";
            var trackCookie = "SurfCount";

            if (getCookie(cookieCheck) == "" ) {
                if (getCookie(trackCookie) == "") 
                    {
                        setCookie(trackCookie, 1, 1);
            
                    } 
                    
                    else {
                        if (parseInt(getCookie(trackCookie)) < allowedClicks) 
                        {
                            setCookie(trackCookie, (parseInt(getCookie(trackCookie)) + 1), 1);
                         
                         }
                         else if (getCookie(trackCookie) == allowedClicks)
                         {
                            tb_show('Tyck till om vårens kollektion!','http://cmp.nilsongroup.com/survey/survey.aspx?surveyid=8&keepThis=true&TB_iframe=true&height=250&width=400','');

                            
                            setCookie(cookieCheck,true,30);
                            Delete_Cookie(trackCookie,'/','');
                        }
                         
                        
                  }
                    
                    
                }
             }

        function setCookie(c_name, value, expiredays) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() + expiredays);
            document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        }


        function getCookie(c_name) {
            if (document.cookie.length > 0) {
                c_start = document.cookie.indexOf(c_name + "=");
                if (c_start != -1) {
                    c_start = c_start + c_name.length + 1;
                    c_end = document.cookie.indexOf(";", c_start);
                    if (c_end == -1) c_end = document.cookie.length;
                    return unescape(document.cookie.substring(c_start, c_end));
                }
            }
            return "";
        }  
        
function Delete_Cookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
 
