$(document).ready(function() {
 	$('img[src$=.png]').ifixpng();
	$(".datepicker").datepicker({buttonText:'Choose a date...',showOn:'both', buttonImage:'images/calendar.png', buttonImageOnly: true});

});

function submitP(id) {
 data = "poll="+$('#'+id+' input[name=pollName]').val();
 data+= "&val="+$('#'+id+' input[type=radio]:checked').val();
 $('#'+id).load("poll.php?"+data);
}

function submitF(id, right) {
 if (right) {
  s1 = 'bottomLeft';
  s2 = 'topRight';
 }
 else {
  s1 = 'bottomRight';
  s2 = 'topLeft';
 }
 bad = false;
 $('form#'+id).find("input, textarea").not('*[alt=" "]').each(function() {
  $.watermark.hide(this);
  if ($(this).data("qtip")) $(this).qtip("destroy");
  $(this).css('border', '1px solid #ccc');
  if (!$(this).val()) {
    bad = true;
    if ($(this).attr('title')) {
     try {
      $(this).qtip({
        position: {corner: {tooltip: s1, target:s2}},
        style: {name:'red', tip: true},
        hide: false,
        show: {when: false, ready: true}
      });
     }catch(e){}
    }
    $(this).css('border', '1px solid #dd8888');
    $.watermark.show(this);
  }
 });
 if (!bad)
  $('form#'+id).submit();
}