﻿/*displaying errors*/
var errors = new Array();
$(document).ready(function () {
    for (var i = 0; i < errors.length; i++) {
        alert(errors[i].message);
    }

});

//function gets the current url, searches for a substring (which is a parameter) and returns the part of the url
//which ends with this substring. For example, if current url is http://abc/def/ghi, then getCurrentUrlPart('def') is http://abc/def
function getCurrentUrlPart(finalSubstring) {
    var currentUrl = location.href.toString().toLowerCase();
    var index = currentUrl.indexOf(finalSubstring.toLowerCase());
    var returnUrl = currentUrl.substr(0, index + finalSubstring.length);
    return returnUrl;
}
