// JavaScript Document
function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		  
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		  
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		   
		    return false;
		 }

 		 return true;					
	}

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function recognition_chk_add(){

/*****************[ Init Variable ]***********************/

var pic							= document.recognition.pic.value;
var title						= document.recognition.title.value;
var detail						= document.recognition.detail.value;

submitOK = "true";
error = " ";
/*******************[  Validate Condition  ]*********************/
if ((pic==null)||(pic=="")){	
		//emailID.focus()
		error +="* Please Select Picture <br\>";
		submitOK = "false";
}

if ((title==null)||(title=="")){	
		//emailID.focus()
		error +="* Please Enter title <br\>";
		submitOK = "false";
}

if((title.length) < 10 ){
	error += "* Title Minimum of 10 characters in length<br\>";
	submitOK = "false";	
}

if ((detail==null)||(detail=="")){	
		//emailID.focus()
		error +="* Please Enter detail <br\>";
		submitOK = "false";
}

if((detail.length) < 10 ){
	error += "* detail Minimum of 10 characters in length<br\>";
	submitOK = "false";	
}


/**************************************************/

if(submitOK == "true" )
	return (true);
else{
	alertBox('Recognition Send From Error', error,'200');
	return (false);
	}
}


function recognition_chk_edit(){

/*****************[ Init Variable ]***********************/

var title						= document.recognition.title.value;
var detail						= document.recognition.detail.value;

submitOK = "true";
error = " ";
/*******************[  Validate Condition  ]*********************/

if ((title==null)||(title=="")){	
		//emailID.focus()
		error +="* Please Enter title <br\>";
		submitOK = "false";
}

if((title.length) < 10 ){
	error += "* Title Minimum of 10 characters in length<br\>";
	submitOK = "false";	
}

if ((detail==null)||(detail=="")){	
		//emailID.focus()
		error +="* Please Enter detail <br\>";
		submitOK = "false";
}

if((detail.length) < 10 ){
	error += "* detail Minimum of 10 characters in length<br\>";
	submitOK = "false";	
}


/**************************************************/

if(submitOK == "true" )
	return (true);
else{
	alertBox('Recognition Send From Error', error,'200');
	return (false);
	}
}