function getStats(fName){
resim = fName;
}

jQuery(function() {
  resim = "";
  jQuery('.error').hide();
  jQuery('#loading_image').hide();
  jQuery('#UPLOAD').hide();
  jQuery('input.element*').css({backgroundColor:"#FFFFFF"});
  jQuery('input.element*').focus(function(){
    jQuery(this).css({backgroundColor:"#FFDDAA"});
  });
  jQuery('input.element*').blur(function(){
    jQuery(this).css({backgroundColor:"#CCCCCC"});
  });

  jQuery(".buttons").click(function() {
		// validate and process form
		// first hide any error messages
    jQuery('.error').hide();
	  var name = jQuery("input#file_title").val();
		if (name == "") {
      jQuery("label#file_title_error").show();
      jQuery("input#file_title").focus();
      return false;
    }
	if (resim == "") {
	 alert ('Yuklenecek resmi secmediniz!'); return false;
	}
		var aciklama = jQuery("textarea#aciklama").val();
		if (aciklama == "") {
      jQuery("label#aciklama_error").show();
      jQuery("textarea#aciklama").focus();
      return false;
    }
		var keyword = jQuery("textarea#keywords").val();
		if (keyword == "") {
      jQuery("label#keywords_error").show();
      jQuery("textarea#keywords").focus();
      return false;
    }
		var dataString='name='+ name + '&resim=' + resim + '&aciklama=' + aciklama + '&keyword' + keyword;
		document.getElementById('sonuc').style.visibility = 'hidden';
	jQuery('#loading_image').show();
	//jQuery.ajax({
     //success: function() {
	   //jQuery('#loading_image').hide();
        jQuery('#UPLOAD').show();
		//.append("<h2>Resminiz başarıyla yüklendi!</h2>")
        //.append("<p>Onaylandıktan sonra yayımlanacaktır.</p>")
        // .hide()
        //.fadeIn(1500, function() {
        //jQuery('#UPLOAD').append("<img id='checkmark' src='check.png' />");
       //});
	   document.form1.submit();
	   //document.form1.submit.reset();
      //}
     //});
    return false;
	});

});
//runOnLoad(function(){
//  jQuery("input#file_title").select().focus();
//});

function stopUpload(success,result2){
	  jQuery('#loading_image').hide()
      //$('.buttons').hide()
	  document.form1.image.value=''
	  document.getElementById('sonuc').innerHTML = success
	  document.getElementById('sonuc').style.visibility = 'visible'
	  if(result2 == 1){
	  document.form1.reset();
	  }
      return true;   
}


