
	$(document).ready(function(){
	  $("#firma").focus();
	});
    $("input, select, textarea").focus(function () {
         $(this).css('border','1px solid #930');
    });
	$("input, select, textarea").blur(function () {
         $(this).css('border','1px solid #CCC'); 
    });
/*--------------------------------------------------Sys-----------------------------------------------------*/
function deleteImg (file)
{
    $(document).ready(function() { 
		$.blockUI({ message: $('#dialog'), css: { width: '275px' } }); 
		$('#sil').click(function() { 
            // update the block message 
            $.blockUI({ message: "<h5>Siliniyor..</h5>" }); 
            $.ajax({type:'GET', url: '/ashx/sys.ashx', data:'o=sil&f=' + file, 
					success: function(msg)
					{
						// unblock when remote call returns 
						$.unblockUI();
						//alert("Dosya başarıyla silindi." +msg);
						getImages();
					},
					error: function(xhr, ajaxOptions, thrownError)
					{
						$.unblockUI();
						setDialog("Oluşan bir hata yüzünden dosya silinemedi. Lütfen yeniden deneyiniz.");
					}
            })
        }); 
 		//
        $('#iptal').click(function() {
            $.unblockUI(); 
            return false; 
        }); 
    }); 
	
}
function getImages()
{
	$.ajax({type:'GET', url: '/ashx/sys.ashx', data:'o=images', 
		success: function(msg)
		{
			if(document.getElementById('imageDiv'))
			{
				$('#popup').remove('#imageDiv');
			}
			$('#popup').append("<div id='imageDiv'></div>");
			//document.write(msg);
			$('#imageDiv').html(msg);
		},
		error: function(xhr, ajaxOptions, thrownError)
		{
			setDialog("Bir hata oluştu, lütfen yeniden deneyiniz.");
		}
    });
}
function getImage(image)
{
	if(document.getElementById('image'))
	{
		document.getElementById('gDialog').removeChild(document.getElementById('image')); //$('#gDialog').remove('#image'); çalışmadı burada nedense...
	}
	if(document.getElementById('h6'))
	{
		document.getElementById('gDialog').removeChild(document.getElementById('h6')); 
	}
	var img = document.createElement('img');//line
	img.setAttribute('id', 'image' );
	img.setAttribute('src', '/rsm/hbr/' +image);
	$('#gDialog').append(img);
	$.blockUI({ message: $('#gDialog'), css:{'min-width':'400px'} });  
	$('.blockOverlay').attr('title','Resmi Kapat').click($.unblockUI);	
}
function setDialog(message)
{
			if(document.getElementById('image'))
			{
				document.getElementById('gDialog').removeChild(document.getElementById('image')); //$('#gDialog').remove('#image'); çalışmadı burada nedense...
			}
			if(document.getElementById('h6'))
			{
				document.getElementById('gDialog').removeChild(document.getElementById('h6')); 
			}
			var h6 = document.createElement('h6');//line
			h6.setAttribute('id', 'h6');
			h6.setAttribute('style', 'text-align:left; font-weight:bold;');
			h6.innerHTML= message;
			$('#gDialog').append(h6);
			$.blockUI({ 
            message: $('#gDialog'), 
            fadeIn: 700, 
            fadeOut: 700, 
            timeout: 3500, 
            showOverlay: true, 
            centerY: false, 
            css: { 
                width: '350px', 
                top: '10px', 
                left: '', 
                right: '10px', 
                border: 'none', 
                padding: '5px', 
                backgroundColor: '#000', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px', 
                opacity: .6, 
                color: '#fff' 
				} 
			}); 
}
function Submit()
{
	var a= $('input#baslik, input#Hidden, input#tarih, textarea, select').serializeArray();
	      jQuery.each(a, function(i, field){
        alert(field.value);
      });
}
function cval (id, val)
{
	$(id).value= val;
	$('#Hidden').value=val;
	$('#tmpt').value= 'Seçilen dosya: ' +$(id).value;
}

