/* -------------- MPS functions ---------------- */

//function dialogLoaded()
//{
//    testF2H();
//}

function showMpsDialog()
{
  Element.hide('LoginWaitDiv');
  Element.show('PageDialog');
}

function hideMpsDialog()
{
  Element.hide('LoginWaitDiv');
  Element.hide('PageDialog');
  Element.hide('PageMask');
}

function retest()
{
    alert('retest')
    Element.hide('PageDialog');
    Element.show('LoginWaitDiv');
    Element.show('PageMask');
    testF2H();
}

/* --------------------------------------------- */
 function GotoMenuItem(item)
 {
   if (!item || !item.childNodes || !item.childNodes.length)
   {
     return;
   }
   var span = null;
   for(i = 0; i < item.childNodes.length; i++)
   {
     if (item.childNodes[i].tagName == 'SPAN')
     {
       span = item.childNodes[i];
       break;
     }
   }
   if (span)
   {
     for (i = 0; i < span.childNodes.length; i++)
     {
       if (span.childNodes[i].tagName == 'A')
       {
         window.location.href = span.childNodes[i].href;
       }
     }
   }
 }

function submitLogin(inputToIgnore)
{
  if ($F('loginUsername') == inputToIgnore)
  {
    return;
  }
  var rmb = $('loginRememberMe');
  var sf = $('sLoginForm');
  if (sf)
  {
    sf.user.value = $F('loginUsername');
    sf.pass.value = $F('loginPassword');
    if (rmb && rmb.checked)
    {
        sf.rmb.value = 'on';
    }
    else
    {
      sf.rmb.value = '';
    }
    sf.submit();
  }
}

function submitDialogLogin(inputToIgnore)
{
  if ($F('wloginUsername') == inputToIgnore)
  {
    return;
  }
  var rmb = $('wloginRememberMe');
  var sf = $('sLoginForm');
  if (sf)
  {
    sf.user.value = $F('wloginUsername');
    sf.pass.value = $F('wloginPassword');
    if (rmb && rmb.checked)
    {
        sf.rmb.value = 'on';
    }
    else
    {
      sf.rmb.value = '';
    }
    sf.submit();
  }
}

function cancelDialogMask()
{
  Element.update('progressIcon', '');
  Element.hide('PageMask');
  Element.hide('PageDialog');
}

function handleLoginKeyPress(evt)
{
  var e = evt || window.event;
  var code = e.charCode || e.keyCode;
         
  if (code == 13)
  {
    return false;
  }
}

function SwitchActiveState(objActive, strState, inputName) {	
  var imgPath = "images/";
  if (ROOT_DIR)
  {
    imgPath = ROOT_DIR + imgPath;
  }
  var name = inputName || objActive.name;
  if (strState == 'on') {
    document.getElementById(name + "_left").src = imgPath + "input_active_left.png"; 
    document.getElementById(name + "_right").src = imgPath + "input_active_right.png"; 
    objActive.className = 'TextboxActive';
  } else {
    document.getElementById(name + "_left").src = imgPath + "input_left.png"; 
    document.getElementById(name + "_right").src = imgPath + "input_right.png"; 
    objActive.className = 'Textbox';
  }
}


try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {} // correcting flickering menu in IE6

function GoToURL(strURL) {
		window.location = strURL;
	}
	
function printTerms(){
win=window.open("","","width=10 height=10");
win.blur()
win.document.location="<%= this.GetTermsLink() %>"
win.print()
win.close()
}

function PopupPic(sPicURL) { 
     window.open( "/templates/NewWindowPopUp.aspx?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
   }
	
	
