var timer=1;
function check()
{

var flag=false;
 
	for (i=1;i<8; i++)
	{
    on_focus=document.userDetail.elements[i-1];
	
		switch(i)
		{
		case 6: if (on_focus.value=="") {flag=true;mas=" PLEASE FILL YOUR E-MAIL   ";break;}
				if (check_if_email(on_focus.value)) {flag=true;mas=" ILEAGAL E-MAIL    " };break;
		case 5:if ( on_focus.value.length<6 || on_focus.value==""){ flag=true;mas=" DIGIT ONLY  ";};break;	
	   	



	
		}
		if (flag) break;
		}
		if (flag){
			  	
			  show_mas(on_focus,mas,i);
			  getfocus(on_focus);
			  return false;
			  }
	else return true;
}

function check_if_number(cell)
{
if(cell.length<2)return false;
parseInt(cell,10);
if (isNaN(cell))return false 
else return true;
}

function getfocus(cell)
{
cell.focus();

if(cell.value!="")cell.select();
}

function check_if_email(cell)
{
flagA=false;
flagB=false;
if (cell.length<4) return true;
for (var i=1;i<cell.length;i++){
	str=""+cell.charAt(i);
	
	if (str=="@") {flagA=true;}
	if (str=="." && flagA==true ) {flagB=true;}
	}

if (flagA==true && flagB==true) return false;
return true;
}


function check_if_picture(cell)
{
if (cell.length<4) return false;
var str=cell.substr(cell.length-4,cell.length);
if (str==".jpg" || str==".gif")return true;
else return false;}

function check_if_html(cell)
{
if (cell.length<4) return true;
var str=cell.substr(cell.length-3,cell.length);
if (str=="tml"  || str=="txt" )return true;
else return false;
}


function show_mas(msg,mas,no)
{
if(navigator.appName.charAt(0)+""=="m" || navigator.appName.charAt(0)+""=="M")
	{
	zz=document.all.tags("input")[no-1].style.backgroundColor="#E2E2E2";
	document.all.tags("input")[no-1].style.borderColor="red"
	nom=no
	timer=1
	
	msg.value=mas;
	place=msg
	tl=setInterval("scroll(place.value,place,nom)",90);
	}
// add place for navigator case
}

function scroll(mas,place,no){
			tmp=mas
			leng=tmp.length
			tmp1=tmp.substr(0,leng-1)
			tmp2=tmp.substr(leng-1,leng)
			tmp=tmp2+tmp1
			place.value=tmp
			timer++
			if (timer==30){clearInterval(tl);place.value="";
			zz=document.all.tags("input")[no-1].style.backgroundColor="#E2E2E2";
			document.all.tags("input")[no-1].style.borderColor="white";
			place.focus();
}
			}