function subPage (vcPage)
{
  document.forms.main.action = vcPage;
  document.forms.main.submit();
}

function UpdFld (vcFld, vcVal)
{   
 document.forms[0][vcFld].value = vcVal;
}

function NumChk (vcFld, viNoDec)
{
   var vdNum = Number(document.forms[0][vcFld].value);

   if (isNaN(vdNum) == true)
   {
      vdNum = 0;
      document.forms[0][vcFld].value = vdNum.toFixed(viNoDec); 
	  alert('Invalid Numeric Input');
	  return false;   
   }
   return true;
}

function KeyRet(vcPress)
{ 

 if (event.keyCode == 13)
  return false;
	
 return true;
}

function FocusFld (vcFld)
{
  document.all[vcFld].focus();
}

function ChgImg(v_id, v_Img) 
{       
   v_ImgPath = "/images/"+v_Img;
   document.forms[0][v_id].src = v_ImgPath;		
	
}

function clrflds (v_name)
{

   document.all[v_name].value = "";

}

function clrCombo(v_name,v_val)
{
   document.all[v_name].value = v_val;
}

function chkBox(v_chkBox) 
{
   document.all[v_chkBox].checked = true;
}	 

function DynTxt(v_em, v_txt)
{
  document.getElementById(v_em).innerHTML = v_txt;
  hiddenFld('srchTxt', v_txt);
}

function ldImg (vcFld, vcImgLst, vcImgPan) {
   var vlLoop = false;
   var vdEndPos = 0;
   var vdItem   = 0;
   var newOpt;

   while (document.forms[0][vcFld].length) {
      document.forms[0][vcFld].remove(0);
   }   

   do
   {
     vdEndPos = vcImgLst.indexOf("|");
     
     if (vdEndPos == -1) { 
       vdEndPos = vcImgLst.length;
       vlLoop = true;
     }
  	 
	 newOpt = document.createElement("option");
	 newOpt.text  = "Image " + (vdItem + 1);
	 newOpt.value = vcImgLst.substring(0,vdEndPos);
	 document.forms[0][vcFld].options.add(newOpt);	 
	
	 if (vlLoop == false)
     {
	    vcImgLst = vcImgLst.substring(vdEndPos + 1, vcImgLst.length);
		vdItem = vdItem + 1;
  	 }    
    
   } while (vlLoop == false)
   
   document.forms[0][vcFld].selectedIndex = 0;
   
   dspImg(vcImgPan,document.forms[0][vcFld].value);
   
 }

function dspImg (vcFld, vcImg)
{	
   document.forms[0][vcFld].src = vcImg;	
}

function selImg (vcPos, vcFld, vcImgPan) {
   
   if (vcPos == "Previous"  &&  document.forms[0][vcFld].selectedIndex != 0)
      document.forms[0][vcFld].selectedIndex = document.forms[0][vcFld].selectedIndex - 1;
   else if (vcPos == "Next"  &&  document.forms[0][vcFld].selectedIndex != (document.forms[0][vcFld].length - 1))
      document.forms[0][vcFld].selectedIndex = document.forms[0][vcFld].selectedIndex + 1;

   dspImg(vcImgPan,document.forms[0][vcFld].value);      
	
}
