function LoadPage(PageName){
  parent.location.href = PageName;
  if (arguments[1] == null) parent.location.target = '_self';
  else parent.location.target = arguments[1];
}

function OpenPage(url, popup, target, feature){
    if (feature == null) feature = 'height=575, width=795, top=0, left=0, directories=no, location=no, menubar=no, status=no, titlebar=no, toolbar=no, resizable=yes, scrollbars=yes';
    if (popup) window.open(url, target, feature);
    else parent.location.href = url;
}

function SubmitForm(form,method,url)
{
  if (arguments[3] == null) document.getElementsByName(form)[0].target = '_self';
  else document.getElementsByName(form)[0].target = arguments[3];

  document.getElementsByName(form)[0].method = method;
  document.getElementsByName(form)[0].action=url;
  document.getElementsByName(form)[0].submit();
}

function getCurrentDate(){
   var d, s = "";
   d = new Date();
   s += d.getYear() + "/";
   s += (d.getMonth() + 1) + "/";
   s += d.getDate();
   return(s);
}

function CheckPassword(password,repassword){
	if (document.all[password].value == document.all[repassword].value) return true;
	alert("The passwords you typed do not match. Type the new password in both text boxes.");
	return false;
}

function checkStringLen(name,strlen)
{
    var fval = document.all[name].value;
    if (fval.length > strlen)
    {
      alert("The maximum number of characters exceeds limit of " + strlen)
      document.all[name].value = document.all[name].value.substr(0,strlen-1);
    }
}

function OpenModalWnd(url,features){
   window.showModalDialog(url,"",features);
}

/*
function SubmitIntoPopup(form,method,url,feature)
{
    if (feature == null) feature = 'height=300,width=400,left=50,top=50,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes';
    else feature = feature + ',left=50,top=50,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes';

    window.open('','_trimapPopup', feature);
    document.all[form].target = '_trimapPopup';
    document.all[form].method = method;
    document.all[form].action = url;
    document.all[form].submit();
}
*/
function submitSmartLookup (formName, controlName, controlValue, actionUrl) {

    window.opener.document.all[controlName].value = controlValue;

    window.opener.document.all[formName].target = window.opener.name;
    window.opener.document.all[formName].method = 'post';
    window.opener.document.all[formName].action = actionUrl;
    window.opener.document.all[formName].submit();
    window.close();
}

function submitSmartLookupNew (formName,controlName, controlValue, actionUrl) {
	alert(window.opener.document.documentElement.form);
    window.close();
}

function SubmitAndClose(form,method,url)
{
  if (arguments[3] == null) document.all[form].target = '_self';
  else document.all[form].target = arguments[3];

  document.all[form].method = method;
  document.all[form].action = url;
  document.all[form].submit();
  window.close();
}

function setFocus(input){
	document.all[input].focus();
	document.all[input].setActive();
}

function closeWindow () {
    window.close();
}

function replicate(str,no){
    var currStr = "";
    for(var i=1;i<=no;i++) currStr = currStr + str;
    return currStr;
}

