function checkEmpty(i,divid,m)
{
var nn=document.getElementById(i);
 var divid=document.getElementById(divid);

if(nn.value=="")
{
divid.style.display="block";

divid.innerHTML=m;
  nn.focus();
  nn.select();
return false;
}
return true;
}
///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
function checkMail(i,divid,m)
{
var nn=document.getElementById(i);
 var divid=document.getElementById(divid);
 if(nn.value.indexOf("@")==-1||nn.value.indexOf(".")==-1)
{
divid.style.display="block";
divid.innerHTML="";
divid.innerHTML=m;
  nn.focus();
  nn.select();
return false;
}
return true;
}
function checkNum(j,m)
{
var nn=document.frm.elements[j].value;
var num="0123456789";
len=nn.length;
for(i=0;i<len;i++)
{
ch=nn.charAt(i);
//alert(num.indexOf(ch));
if(num.indexOf(ch)==-1)
{
alert(m);
document.frm.elements[j].focus();
document.frm.elements[j].select();
return false;
}
}
return true;
}
///
function checkCheck(i1,i2,m)
{
var nn=document.getElementById(i1);
var nn2=document.getElementById(i2);
if(nn.checked ||  nn2.checked)
{
   return true
}
else
{
  alert(m);
    return false;
}
    
}
///
function checkConfirm(i,j,m)
{
var nn1=document.frm.elements[i].value;
var nn2=document.frm.elements[j].value;
if(nn1!=nn2)
{
alert(m);
document.frm.elements[j].focus();
document.frm.elements[j].select();
return false;
}
return true;

}


///
function checkSel(i,m)
{
var ind=document.frm.elements[i].selectedIndex;
var val=document.frm.elements[i].options[ind].value;
if(val=="")
{
alert(m);
document.frm.elements[i].focus();

return false;

}
return true;

}
//////////////////////////////////////
function checkPic(i,m)
{

var nn=document.frm.elements[i].value;
var in1=nn.indexOf(".");
var in2=nn.length;
ext=nn.substring(in1,in2);
if(ext!=".jpeg" && ext!=".jpg" &&ext!=".png" && ext!=".gif" )
{
alert(m);
document.frm.elements[i].focus();
return false;
}
return true;

}
//////////////////////////////////////
function checkFlash(i,m)
{

var nn=document.frm.elements[i].value;
var in1=nn.indexOf(".");
var in2=nn.length;
ext=nn.substring(in1,in2);
if(ext!=".swf" )
{
alert(m);
document.frm.elements[i].focus();
return false;
}
return true;

}
//////////////////////////////////
function ShowLayer(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
function autoTab(input, len) {
/************************************************
DESCRIPTION: Automatically jumps the focus to the next field  
  in the tab sequence when a specified number of character is entered.  

PARAMETERS: 
  input - Text INPUT field to be tested.  
  len   - length of input before autotabbing.

  To use, include the following code as an inline event handler
  in an INPUT text field:
	 onKeyUp="return autoTab(this, n);"  
  where n is a number specifying len. 
    
RETURNS: 
  True if tab is made.

*************************************************/
	if(input.value.length >= len) 
	{
	input.value = input.value.slice(0, len);
	input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function getIndex(input) 
	{
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input) index = i;
		else i++;
		return index;
	}
	return true;
}
