﻿function showErrorValidationDiv(element)
{
    if(window.location.search.toLowerCase().indexOf("errorinvalidation") > -1)
    {
        showPopupErrorValidation("ErrorValidationDiv");
    }
}

function showPopupErrorValidation(divId)
{    
    if(!ns && !ie && !ns6) 
        return;
    
    if (ie)     
        popup=eval('document.all.' + divId + '.style');
    else if (ns) 
        popup=eval('document.layers["' + divId + '"]');
    else if (ns6) 
        popup=eval('document.getElementById("' + divId + '").style');
    
    document.getElementById("opacityDiv").style.filter = "progid:DXImageTransform.Microsoft.BasicImage(opacity = 0.5)";
    document.getElementById("opacityDiv").style.backgroundColor = "InactiveBorder";
    document.getElementById("opacityDiv").style.left = "0px";
    document.getElementById("opacityDiv").style.top = "0px";
    document.getElementById("opacityDiv").style.padding = "0px";
    document.getElementById("opacityDiv").style.zIndex = "1";
    document.getElementById("opacityDiv").style.borderWidth = "0px";
    document.getElementById("opacityDiv").style.position = "absolute";
    document.getElementById("opacityDiv").style.height = document.body.scrollHeight;
    document.getElementById("opacityDiv").style.width = document.body.scrollWidth;
    document.getElementById(divId).style.zIndex = "2";
    document.getElementById(divId).className="modalpopupDiv";
    
    document.getElementById(divId).innerHTML = "<table width=\"100%\" style=\"height: 100%\" cellpadding=\"0\"  cellspacing=\"0\" border=\"0\">" +
    "<caption></caption>" +
        "<tr>" +
            "<td style=\"width: 100%\">" +
                "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" dir=\"ltr\">" +
                "<caption></caption>" +
                    "<tr>" +
                        "<td class=\"creItemErrorsTitleLeft\">" +
                        "</td>" +
                        "<td class=\"creItemErrorsTitleCenter fontTitle\">" +
                            "שגיאה בהזדהות למערכת" +
                        "</td>" +
                        "<td class=\"creItemErrorsTitleRight\">" +
                        "</td>" +
                    "</tr>" +
                "</table>" +
            "</td>" +
        "</tr>" +
        "<tr style=\"vertical-align: top;text-aling: right; direction: rtl ; padding: 10px;\">" +
            "<td style=\"text-aling: right;\">" +
                "<span class=\"errBullet\">*</span> נא למלא שם משתמש בן 6 תווים <br />" +
                "<span class=\"errBullet\">*</span> נא למלא תעודת זהות (9 ספרות) כולל ספרת ביקורת <br />" +
                "<span class=\"errBullet\">*</span> נא להקליד סיסמא בת 8 תווים" +
            "</td>" +
        "</tr>" +
        "<tr>" +
            "<td align=\"left\">" +
                "<input type=\"button\" id=\"closeErrBtn\" class=\"closeErrBtn\" onclick=\"hideLogInErrorValidationConfirmDiv(this);\"/>" +
            "</td>" +
        "</tr>" +
    "</table>";
    displayElement();
}

function displayElement()
{
    var agent=navigator.userAgent.toLowerCase();
    if (ie)
    {
        documentWidth = (centerElement().offsetWidth)/2+centerElement().scrollLeft-(winw/2);
        documentHeight = (centerElement().offsetHeight)/2+centerElement().scrollTop-(winh/2);
    }
    else if (ns)
    {
        documentWidth=window.innerWidth/2+window.pageXOffset-(winw/2);
        documentHeight=window.innerHeight/2+window.pageYOffset-(winh/2);
    }
    else if (ns6)
    {
        documentWidth=self.innerWidth/2+window.pageXOffset-(winw/2);
        documentHeight=self.innerHeight/2+window.pageYOffset-(winh/2);
    }
    popup.left = documentWidth+calculate;
    popup.top = documentHeight+calculate;
    setTimeout("displayElement()",50);
}

function centerElement()
{
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function SendForm() 
{
    document.forms[0].action = document.location.href.replace("http://", "https://");
    document.forms[0].submit();
}

function hideLogInErrorValidationConfirmDiv(element) 
{
    document.getElementById("opacityDiv").innerHTML = ""; 
    document.getElementById("opacityDiv").style.filter = "";   
    document.getElementById("opacityDiv").style.backgroundColor = "";
    document.getElementById("opacityDiv").style.left = "0px";
    document.getElementById("opacityDiv").style.top = "0px";
    document.getElementById("opacityDiv").style.padding = "0px";
    document.getElementById("opacityDiv").style.zIndex = "-1";
    document.getElementById("opacityDiv").style.borderWidth = "0px";
    document.getElementById("opacityDiv").style.position = "absolute";
  
    document.getElementById("ErrorValidationDiv").innerHTML = "";    
    document.getElementById("ErrorValidationDiv").style.zIndex = "-1";
    document.getElementById("ErrorValidationDiv").style.position = "absolute";
    document.getElementById("ErrorValidationDiv").className="";
    
    document.getElementById("ErrorTimeOutDiv").innerHTML = "";    
    document.getElementById("ErrorTimeOutDiv").style.zIndex = "-1";
    document.getElementById("ErrorTimeOutDiv").style.position = "absolute";
    document.getElementById("ErrorTimeOutDiv").className="";
}
