// fix IE...
document.createElement('abbr');

if (typeof(jQuery) == 'undefined')
{
	jQuery = $ = {}; // global vars to prevent tinyMCE alert (editor doesn't appear though)
}

/**
 * Deal with Firebug not being present
 */
if (!window.console || !console.firebug)
{
	(function(w) { var fn, i = 0;
		if (!w.console) w.console = {};
		fn = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'getFirebugElement', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'notifyFirebug', 'profile', 'profileEnd', 'time', 'timeEnd', 'trace', 'warn'];
		for (i = 0; i < fn.length; ++i) if (!w.console[fn[i]]) w.console[fn[i]] = function() {};
	})(window);
}
jQuery.noConflict();
jQuery(document).ready(function($){
	var secondarymycolors = "#statusSubmit,.tab_bar li.active,#user_navigation,#mycolor,#main_search,.add_link,#adv_search,.topic_buttons li,.topic_buttons li a ,span#postername,#forum-icon-old,#forum-icon,body,#header ,#footer_utilities,body .maintitle , .general_box h3  , .filter_bar  , .tab_filters , #index_stats .general_box h3, #body_back,#user_link, #user_navigation.not_logged_in #sign_in";
	var colormycolors = "#secondary_nav a,.tab_bar.no_title.mini,.forums_block a,.category_row a ,table.ipb_table a,.forums_cont_css a,.altbar,.header,body .ipb_table .header a, 	body .topic_options a,.post_block h3,#member_wrap h3,.input_submit.alt:hover,.topic_options, .generic_bar, .tab_filters,table.ipb_table ol.subforums li,table.ipb_table ol.subforums li.newposts ,ul.post_controls a,.user_controls li a ,#latest_news,p.rep_highlight,#user_navigation ul#user_link_menucontent a";
	var bordermycolors = ".tab_bar.no_title.mini";

	


$('#colorpickerField1').ColorPicker({
	onSubmit: function(hsb, hex, rgb, el) {
		$(el).val(hex);
		$(el).ColorPickerHide();
		$(el).css("backgroundColor", "#" + hex);
		$(el).css("borderColor", "#" + hex);
		$(secondarymycolors).css("background-color", "#" + hex);
         $(colormycolors).css("color", "#" + hex);
         $(bordermycolors).css("border-color", "#" + hex);
		$.cookie('cookiescolor1',hex,{ expires: 365, path: '/'});
		$.cookie('cookiescolor2',hex,{ expires: 365, path: '/'});
		$.cookie('cookiescolor3',hex,{ expires: 365, path: '/'});


	},
	onBeforeShow: function () {
		$(this).ColorPickerSetColor(this.value);
	}
})
.bind('keyup', function(){
	$(this).ColorPickerSetColor(this.value);
});	



	if ( ($.cookie('cookiescolor1') != null))	{
		$(secondarymycolors).css("background-color", "#" + $.cookie('cookiescolor1'));
		$("#colorpickerField1").val($.cookie('cookiescolor1'));
	}

	if ( ($.cookie('cookiescolor2') != null))	{
		$(colormycolors).css("color", "#" + $.cookie('cookiescolor2'));
		$("#colorpickerField1").val($.cookie('cookiescolor2'));
	}
		if ( ($.cookie('cookiescolor3') != null))	{
		$(secondarymycolors).css("border-color", "#" + $.cookie('cookiescolor3'));
		$("#colorpickerField1").val($.cookie('cookiescolor3'));
	}


});

