jQuery.extend({
    'Q' : window.location.search.length <= 1 ? {}
        : function(a){
            var i = a.length, 
                r = /%25/g,  // Ensure '%' is properly represented 
                h = {};      // (Safari auto-encodes '%', Firefox 1.5 does not)
            while(i--) {
                var p = a[i].split('=');
                h[ p[0] ] = r.test( p[1] ) ? decodeURIComponent( p[1] ) : p[1];
            }
            return h;
        }(window.location.search.substr(1).split('&'))
});

jQuery(document).ready(function()
{
	
    //members hover on index page
    $('.index_member ul li').hover(function(){
         $(this).find('div').stop(true, true).show();
    },function(){
        $(this).find('div').stop(true, true).hide();
    });

    //datepicker for intervals
    if($('#from').length != 0){
        $("#from").datepicker({ numberOfMonths: [1, 3] });
    }
    if($('#to').length != 0){
        $("#to").datepicker({ numberOfMonths: [1, 3] });
    }
    
     /*TAB INFORMATION*/
     if($('#messages_tabs').length != 0)
     {
             $.jtabber({
                            mainLinkTag: "#messages_tabs a", // much like a css selector, you must have a 'title' attribute that links to the div id name
                            activeLinkClass: "sclick_sel", // class that is applied to the tab once it's clicked
                            hiddenContentClass: "hiddencontent", // the class of the content you are hiding until the tab is clicked
                            showDefaultTab: 1, // 1 will open the first tab, 2 will open the second etc.  null will open nothing by default
                            showErrors: true, // true/false - if you want errors to be alerted to you
                            effect: 'fade', // null, 'slide' or 'fade' - do you want your content to fade in or slide in?
                            effectSpeed: 'slow' // 'slow', 'medium' or 'fast' - the speed of the effect
                });
     }

     /*TAB INFORMATION*/
     if($('#messages_tabs2').length != 0)
     {
			var _showDefaultTab = 1;
			if($.Q.sent)
				_showDefaultTab = 2;
			
             $.jtabber({
                            mainLinkTag: "#messages_tabs2 a", // much like a css selector, you must have a 'title' attribute that links to the div id name
                            activeLinkClass: "sclick_sel2", // class that is applied to the tab once it's clicked
                            hiddenContentClass: "hiddencontent2", // the class of the content you are hiding until the tab is clicked
                            showDefaultTab: _showDefaultTab, // 1 will open the first tab, 2 will open the second etc.  null will open nothing by default
                            showErrors: true, // true/false - if you want errors to be alerted to you
                            effect: 'fade', // null, 'slide' or 'fade' - do you want your content to fade in or slide in?
                            effectSpeed: 'slow' // 'slow', 'medium' or 'fast' - the speed of the effect
                });
     }

     //fix safari jNice select
     if($.browser.safari)
     {
         //fix safari jNice select
         $("#container .edit_profile .jNice table tr td.sel_big .jNiceWrapper .jNiceSelectWrapper div span.jNiceSelectText").css("width","200px");
         $("#container .edit_profile .jNice table tr td.sel_big .jNiceWrapper .jNiceSelectWrapper").css("width","220px");
         $("#container .edit_profile .jNice table tr td.sel_small .jNiceWrapper .jNiceSelectWrapper div span.jNiceSelectText").css("width","70px");
         $("#container .edit_profile .jNice table tr td.sel_small .jNiceWrapper .jNiceSelectWrapper").css("width","95px");
     }

     //nice file upload field
//	 if($("input:file").length != 0)
//     	$("input:file").uniform();


});
