/* * * * * * * * * * * * * * * * * * * * * * * * *  *
* Created date:5/11/2009 							*
* Foub Interactive Pvt. Ltd..						*
* Author: Sandip Rajput, Sr. PHP Programmer		    *
*       : sandiprajput_1985@rediffmail.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
var HOME_PATH='/';

/*--------------------Common functions used in the entire site#START#BRIJENDRA----------------*/

function sendRedirect(page){
	window.location.href=page;
}
function isValidEmail(str) {
	if(!(/^[^a-zA-Z]/.test(str)) && (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str))) {
		return true
	} else {
		return false
	}
 }
/*function to validate email for any form //END*/
/*function to validate & restrict user to enter only numeric values*/
//call function below on key events i.e. onkeypress, onkeyup etc.
function numericValue(evt) {
	//alert(1)
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));	
	
    if (charCode > 31 && charCode > 46 && (charCode < 48 || charCode > 57)) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}/*END function numericValue(evt)*/
//call function below on key events i.e. onkeypress, onkeyup etc.
function phoneValue(evt) {//alert(1)
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
} /*END function phoneValue(evt)*/

/*//functin to check field value contains valid string characters //STRT*/
//function call ->if(isValidString(document.frmPrudential.clientName.value)==false)
	function isValidString(str){
		var result	=	true;
		var iChars = "`~!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
		//if string is NULL return false;
		if(str.length == 0) return false;
		for (var i = 0; i < str.length; i++) {
			if (iChars.indexOf(str.charAt(i)) != -1) {
				result	=	false;
			}
		}
	 return result;
	}

/*//functin to check field value contains valid string characters// END*/

/** function below is to check if field value is a valid zip code for US // START*/
function isValidZip(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   if(strString.length!=5) return false;
	var totalValue	=	0;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
	  totalValue	+=	parseInt(strString.charAt(i));
		
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
	
      }
	if(totalValue==0) return false;
   return blnResult;
   }
/** function below is to check if field value is a valid zip code for US//END */
function showHideAnyBox(box_id){ //alert(1)
	var boxDivId	= document.getElementById(box_id);
	if(boxDivId.style.visibility=='visible')
		boxDivId.style.visibility	='hidden';
	else
		boxDivId.style.visibility	='visible';
	//alert(boxDivId.style.visibility);
}

function swap( F, R ){
	var vD = F.defaultValue;
	if ( F.value == ( R ? '' : vD ) ) F.value = ( R ? vD : '' );
}

function numericValue(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}
function phoneValue(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}

function costValue(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
    return true;
}

function sleepTimeOutDisplay(divId){
	if(eval(document.getElementById(divId))){
	document.getElementById(divId).style.display	=	'none';
	}
	}

function openPassPop(){
	$('popDiv').style.visibility='visible'; 
	}
