// JavaScript Document

function subscribe()
{
	var obj;
	obj = document.frm_subscribe.subscribe_mail;
	if(trim(obj.value) == "" )
 	{
		 alert("Please Enter Your Email Address");
		 obj.focus();
		 return false;
 	}
	if(!isEmailAddr(trim(obj.value)))
	{
		alert("Invalid Email-ID");
		obj.focus();
		return false; 
	}
	//document.frm_subscribe.action = "http://www.emantras.com/emanwebfinal/flashui/subscribe.asp?act=subscribe&email="+obj.value;
	var url="subscribe.asp?act=subscribe&email="+obj.value;
	window.open(url)
	//document.frm_subscribe.method = "post";
	//document.frm_subscribe.submit();
}


/* Function for checking if any option is selected */
function vote()
{
	var chkflag = 0;
	col = eval('document.getElementsByName("radiobutton")');
	if (col.length != 0)
	{				
		for(kk=0;kk<col.length;kk++)
		{
			if(col[kk].checked)
			{
				chkflag = 1;
				vval = col[kk].value;				
				break;
			}				
		}
		if (chkflag != 1)
		{
			alert("Please select an option");
			return false;
		}
	}
	//return true;	
	document.frm_vote.action = "http://www.emantras.com/emanwebfinal/flashui/subscribe.asp?act=vote&vvalue="+vval;
	//document.frm_subscribe.method = "post";
	//document.frm_vote.submit();
}

/* Function for removing White Spaces */
function trim(s) 
{
	while (s.substring(0,1) == ' ') {
		s = s.substring(1,s.length);
	}
	while (s.substring(s.length-1,s.length) == ' ') {
		s = s.substring(0,s.length-1);
	}
	 return s;		
}

/* Function for checking Valid Email Address */
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}					