function openNewWindow(page, wname, wi, he, extra)
{
	l = (window.screen.width - wi) / 2;
	t = (window.screen.height- he) / 2;

	window.open(page, wname,
		'width=' + wi + ',' +
		'height=' + he + ',' +
		'left=' + l + ',' +
		'top=' + t + ',' +
		(extra ? extra : "scrollbars=1,resizable=1")
	);
}

function getIlces(ajaxURL)
{
	$.ajax(
			{			  
			   beforeSend: function(){					
					$("#ilceler").attr('class','select-d');				 
			   },
			   complete: function(){			      	
					$("#ilceler").attr('class','select-f');					
			   },
			  
			  type: "POST",			  
			  url   : ajaxURL,
			  data  : "data[Emlak][il_id]=" + $('#iller').val(),
			  cache: false,			  
			  success: function(html){
			  			$("#ilceler").html(html);
						}
			}				
		);
}

function getSemts(ajaxURL)
{

	$.ajax(
			{			  
			   beforeSend: function(){					
					$("#semtler").attr('class','select-d');				 
			   },
			   complete: function(){			      	
					$("#semtler").attr('class','select-f');					
			   },
			  
			  type: "POST",			  
			  url   : ajaxURL,
			  data  : "data[User][ilce_id]=" + $('#ilceler').val(),
			  cache: false,			  
			  success: function(html){
			  			$("#semtler").html(html);
						}
			}				
		);
}

function isOnlyNumbers(elem) {
    var str = elem.val();
    var re = /^\d+$/;
    if (!str.match(re)) {        
        return false;
    } else {
        return true;
    }
}

function showDialog(btitle, message, type) {
	
	if(type=='success')
		var cls = 'ui-dialog-green';
	else if(type=='error')
		var cls = 'ui-dialog-red';
	else if(type=='warning')
		var cls = 'ui-dialog-yellow';
	else if(type=='auth')
		var cls = 'ui-dialog-red';
	 
	$( "#dialog-modal" ).remove();
	$( "#dialog:ui-dialog" ).dialog( "destroy" );	
	$('<div id="dialog-modal"></div>').appendTo('body');
	$('#dialog-modal').html('<p>'+message+'</p>');
	$('#dialog-modal').dialog({
			height: 140,
			modal: true,
			title: btitle,
			dialogClass: cls,
			buttons: { "Tamam": function() { $(this).dialog("close"); } }
		});
}

$(document).ready(function()
{
$("#id_search").keydown(function(event) {
     if(event.keyCode == 13){    
       checkIlanNo();
       return false;
     }
  });


});
