﻿function ShowAttachments()
{
   var bool = false;
   var question_ID = document.getElementById("ctl00_body_Question_ID");
   var sFeatures="dialogHeight: 295px; dialogWidth: 500px; center: yes; status: no;";
   var retVal = window.showModalDialog("file_upload.aspx?q=" + question_ID.value, "", sFeatures);
   if (retVal != "" && retVal != null) 
   {
   var tmp = document.getElementById("ctl00_body_AttachedFileIDs");
   tmp.value = retVal;
    bool = true; 
   };
   return bool;
}

function ShowPaymentWindow(question_id)
{
   var bool = false;
   var retVal = window.open("payment.aspx?q=" + question_id, "myWindow", "height=600,width=505,resizable=yes,location=yes");
   if (retVal==null || typeof(retVal)=="undefined") {
      alert('Betalingsvinduet er blevet blokeret af din browser/popup-blocker.');
   }

}

function countChar(obj_txt, str, e, len) {
    var obj_lbl = document.getElementById("ctl00_body_lblCount");
    var unicode = e.charCode ? e.charCode : e.keyCode
    var new_len = 0;
    if (unicode != 13) {
        new_len = (len - str.length);
        var txt_len = obj_lbl.innerText;
        if (new_len < 0) {
            obj_txt.value = obj_txt.value.substring(0, str.length + (parseInt(txt_len) + parseInt(new_len)));
            obj_lbl.innerText = "0";
        } else {
            obj_lbl.innerText = new_len;
        }
    }
}
