function toggleEditor(mode,form)	{		var id = form;			if(mode=='on')		{			tinyMCE.execCommand('mceAddControl',false,id);		}		else		{			tinyMCE.execCommand('mceRemoveControl',false,id);					}	}	$.fn.toggleFade = function(settings)	{		if(settings==undefined) {			settings={ speedIn : 'slow'};		}				settings = jQuery.extend(				{					speedIn: "normal",					speedOut: settings.speedIn				}, settings		);		return this.each(function()				{			var isHidden = jQuery(this).is(":hidden");			jQuery(this)[ isHidden ? "fadeIn" : "fadeOut" ]( isHidden ? settings.speedIn : settings.speedOut);				});	};	function counter( string ){  var maxLength = 160;  var oSpan = document.getElementById( 'counter' );  oSpan.innerHTML = "Pozostało ci <span style='color:black; font-weight:bold;'>"+ (maxLength - ( string.length ) ) +"</span> znaków";  if( maxLength - string.length < 0 ){ 	oSpan.innerHTML = "Wstęp jest zbyt długi ( maksymalnie 160 znaków )"; 	}}	jQuery.fn.showlogform = function() {    $(this).colorbox({ opacity: '0.60', close: "<img style='width:20px; padding-bottom:2px; vertical-align:middle; height:20px;' src='images/close.png'>", width:"380px", height:"260px", inline: true , href:'#logform2' , title:"", transition: "elastic"});};$(document).ready(function(){        $('.usercontext').contextMenu('context', {            			'Komunikator': {                click: function(element) {                    chatWith( element.attr("rel") );                }            },			            'Strona profilu': {                click: function(element) {					location.replace( "profil,"+element.attr("rel") );				}            },			            'Wyślij wiadomość': {                click: function(element) {					location.replace( "poczta,wyslij,"+element.attr("rel") );				}            }			        });		$('.thumbnail').mouseenter(function() {$(this).animate({    opacity: "0.45"  }, 500);});$('.thumbnail').mouseout(function() {$(this).animate({    opacity: "1.00"  }, 1000);});$(".sf").click(function(){ $(this).val(""); });$(".vup").click(function(){ 	vval = $(this).attr("name");	$.ajax({ type: "POST", url: "validart/ava.php",		data: "a="+vval+"&o=up",		beforeSend: function(){ },		success: function(data){ },		error: function(){  }});});$(".vdo").click(function(){ 	vval = $(this).attr("name");	$.ajax({ type: "POST", url: "validart/ava.php",		data: "a="+vval+"&o=down",		beforeSend: function(){ },		success: function(data){ },		error: function(){  }});});$(".priv_message").click(function(){	var dokogo = $(this).attr("rel");	$("#priv_adress").html(dokogo);	$(".dokogo").html(dokogo);	$("#modal").fadeIn();	$("#dialog3").delay(500).fadeIn();	return false;});$(".showchatusers").click(function(){	$("#chat_loggedin").toggleFade();	return false;});$("#modal").click(function(){		$("#modal").delay(500).fadeOut();		$("#dialog3").fadeOut();		return false;});$(".w1").click(function(){		$("#modal").delay(500).fadeOut();		$("#dialog3").fadeOut();		return false;});$(".w2").click(function(){		var priv_thema = $("input[name='priv_them']").val();	var priv_mess = tinyMCE.get('priv_mess').getContent();	var priv_adre = $("#priv_adress").html();			$.ajax({		type: "POST",		url: "validart/sendpriv.php",		data: "odbiorca="+priv_adre+"&temat="+priv_thema+"&wiadomosc="+escape(priv_mess),		beforeSend: function(){ },		success: function(data){		if( data == 1 ){ 			alert("Twoja wiadomość została wysłana");			$("#modal").delay(500).fadeOut();			$("#dialog3").fadeOut();			}		else{ alert(data); }		},		error: function(){  }});		return false;	});$("a[rel='nlogged']").click(function(){ 					$("div#panel").slideDown("slow");					$("#toggle a").toggle();				    $("#dialog:ui-dialog").dialog("destroy");                    $("#dialog-message").html("Zaloguj się do serwisu");                    $("#dialog-message").dialog({                        modal: true,                        title: "Wystąpił błąd",                        buttons: {                            Zamknij: function () {                                $(this).dialog("close")                            }                        }                    })return false; });$(".nlogged").click(function(){ 					$("div#panel").slideDown("slow");					$("#toggle a").toggle();				    $("#dialog:ui-dialog").dialog("destroy");                    $("#dialog-message").html("Zaloguj się do serwisu");                    $("#dialog-message").dialog({                        modal: true,                        title: "Wystąpił błąd",                        buttons: {                            Zamknij: function () {                                $(this).dialog("close")                            }                        }                    })return false; });	$(".indexbox").click(function(){ 		$(".indexbox").each(function(){ $(".indexbox").css("color","grey"); $(".indexbox").css("background","url(images/menu_sprite.png)"); }); $(this).css("color","black");  $(this).css("background","#f7f8f8");		$('#boxout').html('<div style="text-align:center;"><img style="margin-top:10px; margin-bottom:10px;" src="images/2ajax-loader.gif"></div>');		var indexopt = $(this).attr("rel");		$.get('ajaxfunctions/indexboxdata.php?opt='+indexopt, function(data) {			$('#boxout').html(data);		});	return false; });$("#cr").click(function(){ $(this).attr("value",""); });	$("#cr").blur(function(){ 		if( $(this).val() == '' ){ $(this).val("Wyszukaj w serwisie"); }	});	$("#ans").attr("value","0");	$(".abort").click( function(){ 		$("#infa").html(""); 		$(".abort").hide();		$("#aws").hide();		$("#ans").attr("value","0");		return false;		});	$(".odp").click( function(){		user = $(this).attr("name");		ident = $(this).attr("id");		$("#infa").html("<img src='images/answer.png' style='margin-bottom:2px;width:17px; vertical-align:middle;margin-right:3px;'>Odpowiadasz na komentarz "+user+"");		$(".abort").show();		$("#aws").show();		$("#ans").attr("value",ident);	});	$(".toplogin").click(function(){ $(this).val(""); });	$(".toplogin").blur(function(){ 		if( $(this).val() == '' ){ $(this).val("Login lub e-mail"); }	});		$(".csize").click(function(){		var siz = $(this).attr("rel");		if( siz <= 16 ){ $("#story p").css("font-size",siz+"px"); siz++; $(this).attr("rel",siz); }		else{ $("#story p").css("font-size","12px"); $(this).attr("rel","12"); }				return false;	});    $("#regform").submit(function () {        var email = $("input[name='reg_email']").val();        var pass1 = $("input[name='reg_password']").val();        var pass2 = $("input[name='reg_password2']").val();        var username = $("input[name='reg_username']").val();        $.ajax({            type: "POST",            url: "ajaxfunctions/valid_registration.php",            data: "reg_email=" + email + "&reg_password=" + pass1 + "&reg_password2=" + pass2 + "&reg_username=" + username,            beforeSend: function () {                $("#loading").fadeIn()            },            success: function (data) {                $("#loading").fadeOut();                if (data != 1) {                    $("#dialog:ui-dialog").dialog("destroy");                    $("#dialog-message").html(data);                    $("#dialog-message").dialog({                        modal: true,                        title: "Wystąpił błąd",                        buttons: {                            Zamknij: function () {                                $(this).dialog("close")                            }                        }                    })                } else {                    $("#dialog:ui-dialog").dialog("destroy");                    $("#dialog-message").html("Na podany adres email został wysłany link z kodem aktywacyjnym");                    $("#dialog-message").dialog({                        modal: true,                        title: "Wystąpił błąd",                        buttons: {                            Zamknij: function () {                                $(this).dialog("close")                            }                        }                    })                }            },            error: function () {}        });        return false    });	$("#logform").submit(function(){	var login = $("input[name='username']").val();	var pass = $("input[name='password']").val();	$.ajax({ type: "POST",		 url: "ajaxfunctions/valid_login.php",		 data: "username="+login+"&password="+pass,		 beforeSend: function(){ $("#log_loading").fadeIn(); },		 success: function(data){ $("#log_loading").fadeOut();			if( data != 1 ){				    $("#dialog:ui-dialog").dialog("destroy");                    $("#dialog-message").html(data);                    $("#dialog-message").dialog({                        modal: true,                        title: "Wystąpił błąd",                        buttons: {                            Zamknij: function () {                                $(this).dialog("close")                            }                        }                    })				}				else{ 					location.reload();				}},			 error: function(){ } });return false; });	});if (self!=top){ top.location=self.document.location; }
