﻿$(document).ready(function() {
  $("#search form").submit(function() {
                                            if ($("#query").get(0).value === "")
                                            {
                                                $("#query").get(0).focus();
                                                return false;
                                            }
                                            return true;  
                                       });
                                       
  $("#industry span.more_home a").attr({href: "javascript:void(0);"});
  $("#industry span.more_home").click(function() {
                                    var addClass  = true;
                                    var moreOpts = $(this).next();
                                    if ($(this).hasClass("more_home_selected")) { addClass = false; }
                                    $("#industry span.more_home").removeClass("more_home_selected").next().hide();
                                    
                                    var x = moreOpts.width();
                                    
                                    if (addClass) { 
                                        $(this).addClass("more_home_selected");
                                        moreOpts.show(1, function() {
                                                var x = $(this).width();
                                                $(this).get(0).style.marginLeft = 105 - x + "px";
                                            });
                                    }
                               });

  $("#industry .close img").click(function() {
                                    $(this).parent().parent().parent().parent().parent().parent().hide().prev().removeClass("more_home_selected");
                                    });


  /*            
  $("#industry span.more_home").click(function() {
                                                $(this).next("div.moreOptions").get(0).style.border="1px solid red";
                                               alert($(this).next("div.moreOptions").width());
                                               $(this).next("div.moreOptions").get(0).style.marginLeft = 105 - $(this).next("div.moreOptions").width() + "px";
                                            });
             
                          */                  
                                       
});