function phoneValuetab(evt,val,name) {		
	var total=val.length
	if(name=="phone1"){
    	if(total=="3")
	    {	     	
          document.getElementById('phone2').focus();            
	    }
	}
	if(name=="phone2" ){
    	if(total=="3")
	    {	    
	      document.getElementById('phone3').focus();	 
	    }
	}
	if(name=="phone3"){
    	if(total=="4")
	    {		 
	      document.getElementById('email').focus();		  
	    }
	}	
	
	evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=45) {
        //alert("Enter only numeric values\nThat is between 0-9\n in this field.");
        return false;
    }
	return true;

}
//register Page validation. 
 function loginchk(frm){
	//alert(1); return false;
	//Variabe declaration section....
	var User_name = frm.login_username;
	var Password = frm.login_password;
	
    var cntError = 0;
	var errorMsg = Array();	
	var errorField = Array();
	
	if(User_name.value=="" || User_name.value=="Username" ){
		errorMsg[cntError] = 'login_username';
		errorField[cntError] = 'login_username';
		//$('login_username').style.border='#FFFF solid 2px';
		cntError++;
	}else{
		$('login_username').style.border='';
	}
	
	if(Password.value=="" || Password.value=="password"){
		errorMsg[cntError] = 'login_password';
			errorField[cntError] = 'login_password';
			//$('login_password').style.border='#FFFF solid 2px';
			cntError++;
	}else{
		$('login_password').style.border='';
	}
	
	if(errorMsg.length > 0){
		
		        var Output = "Please login first.";
        		$("login_errorDiv").innerHTML = Output;
				$("login_errorDiv").style.display="block";
				
	  return false;
	}else{
		 file	=	HOME_PATH+'process_login.php';
		 
		 var username=$('login_username').value;
		 var passw=$('login_password').value;
		 
			var pars = $H({username:username, passw:passw,}).toQueryString();
			//alert(pars);
	 	var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: pars, 
                                  onSuccess: function(transport){
									  
									 // alert(transport.responseText);	
									  
									  
									  
											if(transport.responseText=='fail'){ 

												  var Output = "Invalid Username and Password";
													$("login_errorDiv").innerHTML = Output;
													$("login_errorDiv").style.display="block";
													 return false;
											}
											if(transport.responseText!='Bank'){ 

												sendRedirect('index.php');
											}else{
											sendRedirect('index.php');	
											}

		                                } 
								  });
		$('login_errorDiv').style.display	=	'none';
		window.scroll(0,0);
		
		//frm.reset();
		//return true;
	}
}



