function new_message(){
$("panel_message").innerHTML = '<div align="center" style="height:40px; padding-top:80px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>';
Effect.BlindDown('panel_message');
new Ajax.Updater('panel_message', 'ajax.php?plugin=messages&action=new_message' , {asynchronous:true, evalScripts:true});
    
    
}

function readmsg(numer,idk){	
$("panel_message").innerHTML = '<div align="center" style="height:50px; padding-top:40px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>'; 
Effect.BlindDown('panel_message');
new Ajax.Updater('panel_message', 'ajax.php?plugin=messages&action=read_message&produkt='+ numer +'&idk='+ idk , {asynchronous:true, evalScripts:true});

}


function repmsg(numer,idk){	
$("panel_message").innerHTML = '<div align="center" style="height:50px; padding-top:40px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>'; 
Effect.BlindDown('panel_message');
new Ajax.Updater('panel_message', 'ajax.php?plugin=messages&action=repmessage&produkt='+ numer +'&idk='+ idk , {asynchronous:true, evalScripts:true});
    
}







function send_form(){
var tab='panel_message';
var url = 'ajax.php?plugin=messages&action=zapisz' ;
new Ajax.Request(url, {
method: 'post',
parameters: { country: $F('country'), search: $F('country_hidden'), tytul: $F('tytul'), tekst: $F('tekst') },
onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = '<div align="center" style="height:40px; padding-top:80px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>' ; },

onSuccess: function(transport) {
$('panel_message').innerHTML = transport.responseText;
Effect.BlindUp.delay(1.5, 'panel_message');
}
	});

}



function reply_form(){
var tab='panel_message';
var url = 'ajax.php?plugin=messages&action=zapisz' ;
new Ajax.Request(url, {
method: 'post',
parameters: { touser: $F('touser'), reply: $F('reply'), tytul: $F('tytul'), tekst: $F('tekst') },
onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = '<div align="center" style="height:40px; padding-top:80px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>' ; },

onSuccess: function(transport) {
$('panel_message').innerHTML = transport.responseText;
Effect.BlindUp.delay(1.5, 'panel_message');
}
	});

}


/*
function showmessages(numer,idk){	
	advAJAX.setDefaultParameters(
	{
		onLoading : function(obj) { document.getElementById(obj.tag).innerHTML = '<div align="center" style="height:40px; padding-top:80px;"><img src="ajax/img/load.gif" width="220" height="19" border="0"></div>' ; },
   		onSuccess : function(obj) { document.getElementById(obj.tag).innerHTML = obj.responseText ; },
   		onError : function(obj) { document.getElementById(obj.tag).innerHTML = "err..."; }
	});
	advAJAX.get({ url : "ajax.php?mod=account&action=messages_list&produkt=" + numer +"&idk="+ idk , tag: "showmessages" });
}
*/

function english_ad(numer,idk) {
$("dv_english").innerHTML = "<img src='ajax/img/loadc.gif' width='100' height='9' border='0'>"; 
var dupe =$F('ad_opis');
  var url = "ajax.php?plugin=adopcje&action=english_adn&id=" + numer +'&type='+ dupe  ;
new Ajax.Request(url, {
	 method: 'get',
onSuccess: function(transport) {
new Ajax.Updater('ad_english', 'ajax.php?plugin=adopcje&action=english_adn&id=' + numer +'&type='+ dupe, {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		     $("dv_english").innerHTML = ""; 
		   
		}
	});
 
}

    
function german_ad(numer,idk) {
       $("dv_german").innerHTML = "<img src='ajax/img/loadc.gif' width='100' height='9' border='0'>"; 
var dupe =$F('ad_opis');
	var url = "ajax.php?plugin=adopcje&action=german_adn&id=" + numer +'&type='+ dupe  ;
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
		new Ajax.Updater('ad_german', 'ajax.php?plugin=adopcje&action=german_adn&id=' + numer +'&type='+ dupe, {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		    $("dv_german").innerHTML = "";  
		   
		}
	});
 
}




function usun_imgad(numer,idk) {

	var url = "ajax.php?plugin=adopcje&action=usun&id=" + numer +'&foto='+ idk  ;
	new Ajax.Request(url, {
	  method: 'get',
	 

	  onSuccess: function(transport) {
	  	

	  	
	  	Effect.Appear('image_' +idk);
		new Ajax.Updater('galeria', 'ajax.php?plugin=adopcje&action=galeria&ledit=' + numer+'&ajax=1', {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		   
		   
		},
		
		onLoading: function(transport) {
		
				Effect.Fade('image_' +idk);
	
		}
	});
 
}


function add_tube(numer) {
    
Effect.Appear('tubegaleria');
		new Ajax.Updater('tubegaleria', 'ajax.php?plugin=adopcje&action=add_tube&ledit=' + numer, {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		   
    }
    
    
    
function gal_tube(numer) {
    
Effect.Appear('tubegaleria');
		new Ajax.Updater('tubegaleria', 'ajax.php?plugin=adopcje&action=tubegaleria&ledit=' + numer, {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		   
    }



function save_tube(numer) {



	var url = "ajax.php?plugin=adopcje&action=tubegaleria&ledit=" + numer+'&save=1' ;
	new Ajax.Request(url, {
	  method: 'post',
	  parameters: { urlt: $F('urlt')},




	  onSuccess: function(transport) {
	
		   $('tubegaleria').innerHTML = transport.responseText;
		}
	});
 
}


function usun_tube(numer,idk) {

	var url = "ajax.php?plugin=adopcje&action=usun_tube&id=" + numer +'&foto='+ idk  ;
	new Ajax.Request(url, {
	  method: 'get',
	 

	  onSuccess: function(transport) {
	  	

	  	
	  	Effect.Appear('tubegaleria');
		new Ajax.Updater('tubegaleria', 'ajax.php?plugin=adopcje&action=tubegaleria&ledit=' + numer, {asynchronous:true, evalScripts:true, encoding:'iso-8852-2'});	
		   
		   
		}
	});
 
}

function checkchip(numer,idk){





	var url = "ajax.php?mod=adopcja&action=chip&produkt=" + numer +"&idk="+ idk ;
	new Ajax.Request(url, {
  method: 'get',





	  onSuccess: function(transport) {
	
		   $('chip_check').innerHTML = transport.responseText;
		}
	});


}


function prestatus(which) {
    
    
 var status = document.getElementById("ad_status");
 var poka =status.selectedIndex;


if(poka=="1"){
 Effect.Appear('div_pesel');
}else{
 Effect.Fade('div_pesel');    
}

if(poka!="0"){

  Effect.Appear('div_uwagi');
}else{
 Effect.Fade('div_uwagi');    
}


    
    }
