/**
 * @author guruprasadkm
 */
	function hw1()
	{
	    ae_prompt( toaddress, 'Please enter your Email ID', 'Anonymous');
	}
	// This is variable for storing callback function
	var ae_cb = null;
	 
	// this is a simple function-shortcut
	// to avoid using lengthy document.getElementById
	function ae$(a) { return document.getElementById(a); }
	 
	// This is a main ae_prompt function
	// it saves function callback 
	// and sets up dialog
	function ae_prompt(cb, q, a) {
		ae_cb = cb;
		ae$('aep_t').innerHTML = '&nbsp;&nbsp;' + document.domain + '';
		ae$('aep_prompt').innerHTML = q;
		ae$('aep_text').value = a;
		ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = '';
		ae$('aep_text').focus();
		ae$('aep_text').select();
	}
	 
	// This function is called when user presses OK(m=0) or Cancel(m=1) button
	// in the dialog. You should not call this function directly.
	function ae_clk(m) {
		// hide dialog layers 
		ae$('aep_ovrl').style.display = ae$('aep_ww').style.display = 'none';
		if (!m)  
			ae_cb(null);  // user pressed cancel, call callback with null
		else
			ae_cb(ae$('aep_text').value); // user pressed OK 
	}

	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function echeck(str) { 
		str = trim(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 toaddress(n){
		//var n = ae_prompt("Enter Your Mail ID", "default value in the text field");
		if(n!=null){
			if (echeck(n) != true) {
				alert("Mail ID " + n + " is invalid.");
				hw1();
			}
			else {
				document.f1.toaddress.value = n;
				document.f1.submit();
			}
		}else{
			return false;
		}
	}