// Browser check
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);
IS_IE5Mac = IS_IE && IS_Mac && IS_DOM;

/* General Site Functions */
function imgOn(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "on.src");
  }
}
  
function imgOff(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "off.src");
  }
}


function OpenWindow(sPath, iHeight, iWidth ) {
  var winName = "newWind" + Math.round(Math.random() * 9999999);
  window.open(sPath, winName, 'height=' + iHeight + ',width=' + iWidth + ',scrollbars=no,resizable=no,top=20,left=20')
  }

// image swapper
function changeImages() 
{
  if (document.getElementById) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

// old functions which may be needed on some pages

function setPointer(theRow, thePointerColor,thefontcolor) {
    if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
        return false;
    }

    var row_cells_cnt = theRow.cells.length;
    for (var c = 0; c < row_cells_cnt; c++) {
        theRow.cells[c].bgColor = thePointerColor;
		theRow.cells[c].style.cssText='font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: '+thefontcolor+'; text-decoration: none;cursor: hand;';

    }

    return true;
}

function MM_goToURL() {
	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_findObj(n, d) {
  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 check_form(oFrm)
{

//alert(oFrm.name);  style="border-style:solid;border-color:red;"
//alert(oFrm.elements.length);

  var doReturnFalse = 0;

  for (var i = 0; i<oFrm.elements.length; i++)
  {
    if (i != 7 && i != 10 && i != 11 && i != 15 && i != 16 && i != 17)
    {
      if (oFrm.elements[i].value == "")
      {
        document.getElementById('lbl1').style.color = "red"
        document.getElementById('lbl1').style.fontWeight = "bold";
        oFrm.elements[i].style.border = "solid 2px #ff0000";
        oFrm.elements[i].id = "Red";
        doReturnFalse = 1;
      }
      else
      {
        if (oFrm.elements[i].id == "Red")
        {
          oFrm.elements[i].style.border = "";
          oFrm.elements[i].id = "";
        }
      }
    }
  }
  if (oFrm.password.value != oFrm.password2.value)
  {
    document.getElementById('lbl2').style.color = "red";
    document.getElementById('lbl2').style.fontWeight = "bold";
    document.getElementById('lbl2').innerHTML = " &laquo; Your Passwords Do Not Match";
    oFrm.elements[12].style.border = "solid 2px #ff0000";
    oFrm.elements[13].style.border = "solid 2px #ff0000";
    doReturnFalse = 1;
  }
    else
  {
    if (oFrm.password.value != "" && oFrm.password2.value != "")
    {
      document.getElementById('lbl2').innerHTML = "";
      oFrm.elements[12].style.border = "";
      oFrm.elements[13].style.border = ""; 
    }
  }
  if (oFrm.user_tc.checked == false)
  {
    //alert (oFrm.user_tc.checked);
    document.getElementById('lbl3').style.color = "red";
    document.getElementById('lbl3').style.fontWeight = "bold";
    document.getElementById('lbl3').innerHTML = " &laquo; Please Accept The Terms & Conditions.";
    doReturnFalse = 1;
  }
  else
  {
    document.getElementById('lbl3').innerHTML = "";
  }
  
  if (doReturnFalse == 1)
  {
    return false;
  }
  else
  {
    return true;
  }
}

function check_pass(oFrm)
{
  var doReturnFalse = 0;

  if (oFrm.password.value != oFrm.password2.value)
  {
    document.getElementById('lbl2').style.color = "red";
    document.getElementById('lbl2').style.fontWeight = "bold";
    document.getElementById('lbl2').innerHTML = " &laquo; Your Passwords Do Not Match";
    return false;
  }
  else
  {
    return true;
  }
}