function validmail(email1) 
{
	invalidChars = " /:,;";
	while (email1.substring(0,1) == ' ')
	{email1 = email1.substring(1, email1.length);}
	while (email1.substring(email1.length-1, email1.length) == ' ')
	{email1 = email1.substring(0,email1.length-1);}
	if (email1 == "")
	{return "Please Enter Email ID.";}
	for (i=0; i<invalidChars.length; i++) 
	{badChar = invalidChars.charAt(i);
	 if (email1.indexOf(badChar,0) > -1) 
	 {return "Invalid E-mail ID.";}}
	atPos = email1.indexOf("@",1)
	if (atPos == -1) 
	{return "Invalid E-mail ID.";}
	if (email1.indexOf("@",atPos+1) != -1) 
	{return "Invalid E-mail ID.";}
	periodPos = email1.indexOf(".",atPos)
	if (periodPos == -1) 
	{return "Invalid E-mail ID.";}
	if (periodPos+3 > email1.length)	
	{return "Invalid E-mail ID.";}
	return true;
}

function ModalPopupsCustom1() {
            ModalPopups.Custom("idCustom1",
                "<font face='Arial' size='2' color='#FFFFFF' >Fill Given Form  To Send Feed Back </font>",
               
                "<form name='frmfeedback'  method='post'>" + 

                "<div style='padding: 25px;' id='ddiv'>" + 
                "<table border=0  >" + 
                "<tr><td  style='font-family: Verdana; font-size: 10pt; font-weight: bold; color:#FF0000' colspan=2 id='errfeed'>&nbsp;</td></tr>"+
                "<tr><td width='300' style='font-family: Verdana; font-size: 10pt; font-weight: bold'>Name ::</td><td><input type='text' id='txtunamename' name='txtunamename' autocomplete='off' style='width: 230px;'></td></tr>" + 
                "<tr><td  style='font-family: Verdana; font-size: 10pt; font-weight: bold'>Email ::</td></td><td><input type='text' id='txtemail' name='txtemail' autocomplete='off' style='width: 230px;'></td></tr>" + 
                "<tr><td  style='font-family: Verdana; font-size: 10pt; font-weight: bold'>FeedBack ::</td><td><textarea id='txtfeedback'  rows='5' style='width: 230px;' name='txtfeedback' ></textarea></td></tr>" + 
                "<tr><td  ></td><td>&nbsp;</td></tr>" + 
                "</table>" +
                "</div>" +
                 "</form>", 
               
                {
                    width: 400,
                    buttons: "ok,cancel",
                    okButtonText: "Submit",
                    cancelButtonText: "Cancel",
                    onOk: "feedlogin()",
                    onCancel: "ModalPopupsCustom1Cancel()"
                }
            );
                    
            ModalPopups.GetCustomControl("inputCustom1Name").focus(); 
        }
       
        function ModalPopupsCustom1Cancel() {
            ModalPopups.Cancel("idCustom1");
        }
        
    function chkblank(id)
	{
	if( document.getElementById(id).value=='' || document.getElementById(id).value==' ' || document.getElementById(id).value==null)
	{
		return false;
	}
	else
	{
	return true;
	}
	}
function feedlogin()
	{
	
	document.getElementById('errfeed').innerHTML="&nbsp;";
	if (chkblank('txtunamename')==false)
	{document.getElementById('errfeed').innerHTML="Your Name Please ";
	 document.getElementById('txtunamename').focus();
	return false;}
	if (validmail(document.getElementById('txtemail').value)!=true )
	{errmsg(validmail(document.getElementById('txtemail').value),'errfeed');
	document.getElementById('txtemail').focus();
	return false;}
	
	document.getElementById('errfeed').innerHTML="<img src='Feedbackj_script/loader.gif'> Please Wait !!!";
	CheckLoginfeedback(document.getElementById('txtunamename').value,document.getElementById('txtemail').value,document.getElementById('txtfeedback').value);
	}
	
	
	function errmsg(msg,errid)
	{
	document.getElementById(errid).innerHTML='&nbsp;';
	document.getElementById(errid).innerHTML=msg;
	}
	
	function CheckLoginfeedback(user,opass,fedmsg)
	{	
	
	req_stands=createRequestObject(); 
	if(req_stands) 
	{	
		req_stands.onreadystatechange = login_Validatefeedback;
		url="Feedbacksubmit.asp?user="+user+"&opwd="+opass+"&fedb="+fedmsg;
		req_stands.open("GET", url, true);
		req_stands.send("");
	}
	}

function createRequestObject()
{
	req_stands = false;
	if(window.XMLHttpRequest) 
	{
		try {
			req_stands = new XMLHttpRequest(); } catch(e) {
					req_stands = false;
			}
	} else if(window.ActiveXObject) 
	{
		try {req_stands = new ActiveXObject("Msxml2.XMLHTTP");} catch(e) 
			{
				try {req_stands = new ActiveXObject("Microsoft.XMLHTTP");} 
				catch(e){req_stands = false;}
				}
			}
			return req_stands;
	 } 

function Func1()
{
ModalPopupsCustom1Cancel();
}
function login_Validatefeedback() 
{		// only if req shows "loaded"
	if (req_stands.readyState == 4) 
	{
		// only if "OK"
		if (req_stands.status == 200) 
		{
		// ...processing statements go here...
			var response = req_stands.responseText;
		if (response=='OK')
			{
			document.getElementById('errfeed').innerHTML = 'Thank you Send FeedBack';
			setTimeout("Func1()", 2000);
			}
		}
		else
		{
			alert("There was a problem retrieving the data:\n" +req_stands.statusText);
		}
	}  
}


