//This will get the current date for the user
var d = new Date(),curr_date = d.getDate(),curr_month = d.getMonth() + 1,curr_year = d.getFullYear();
var player = window.opener?top.window.opener.GetPlayer():{} ;
/* ------------------ this is ONLY for debugging ----------- */
if (!player.GetVar) player={
    GetVar : function(idx) {
        return {printTitle:"Ο συγκεκριμένος τρόπος πρόσβασης στην αναφορά, δεν εμφανίζει τις απαντήσεις που δόθηκαν.", printUserName:"Άγνωστος"}[idx]
	}
}
/* ------------------ the above is ONLY for debugging ----------- */
$(function() {
  if (window.print) {
    $("#print").text("Εκτύπωση").on("click",function() { window.focus(); window.print() })
    $("#printDiv").show();
  }
  var title = player.GetVar("printTitle"), userName = player.GetVar("printUserName"), schoolName = player.GetVar("printSchoolName");
  $("#title").html(title);
  $("#userName").html(userName);
  $("#schoolName").html(schoolName);
  $("#date").html(curr_date + "/" + curr_month + "/" + curr_year);
  var numberOfAnswers = $(".answer").length;
  for (var i=1;i<=numberOfAnswers;i++) {
    var $content = $("#answer"+i);
    var c = player.GetVar("C"+i);
    c=c?c.replace(/\n/g,"<br/>"):"Δεν δόθηκε απάντηση"
    // window.console && console.log(c);
    //$content.html("<h3>Κείμενο #"+i+":</h3>");
    $content.append("<p>"+(c)+"</p>");
  }
});
