function go(string) {
	var records=document.frm.DisplayRecords.value;
	if(IsNumeric(records)){
		if(records>0) {
			//form is valid, so take actions if any befor submitting it
			//the following if conditions are reserved for future use
			if(string=='Move_To_Previous_Page')document.frm.submit();
			if(string=='Move_To_Next_Page')document.frm.submit();
			if(string=='with_selected_function')document.frm.submit();
			if(string=='ShowThisPage')document.frm.submit();
			if(string=='sort_col')document.frm.submit();
			if(string=='submit')document.frm.submit();
			if((string=='sponsor')||(string=='rockman')) {
				if(check_date()) return true;
				else return false;
			}
			
			if(string=='DisplayRecordsGo') {
				document.frm.ShowThisPage.value=0;
				document.frm.submit();
			}
		} else {alert('Please enter a valid number of records per page');  return false;}
	} else  { alert('Please enter a valid number of records per page'); return false;}
}



function Move_To_Previous_Page() {
			document.frm.ShowThisPage.value=(document.frm.ShowThisPage.value*1)-1;
			go("Move_To_Previous_Page");
		}

function Move_To_Next_Page() {
			document.frm.ShowThisPage.value=(document.frm.ShowThisPage.value*1)+1;
			go("Move_To_Next_Page");
		}


function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function check_all() {
    var counter=document.frm.counter_start.value;
	var counter_end=document.frm.limit.value;
	counter_end=(counter*1)+(counter_end*1);
//	alert("counter="+counter+" end="+counter_end);
	var i=0;
	for (i=counter;i<=counter_end;i++) {
		var checkbox='check_'+i;
		try {
			document.getElementById(checkbox).checked=true;
		}catch(e){}
	}
}

function uncheck_all() {
    var counter=document.frm.counter_start.value;
	var counter_end=document.frm.limit.value;
	counter_end=(counter*1)+(counter_end*1);
    var i=0;
	for (i=counter;i<=counter_end;i++) {
		var checkbox='check_'+i;
		try {
			document.getElementById(checkbox).checked=false;
		}catch(e){}
	}
}

function check_rows(counter) {
}

function with_selected_function() {
	var counter=document.frm.counter_start.value;
	var counter_end=document.frm.limit.value;
	counter_end=(counter*1)+(counter_end*1);
	var i=0,checked;
	for (i=counter;i<=counter_end;i++) {
		var checkbox='check_'+i;
		try {
			if(document.getElementById(checkbox).checked) checked=true;
		}catch(e){}
	}
	if(checked) {
		var selected_value=document.getElementById('with_selected').value;
		if(selected_value==4) {
			var temp=confirm("Are you sure you want to delete");
			if(temp) {
				document.frm.change_selection.value=1;
				go('with_selected_function');
			}else {
				document.getElementById('with_selected').value='';
			}
		} else {
				document.frm.change_selection.value=1;
				go('with_selected_function');
		}
	} else {
		document.getElementById('with_selected').value='';
	}
}

function trim(string) {
	var a = string.replace(/^\s+/, '');
	return a.replace(/\s+$/, '')
}

function echeck(str,div_object) {
		var member_email_div=div_object;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   member_email_div.innerHTML="<font color='red'>invalid email id</font>";
		    return false
		 }

 		 return true					
	}


function sort_col(string) {
	var sortby=document.frm.sortby.value=string;
	go('sort_col');
}


function check_url(url) {
     var theurl=url;
     var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
     if (tomatch.test(theurl))
     {
         return true;
     }
     else
     {
         return false; 
     }
}





