function goTo(Url)
{
        location.href = Url;
}

function openPicture(ID)
{
        var m_nTop    = (screen.height/2)-375/2;
        var m_nLeft   = (screen.width/2)-500/2;;
        window.open('/gallery/?imageID=' + ID,'simpleGallery',"width=100,height=100,status=no,toolbar=0,menubar=0,location=0,scrollbars=0,top="+m_nTop+",left="+m_nLeft);
}

function resetForm(frmSrc,Message)
{
        if(confirm(Message))
        {
                frmSrc.reset();
        }
}

function sendForm(frmSrc,Message)
{
        passIt = true;
        for(i = 0; i < frmSrc.elements.length; i++)
                if(frmSrc.elements[i].value == "")
                        passIt = false;

        if(!passIt)
        {
                alert(Message);
        }
        else
        {
                frmSrc.submit();
        }
}

function replaceText(fldSrc,Text)
{
        fldSrc.value = replaceString(fldSrc.value, Text, "");
}

function replaceString(sString, sReplaceThis, sWithThis)
{
        if (sReplaceThis != "" && sReplaceThis != sWithThis)
        {
                var counter = 0;
                var start = 0;
                var before = "";
                var after = "";

                while (counter<sString.length)
                {
                        start = sString.indexOf(sReplaceThis, counter);

                        if (start == -1)
                        {
                                break;
                        }
                        else
                        {
                                before = sString.substr(0, start);
                                after = sString.substr(start + sReplaceThis.length, sString.length);
                                sString = before + sWithThis + after;
                                counter = before.length + sWithThis.length;
                        }
                }
        }

        return sString;
}

function showBigImage(File)
{
        myWin= open("", "displayWindow", "width=100,height=100,status=yes,toolbar=0,menubar=0,location=0,scrollbars=0");

         myWin.document.open();

         myWin.document.write("<html><head><title>Просмотр изображения");
         myWin.document.write("</title></head><body style='margin:0;'>");
         myWin.document.write("<img src='/images/upload/" + File + "' onload='self.resizeTo(this.width,this.height+50);focus();'>");
         myWin.document.write("</body></html>");
         myWin.document.close();
}

