window.onload=function(){
Nifty("div#box","transparent");
}

function getTimeZone()
{
  var now = new Date()
  var offset = now.getTimezoneOffset();
  xajax_SetTimeZone( offset );
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}
  }
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validateChars(object)
{
  var sValidOrd   = '0123456789-';
  var sValidSpc   = String.fromCharCode(8)+String.fromCharCode(0);
  var iKeyCode    = getkey(object);
  var bIsValidO   = (sValidOrd.indexOf(String.fromCharCode(iKeyCode)) > -1);
  var bIsValidS   = (sValidSpc.indexOf(String.fromCharCode(iKeyCode)) > -1);
  return (bIsValidS ? 1 : bIsValidO);
}

function validateChars2(object)
{
  var sValidOrd   = '0123456789';
  var sValidSpc   = String.fromCharCode(8)+String.fromCharCode(0);
  var iKeyCode    = getkey(object);
  var bIsValidO   = (sValidOrd.indexOf(String.fromCharCode(iKeyCode)) > -1);
  var bIsValidS   = (sValidSpc.indexOf(String.fromCharCode(iKeyCode)) > -1);
  return (bIsValidS ? 1 : bIsValidO);
}

function getkey(e)
{
  if (window.event)
  {
    return window.event.keyCode;
  }
  else if (e)
  {
    return e.which;
  }
  else
  {
    return null;
  }
}

function setFocus( element )
{
  element.focus()
}

function clearCache()
{
  var str_username = document.getElementById("str_username");
  var str_password = document.getElementById("str_password");
  var first_name   = document.getElementById("first_name");
  var last_name    = document.getElementById("last_name");
  var confirm_password   = document.getElementById("confirm_password");
  var landline           = document.getElementById("landline");
  var email              = document.getElementById("email");
  var address1           = document.getElementById("address1");
  var address2           = document.getElementById("address2");
  var city               = document.getElementById("city");
  var zip                = document.getElementById("zip");
  str_username.value     = "" ;
  str_password.value     = "" ;
  confirm_password.value = "" ;
  first_name.value       = "" ;
  last_name.value        = "" ;
  landline.value         = "" ;
  email.value            = "" ;
  address1.value         = "" ;
  address2.value         = "" ;
  city.value             = "" ;
  zip.value              = "" ;
}

function clearLogin()
{
  var str_username = document.getElementById("str_username");
  var str_password = document.getElementById("str_password");
  str_username.value     = "" ;
  str_password.value     = "" ;
}

function clearPass()
{
  var str_username = document.getElementById("str_password");
  var str_password = document.getElementById("confirm_password");
  str_username.value     = "" ;
  str_password.value     = "" ;
}

function clearUpdatePassword()
{
  var str_oldpassword  = document.getElementById("str_oldpassword");
  var str_password     = document.getElementById("str_newpassword");
  var confirm_password = document.getElementById("str_confirmpassword");
  str_oldpassword.value  = "" ;
  str_password.value     = "" ;
  confirm_password.value = "" ;
}

function chooseArea()
{
  var optionArea = document.getElementById('optIsWithinManila');
  var HTMLArea   = document.getElementById('isOutSideManila');
  if( optionArea.checked )
  {
    HTMLArea.style.display = 'none';
  }
  else
  {
    HTMLArea.style.display = '';
  }
}


function textCounter( field ,cntfield , maxlimit )
{
  if (field.value.length > maxlimit) 
   field.value = field.value.substring(0, maxlimit);
 else
   cntfield.value = maxlimit - field.value.length;
}
