function tryAddComment( object, id ) {
	//object
	//id
	var u = getValue( 'comm_nick' );
	var t = getValue( 'comm_text' );
	if( t != undefined && t != '' ){
		var ajax	= new myAjax();
		ajax.action = 'tryAddComment';
		ajax.post( 't='+t+'&u='+u+'&object='+object+'&id='+id );
		ajax.onLoad = function() {
			if( this.response == 'ok' ) {
				window.location.reload();
			}
		}
	}
	else {
		alert( 'Wprowadź treść komentarza!' );
	}
}
						 
function try_contact() {
	var h	= get( 'hashcode' );	
	var e 	= getValue( 'email' );
	var b 	= getValue( 'body' );
	if( ( e == '' ) || ( b == '' ) ) {
		alert( 'Wprowadź swój adres e-mail i wpisz wiadomość' );
	} else {
		h.value = 'foto';
		var ajax	= new myAjax();
		hide( 'div_contact' );
		ajax.action = 'try_contact';
		ajax.post( 'email=' + e + '&body=' + b + '&hashcode='+h.value, 'contact_message' );
		ajax.onLoad = function() {
			if( this.response == 'ok' ) {
				show( 'contact_message_send' );
			} else {
				show( 'div_contact' );
			}
		}
	}
}

function pollSave( id ) {
	id = id.toString();
	var poll = document.forms[ 'poll_' + id ];
	var bradio = poll.elements[ 'question_' + id ];
	var ret = 'poll_questions_' + id;
	var q = getRadioValue( bradio );
	var reg = new RegExp( '[0-9]+' );
	if( !q.match( reg ) ) {
		alert( 'Proszę wybrać którąś z odpowiedzi' );
	} else {
		hide( ret );
		var ajax = new myAjax();
		ajax.action = 'pollSave';
		ajax.post( 'poll='+id+'&answer=' + q, ret );
		ajax.onLoad = function() {
			show( ret );
		}
	}
}

function ajax_getImage( id, object ){
	var ajax	= new myAjax();
	ajax.action = 'pobierz-obrazek';
	ajax.post( 'id=' + id );
	ajax.onLoad = function() {
		var re_arr = new Array();
		re_arr = this.response.split( '|', 2 );
		if( re_arr[0] == 'ok' ) {
			object.src = re_arr[1];
		}
		else {
			alert( re_arr[0] );
		}
	}
}

