(function($) {
 var statusChangeMode = false;
 $(function() {
   $(".listen").click(function(e) {
     e.preventDefault();
     window.open('/radio.html', 'radio', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,height=300,width=600');
     });
   $(".change-status").click(function(e) {
     e.preventDefault();
     var $this = $(this);
     statusChangeMode = !statusChangeMode;
     if (statusChangeMode) {
     $this.text("Cancel");
     $(".update-form").show("slow");
     $(".status-wrapper").animate({left: "-195px"}, "slow");
     }
     else {
     $this.text("Change");
     $(".status-wrapper").animate({left: "0"}, "slow");
     $(".update-form").hide("slow");
     }
     });
   $("#status-input").val($.trim($("#status-text-paragraph").text()));
   $("#status-rurl").val(window.location.href);
   if (!$.browser.msie){
     $(".widget-hover a").hover(function() {
         var $widget = $(this).parent().parent();
         $widget.css("backgroundColor", "#323232");
         }, function() {
         var $widget = $(this).parent().parent();
         $widget.css("backgroundColor", "#141414");
         });
   }
   $("#new-menu > li").hover(function() {
       $(this).addClass("hover");
       }, function() {
       $(this).removeClass("hover");
       });

   $("#new-menu li").mouseenter(function(){
       $(this).find("ul").show();
       }).mouseleave(function() {
         $(this).find("ul").hide();
         });
   var $q = $("#q");
   function submitSearch(e) {
     e.preventDefault();
     window.location.href = "/forum/search.php?q=" + encodeURIComponent($q.val());    
   };
   $q.focus(function() {
       if ("Search" == $q.val()) {
       $q.val("");
       }     
       }).blur(function() {
         if ("" == $.trim($q.val())) {
         $q.val("Search");
         }
         }).keypress(function(e) {
           if (13 == e.keyCode) {
           submitSearch(e);
           }
           });
   $("#people-search-submit").click(submitSearch);
   $("#radio").click(function(e) {
       e.preventDefault();
       window.open('/flashradio/index.html', 'flashwindow', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,width=300,height=120');return false;
       });

   $("#registrationform fieldset").each(function() {
       var $this = $(this);
       var legend = $this.find("legend").html();
       $("<h3>" + legend + "</h3>").insertBefore($this);
       });

   //alert($("input[type='submit']").css("backgroundColor"));	
   if (($.browser.msie)) {
     /*$("#new-menu > li").each(function() {
         var $this = $(this);		
         $("<img src='/wp-content/themes/glamrock/images/rounded.png' class='rounded-left'/>").appendTo($this).css({position: "absolute", left: "0", top: "0"});
         $("<img src='/wp-content/themes/glamrock/images/rounded-right.png' class='rounded-right' />").appendTo($this).css({position: "absolute", left: $this.width() - 4 + "px", top: "0"});
         });

     $("#new-menu > li").hover(function() {
         var $this = $(this);
         $this.find(".rounded-left").attr("src", "/wp-content/themes/glamrock/images/rounded-hover.png");
         $this.find(".rounded-right").attr("src", "/wp-content/themes/glamrock/images/rounded-right-hover.png");
         }, function() {
         var $this = $(this);
         $this.find(".rounded-right").attr("src", "/wp-content/themes/glamrock/images/rounded-right.png");			
         });*/

     var $signupLink = $(".widget-signup a");
     $signupLink.css("position", "relative");
     $("<img src='/wp-content/themes/glamrock/images/widget-signup-topleft.png' />").appendTo($signupLink).css({position: "absolute", left: "-1px", top: "-1px", "border": "0"});
     $("<img src='/wp-content/themes/glamrock/images/widget-signup-topright.png' />").appendTo($signupLink).css({position: "absolute", right: "-1px", top: "-1px", border: "0"});
     $("<img src='/wp-content/themes/glamrock/images/widget-signup-bottomleft.png' />").appendTo($signupLink).css({position: "absolute", bottom: "-1px", left: "-1px", border: "0"});
     $("<img src='/wp-content/themes/glamrock/images/widget-signup-bottomright.png' />").appendTo($signupLink).css({position: "absolute", bottom: "-1px", right: "-1px", border: "0"});

     var $leftWidget = $(".left-widget, #postform, #registrationform fieldset");
     $leftWidget.each(function() {
         var $this = $(this);
         $this.css("position", "relative");
         $("<img src='/wp-content/themes/glamrock/images/widget-topleft.png' />").appendTo($this).css({position: "absolute", left: "-1px", top: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/widget-topright.png' />").appendTo($this).css({position: "absolute", right: "-1px", top: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/widget-bottomleft.png' />").appendTo($this).css({position: "absolute", left: "-1px", bottom: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/widget-bottomright.png' />").appendTo($this).css({position: "absolute", right: "-1px", bottom: "-1px", "border": "0"});
         });

     $("input[type='submit']").each(function() {
         var $this = $(this);
         var $container  = $this.parent();
         var text = $this.val();
         $this.remove();
         var $button = $("<button type='submit' class='rounded-button'>" + text + "</button>").appendTo($container);
         $button.css("position", "relative");
         $("<img src='/wp-content/themes/glamrock/images/round-button-topleft.png' />").appendTo($button).css({position: "absolute", left: "-1px", top: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/round-button-topright.png' />").appendTo($button).css({position: "absolute", right: "-1px", top: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/round-button-bottomleft.png' />").appendTo($button).css({position: "absolute", left: "-1px", bottom: "-1px", "border": "0"});
         $("<img src='/wp-content/themes/glamrock/images/round-button-bottomright.png' />").appendTo($button).css({position: "absolute", right: "-1px", bottom: "-1px", "border": "0"});
         });

     $("#profile-menu li").not(".current").find("a").each(function() {		    															            var $this = $(this);																					            $this.css("position", "relative");
         $("<img src='/forum/bb-templates/glamrock/images/profile-topleft.png' />").appendTo($this).css({position: "absolute", left: "0px", top: "0px", "border": "0"});

         $("<img src='/forum/bb-templates/glamrock/images/profile-topright.png' />").appendTo($this).css({position: "absolute", right: "0px", top: "0px", "border": "0"});


         });


   }



 });
 $(window).bind("load", function() {
     if ($.browser.msie) {

     }									
     });


})(jQuery);

