function  frmmediasubmit(obj) {
    var frm = obj;
    var errs=0;
    var emailregexp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if (frm.name.value == '') {
        alert("ERROR : Please enter the name");
        obj.name.focus();
        errs += 1;
    }


    if (errs == 0 && frm.telno.value == '')   {
        alert("ERROR : Please enter the telephone number");
        obj.telno.focus();
        errs += 1;
    }
   if (errs == 0 && frm.company.value == '')  {
        alert("ERROR : Please enter the company name");
        obj.company.focus();
        errs += 1;
    }
     if (errs == 0 && frm.email.value == '')  {
        alert("ERROR : Please enter your email ID");
        obj.email.focus();
        errs += 1;
    }
    if (errs == 0 && emailregexp.test(frm.email.value) == false) {
        alert("ERROR : Invalid email ID");
        obj.email.focus();
        errs += 1;
    }
    if (errs == 0 && frm.country.value == '') {
        alert("ERROR : Please enter the country name");
        obj.country.focus();
        errs += 1;
    }

    if (errs != 0 ) return false;
    else frm.submit();   


}

function checkLogin() {

    var obj = document.frmMediaUser;

    if (obj) {
        //alert("You must enter your details before you can download docs!");
        alert("Please enter you details on this page to download the document. You only need to do this once.");
        document.frmMediaUser.name.focus();
        return false;
    }

     return false;
}

function downloadWindow(doc_id) {

    var doc_id = ((typeof doc_id == 'undefined' || doc_id == '0') ? '0' : doc_id);
    if (doc_id>0) {
        window.open('download_track.php?doc_id=' + doc_id, '', 'width=500,height=400,scrollbars=yes, resizable=yes');
        return false;
    }
    return false;
}