// JavaScript Document
function set_time() {
	var ids=document.getElementById('ids').value;
php(CONFIG_HOST+'/js.php?action=refresh&ids='+ids);
		
	var setr=setTimeout("set_time()",1000);}
	
   
function getnow_f (id,price) {
		document.getElementById('pg_logo').src=document.getElementById('pigeon_img_'+id).src
		document.getElementById('pg_title').innerHTML=document.getElementById('title_'+id).innerHTML;
		document.getElementById('pg_price').innerHTML=price;
		document.getElementById('pigeon_id').value=id;
		$('#getnow_d').dialog('open');}
function naddai_f (id) {
		var price=document.getElementById('cur_price_'+id).value;
		var minimal=document.getElementById('cur_minimim_'+id).value;
		price=price*1;
		minimal=minimal*1;
		minimal=(minimal+price);
		document.getElementById('pg1_logo').src=document.getElementById('pigeon_img_'+id).src
		document.getElementById('pg1_title').innerHTML=document.getElementById('title_'+id).innerHTML;
		document.getElementById('pd1_price').value=minimal;
		document.getElementById('pid').value=id;
		document.getElementById('min_p').value=minimal;
		document.getElementById('min_p_text').innerHTML=minimal;
		
		$('#naddai_d').dialog('open');}

var mybuttons_SM = {}
mybuttons_SM[jq_close] = function() {
$(this).dialog('close');};
mybuttons_SM[jq_setmoney] = function() {
					var p=document.getElementById('pd1_price').value;
					var min_p=document.getElementById('min_p').value;
					if (p >= min_p) document.getElementById('naddavane_forma').submit();
				};
				
var mybuttonsBN = {}
mybuttonsBN[jq_close] = function() {
$(this).dialog('close');};
mybuttonsBN[jq_getnow] = function() {
					document.getElementById('forma_kupi').submit();
				};

$(function() {

   	$('#getnow_d').dialog({
			resizable: true,
			width: 400,
			autoOpen: false,
			modal: true,
			show: 'slide',
			overlay: {
				backgroundColor: '#333',
				opacity: 0.5
			},
			buttons: mybuttonsBN
		});
   	$('#naddai_d').dialog({
			resizable: true,
			width: 400,
			autoOpen: false,
			show: 'slide',
			modal: true,
			overlay: {
				backgroundColor: '#333',
				opacity: 0.5
			},
			buttons:mybuttons_SM
		});
	set_time();
	
		   })