// register form validation
 function chkRegisterDetail(frm){
	
	//alert('sandip...');
	//Variabe declaration section....
	var fName = frm.reg_fname;
	var lName = frm.reg_lname;
	var userName= frm.reg_usrName;
	var userPass=frm.reg_pass;
	var confirmPass=frm.reg_cpass;
	var email = frm.reg_email;
	var mobile = frm.mobile;
	var pay_opt= frm.plan_id;
	var varification_code=frm.registration_code;
	var variCode_img=frm.variCode_img;
	//alert(variCode_img.alt);
	var bname = frm.bank_name;
	var cno = frm.cheque_no;
	var cdate=frm.cheque_day;
	var cmonth=frm.cheuqe_month;
	var cyear=frm.cheque_year;
	var payment=frm.pay;
	var total=frm.total_calc;
	var phonr=frm.phonr;
	var regdob_day=frm.regdob_day;
	var regdob_month=frm.regdob_month;
	var regdob_year=frm.regdob_year;
	var address=frm.address;
	var country=frm.country;
	var state=frm.state;
	var city=frm.city;
	var zip=frm.zip;
	var termsCondition= frm.terms_condition;	
	
	var flag = false;
    var cntError = 0;
	var errorMsg = Array();	
	var errorField = Array();
	//var showErrorMsg = $("errorDiv");
	//var successMessageDiv =$('successMessageDiv');
	if(fName.value==""){
		errorMsg[cntError] = 'reg_fname';
		errorField[cntError] = 'reg_fname';
		$('fname_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('fname_label').style.color = "";
	}
	if(lName.value==""){
		errorMsg[cntError] = 'reg_lname';
		errorField[cntError] = 'reg_lname';
		$('lname_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('lname_label').style.color = "";
	}
	
	if(userName.value==""){
		errorMsg[cntError] = 'reg_usrName';
		errorField[cntError] = 'reg_usrName';
		$('uname_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('uname_label').style.color = "";
	}
	
	if(confirmPass.value=="" || confirmPass.value != userPass.value){
		errorMsg[cntError] = 'reg_cpass';
		errorField[cntError] = 'reg_cpass';
		$('cpass_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('cpass_label').style.color = "";
		
		}
	
	if(!isValidEmail(email.value)){
		errorMsg[cntError] = 'reg_email';
		errorField[cntError] = 'reg_email';
		$('email_label').style.color = "#FF0000"
		cntError++;
	}else{
	 $('email_label').style.color = "";
	}
	if(mobile.value==""){
		errorMsg[cntError] = 'mobile';
		errorField[cntError] = 'mobile';
		$('mobile_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('mobile_label').style.color = "";
	}
	if(userPass.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('pass_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('pass_label').style.color = "";
	}

if(phonr.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('phonr_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('phonr_label').style.color = "";
	}
if(regdob_day.value=="0"){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('regdob_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('regdob_label').style.color = "";
	}
if(regdob_month.value=="0"){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('regdob_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('regdob_label').style.color = "";
	}
if(regdob_year.value=="0"){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('regdob_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('regdob_label').style.color = "";
	}

if(address.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('address_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('address_label').style.color = "";
	}
if(country.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('country_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('country_label').style.color = "";
	}
if(state.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('state_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('state_label').style.color = "";
	}
if(city.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('city_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('city_label').style.color = "";
	}
if(zip.value==""){
		errorMsg[cntError] = 'reg_pass';
		errorField[cntError] = 'reg_pass';
		$('zip_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('zip_label').style.color = "";
	}
 

	
	if(total.value=='' || total.value=='00.00' || total.value=='0' ){
		errorMsg[cntError] = 'total';
		errorField[cntError] = 'total';
		$('total').style.color = "#FF0000"
		cntError++;
	}
	else{
		$('total').style.color = "";
	}

  if (pay_opt) {
    if (pay_opt.length > 0){
      for (var i=0; i<pay_opt.length; i++) {
        if (pay_opt[i].checked == true) {
          flag = true;
          break;
        }
      }
    } else if (pay_opt.checked == true) {
      flag = true;
    }
    if (flag == false) {
     errorMsg[cntError] = 'plan_id';
		errorField[cntError] = 'plan_id';
		$('pay_label').style.color = "#FF0000"
		cntError++;
    }else{
		$('pay_label').style.color = " "
		}
  }
  //alert(varification_code.value+'--'+variCode_img.alt);
  if(varification_code.value=="" || varification_code.value != variCode_img.alt){
		errorMsg[cntError] = 'registration_code';
		errorField[cntError] = 'registration_code';
		$('varcode_label').style.color = "#FF0000"
		cntError++;
	}else{
		$('varcode_label').style.color = "";
		
		}
		
	var chk_radio=false;
	var elemAll	=	frm.elements.length;	
	var one=false; var two=false; 
	for (k=0; k<elemAll; k++){
		var elem	=	eval(frm.elements[k]);
		if(eval("frm.elements[k].id.match(/r_one_2/)")){
			if(elem.checked==true){	
				two=true;
				if(bname.value==""){
					errorMsg[cntError] = 'bank_name';
					errorField[cntError] = 'bank_name';
					$('bank_name_lable').style.color = "#FF0000"
					cntError++;
				}else{
					$('bank_name_lable').style.color = "";
				}
				if(cno.value==""){
					errorMsg[cntError] = 'cheque_no';
					errorField[cntError] = 'cheque_no';
					$('cheque_no_lable').style.color = "#FF0000"
					cntError++;
				}else{
					$('cheque_no_lable').style.color = "";
				}
				
				
			}
		}
	}
	if(two){
		document.getElementById("payment").style.color="red";
	}
	else{
		document.getElementById("payment").style.color="";
	}
	
		//alert(errorMsg.length);
	if(termsCondition.checked == false){
		errorMsg[cntError] = 'terms_condition';
		errorField[cntError] = 'terms_condition';
		$('tc').style.color = "#FF0000"
		cntError++;
	}else{
		$('tc').style.color = "";
	}
	
	if(errorMsg.length > 0){
		
		        var Output = "Please fill all mandatory fields.";
        		$("register_errorDiv").innerHTML = Output;
				$("register_errorDiv").style.display="block";
				//alert($("contactus_errorDiv").innerHTML)
				window.scroll(0,0);
	  return false;
	}else{
		 file	=	HOME_PATH+'process_register.php';
		 alert("Registration in Progress Please wait....");
		//alert(file);
	 	var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: $(frm).serialize(), 
                                  onSuccess: function(transport){
									  //alert(transport.responseText);	
											if(transport.responseText=='Success'){ 
											sendRedirect('pay.php');
											}else{
											sendRedirect('index.php?registration=Registration Completed Successfully Please Login to Continue');	

											}
		                                } 
										});
		$('register_errorDiv').style.display	=	'none';
		window.scroll(0,0);
		//frm.reset();
		//return true;
	}
}

// Ask question form...
function chkAksQuery(frm){
		//alert('sandip...')
		var question=frm.qury_text;
		
		//alert(question.value);return false;
		var cntError=0;
		var errorMsg=Array();
		var errorField=Array();
		
		if(question.value==""){
			errorMsg[cntError]= 'qury_text'	;
			errorField[cntError]= 'qury_text';
			//$('qury_text').style.border='#FFFF solid 2px';
			cntError++;
		}else{
			$('qury_text').style.border=''
		}
	
		if(errorMsg.length>0){
			 var output="Please Enter Question..";
			 $('question_errdiv').innerHTML=output;
		 	$('question_errdiv').style.display='block';
			return false;
		}else{
			//alert(2);	
			var file =HOME_PATH+'process_query.php';
			
			var myAjax = new Ajax.Request(file,{method: 'post', parameters: $(frm).serialize(),
												onSuccess: function(transport){ 
												   if(transport.responseText=='Success'){
													    sendRedirect('stock_query.php');			
												   }else{
													 sendRedirect('stock_query.php');
												   }
												}
										  });
			$('question_errdiv').style.display='none';
			
			//return true;
		}
	}

function chkAnswerText(frm){
	//alert('sandip...')
	var answer_text=frm.answer_text.value;
	var question_id=frm.question_id.value;
	var question_answer=frm.question_answer.value;
	
	var pars = $H({answer_text:answer_text, question_id:question_id, question_answer:question_answer}).toQueryString();
	var file =HOME_PATH+'admin/process_query_ans.php';			
			var myAjax = new Ajax.Request(file,{method: 'post', parameters: pars,
												onSuccess: function(transport){ //alert(transport.responseText);
												   if(transport.responseText=='Success'){
													    sendRedirect('../admin/query_answer.php');			
												   }else{
													 sendRedirect('../admin/query_answer.php');
												   }
												}
										  });
			$('question_errdiv').style.display='none';
			$(frm).reset();
			//return true;
	
	}
	
function showPayment(userId){
	//alert('sandip...')
	 var myDiv=document.getElementById('pay_detail').style.visibility='visible';
	
	var userId = $H({userId:userId}).toQueryString();
	var file =HOME_PATH+'admin/process_displayPayment.php';			
			var myAjax = new Ajax.Request(file,{method: 'post', parameters: userId,
												onSuccess: function(transport){ //alert(transport.responseText);
													document.getElementById('pay_detail').innerHTML=transport.responseText;
												
												   /*if(transport.responseText=='Success'){													
													    sendRedirect('../admin/registered_user.php');			
												   }else{													   
													 sendRedirect('../admin/registered_user.php');
												   }*/
												}
										  });
			//$('question_errdiv').style.display='none';
			//$(frm).reset();
			//return true;
	
	}
function setUserStatus(doc,id){
	//alert(id);
		  var res=confirm('Are you sure to change user status');
		  if(res){
			  
			  file	=	HOME_PATH+'admin/process_userstatus.php';
		//alert(id);return false;
		
		var userId = $H({userId:id}).toQueryString();
	 	var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: userId, 
                                  onSuccess: function(transport){//alert(transport.responseText);	return false;								
											if(transport.responseText=='Success'){ 
											sendRedirect('pay.php');
											}else{
											sendRedirect('index.php');	
											}
		                                } 
										});
		$('contactus_errorDiv').style.display	=	'none';
		window.scroll(0,0);
		//frm.reset();
		//return true;
			  
			  
			  // $(doc).submit();
			 	/*var userId = $H({userId:id}).toQueryString();
				alert(userId);
				var file =HOME_PATH+'admin/process_userstatus.php';			
				//alert(file);
				var myAjax = new Ajax.Request(file,{method: 'post', parameters: userId,
												onSuccess: function(transport){ alert(transport.responseText);
																							
												   /*if(transport.responseText=='Success'){													
													    sendRedirect('../admin/registered_user.php');			
												   }else{													   
													 sendRedirect('../admin/registered_user.php');
												   }
												}
										  });*/
			}
			
			
		
	}

 function handleResponse(transport){
	//alert(transport.responseText);
	var showDiv	=	$('errorDiv');
	showDiv.style.display='none';
	showDiv.innerHTML = transport.responseText;
	$('resultshere1').style.display	=	'none';
	//alert(transport.responseText);
	}
	
// Calculation total in select payment page...	
function chkCalculation(thisval){
	//alert(1);
	var	total=0;
	 
	myFormElement = new Array(document.calFrm.nfty_select1,document.calFrm.nfty_select2,document.calFrm.nfty_select3,document.calFrm.nfty_select4,document.calFrm.nfty_select5,document.calFrm.nfty_select6,document.calFrm.nfty_select7);
	//alert(myFormElement.length);
	
	for(var i=0;i<myFormElement.length;i++){
		
		total=parseInt(total)+parseInt(myFormElement[i].value);	
		//alert(myFormElement[i].value);
			
		}
	//alert(total)
	var first		 =document.getElementById('nifty_amount1').value=document.calFrm.nfty_select1.value;
	var second  	 =document.getElementById('nifty_amount2').value=document.calFrm.nfty_select2.value;
	var third 		 =document.getElementById('nifty_amount3').value=document.calFrm.nfty_select3.value;
	var fourth 		 =document.getElementById('nifty_amount4').value=document.calFrm.nfty_select4.value;
	var fifth 		 =document.getElementById('nifty_amount5').value=document.calFrm.nfty_select5.value;
	var sixth 		 =document.getElementById('nifty_amount6').value=document.calFrm.nfty_select6.value;
	var seventh		 =document.getElementById('nifty_amount7').value=document.calFrm.nfty_select7.value;
	
	//total=parseInt(first)+parseInt(second)+parseInt(third)+parseInt(fourth)+parseInt(fifth)+parseInt(sixth)+parseInt(seventh);
	//alert(total);
	
	document.getElementById('total_calc').value=total;
	}

// Validation apply on payment select.	
	function chkValidation(frm){
		//alert(1)
		var total=frm.total_calc;
		if(total.value=='' || total.value=='00.00' || total.value=='0' ){
			document.getElementById('amount_errorDiv').style.display='block';
			//alert('Please select at least one payment option');
			frm.nfty_select1.focus();
			return false;
		}
	}
	
	
	
function chkFeedbackDetail(frm){
	//alert(frm);
	var name1  = frm.name;
	var email1 = frm.email;
	var cno1   = frm.cont_no;
	var msg1   = frm.message;
	//alert(name1.value)
	var flag = false;
    var cntError = 0;
	var errorMsg = Array();	
	var errorField = Array();
	if(name1.value==""){
		errorMsg[cntError] = 'name';
		errorField[cntError] = 'name';
		document.getElementById('f_name').style.color = "#FF0000"
		cntError++;
	}else{
		document.getElementById('f_name').style.color = "";
	}
	if(!isValidEmail(email1.value)){
		errorMsg[cntError] = 'email';
		errorField[cntError] = 'email';
		$('f_email').style.color = "#FF0000"
		cntError++;
	}else{
	 $('f_email').style.color = "";
	}
	if(cno1.value==""){
		errorMsg[cntError] = 'cont_no';
		errorField[cntError] = 'cont_no';
		$('f_cno').style.color = "#FF0000"
		cntError++;
	}else{
		$('f_cno').style.color = "";
	}
	if(msg1.value==""){
		errorMsg[cntError] = 'message';
		errorField[cntError] = 'message';
		$('f_msg').style.color = "#FF0000"
		cntError++;
	}else{
		$('f_msg').style.color = "";
	}
	if(errorMsg.length > 0){		
		        var Output = "Please fill all mandatory fields.";
        		$("feedback_errorDiv").innerHTML = Output;
				$("feedback_errorDiv").style.display="block";
				return false;
	}else{
		$(frm).submit();
		//alert(1)
		/*
		var mode=frm.mode.value;
		 file	=	HOME_PATH+'process_feedback.php';
		alert(file);
		 var arg = $H({name1:name1, email1:email1,cno1:cno1, msg1:msg1,mode:mode }).toQueryString();
		 	var myAjax = new Ajax.Request(file,{method: 'post', parameters: arg,
												onSuccess: function(transport){ alert(transport.responseText);
												  /* if(transport.responseText=='Success'){
													    sendRedirect('../admin/query_answer.php');			
												   }else{
													 sendRedirect('../admin/query_answer.php');
												   }
												}
										  });*/
			
		/* var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: arg, 
                                				 onSuccess: function(transport){alert(transport.responseText);
													//document.getElementById('feedback_successDiv').innerHTML=transport.responseText;
												 }
										});*/
		$('feedback_errorDiv').style.display	=	'none';
		
	}
}
function handleFeedbackResponse(res){
	//alert(res.responseText)
	document.getElementById('feedback_successDiv').innerHTML=res.responseText;
}
function  seminarDetail(doc){
	//alert(doc);
	var sname  = doc.s_name;
	var semail = doc.s_email;
	var scno   = doc.s_cont_no;
	var scity  = doc.s_city;

    var cntError = 0;
	var errorMsg = Array();	
	var errorField = Array();
	if(sname.value==""){
		errorMsg[cntError] = 's_name';
		errorField[cntError] = 's_name';
		$('sem_name').style.color = "#FF0000"
		cntError++;
	}else{
		$('sem_name').style.color = "";
	}
	if(!isValidEmail(semail.value)){
		errorMsg[cntError] = 's_email';
		errorField[cntError] = 's_email';
		$('sem_email').style.color = "#FF0000"
		cntError++;
	}else{
	 $('sem_email').style.color = "";
	}
	if(scno.value==""){
		errorMsg[cntError] = 's_cont_no';
		errorField[cntError] = 's_cont_no';
		$('sem_cno').style.color = "#FF0000"
		cntError++;
	}else{
		$('sem_cno').style.color = "";
	}
	if(scity.value==""){
		errorMsg[cntError] = 's_city';
		errorField[cntError] = 's_city';
		$('sem_city').style.color = "#FF0000"
		cntError++;
	}else{
		$('sem_city').style.color = "";
	}
		if(errorMsg.length > 0){		
		        var Output = "Please fill all mandatory fields.";
        		$("seminar_errorDiv").innerHTML = Output;
				$("seminar_errorDiv").style.display="block";
				return false;
	}else{
			$(doc).submit();
			/*var smode=doc.mode.value;
			file	=	HOME_PATH+'process_seminar.php';
			var arg = $H({sname:sname, semail:semail,scno:scno, scity:scity,smode:smode }).toQueryString();
			var myAjax = new Ajax.Request(file, 
                                   {method: 'post', parameters: arg, 
                                				 onSuccess: function(transport){
													 //alert(transport.responseText);
													//document.getElementById('feedback_successDiv').innerHTML=transport.responseText;
												 }
										});*/
			$('seminar_errorDiv').style.display	=	'none';
}
}
