var curDomain=document.domain;
function chkvalid(){	
	if(dgebid('MID').value==""){
		dgebid('error').style.display="block";
		dgebid('error').innerHTML="Please enter your Matrimony Id / Email.";
		dgebid('MID').focus();
		return false;
	}else if(dgebid('PASSWORD1').value==""){
		dgebid('error').style.display="block";
		dgebid('error').innerHTML="Please enter your Password.";
		dgebid('PASSWORD1').focus();
		return false;
	}else{
		dgebid('error').style.display="block";
		return true;
		//dgebid('error').innerHTML="<div style='text-align:center' ><img src=\"http://imgs.bharatmatrimony.com/bmimgs/loading-icon.gif \"></div>";
		//var url="memlogin.php?";
		//var postval="dLT="+document.getElementById('dLT').value+"&ID="+dgebid('MID').value+"&PASSWORD="+dgebid('PASSWORD1').value.toLowerCase();
		//url=url+"&dyn="+Math.random();
		//$.ajax({
		//url: url,	
		//type: 'GET',
		//data: postval,
		//success: function (html) { 
		//	logininfoget(html);
		//}
		//});return false;
	}
}

function errorclear(field){}

function logininfoget(responseTextHtml){
				var retval=responseTextHtml;val=retval.split("^^!!");
				if(val[0]=='S'){
					window.location=val[1];
				}else if(val[0]=='E'){
					dgebid('error').style.display="block";
					if(val[1]!=''){
						var dispc=val[1];
					}else{
						var dispc="Invalid Matrimony ID / E-mail OR Incorrect Password.";
					}
					dgebid('error').innerHTML=dispc;
				}else if(val[0]=='D'){
						dgebid('error').style.display="none";
						dgebid('formdiv').style.display="none";
						dgebid('regfree').style.display="none";
						dgebid('displaydiv1').style.display="block";
						dgebid('displaydiv2').innerHTML=val[1];
						dgebid('displaydiv3').innerHTML=val[2];
				}		
}



function postdetail(url){	
	domainSplit = curDomain.split('.');	
	if($("#forgotpwd").val() == '')
	{
		$('#error').html('Enter valid Matrimony ID or E-mail ID.');						
		$('#forgotpwd').focus();		
		return false;
	} else {			
		var rand=Math.random(9999);
		var params="rand="+rand+"&ID="+encodeURI($("#forgotpwd").val());		
		$.ajax({  
			url: url,	
			type: 'POST',
			data: params,
			beforeSend: function(){ 
				$("#cboxLoadedContent").html('<div style="padding-top:50px"><center><img src="http://imgs.'+domainSplit[1]+'.com/bmimgs/small_loading.gif"></center></div>');				
			},
			success: function (html) {								
				splitResponse = html.split('~');
				$("#cboxLoadedContent").html(splitResponse[0]);
				if($("#closeDiv"))
				{
					$.colorbox.resize();
				}		
			},
			complete: function() {
				$('#forgotpwd').focus();						
			}
		});
		return false;
	}	
}
function forgotpwd(id){
	url = "http://"+curDomain+"/login/forgotpasswdconfirm.php";

	$.colorbox({href:url,
		onLoad: function(){
			$('iframe').css('visibility','hidden');	
		},
		onClosed: function(){
			$('iframe').css('visibility','visible');
			$("#"+id).attr("href","javascript:void(0);");
			$("#"+id).attr("class","");
		},
		onComplete: function() {
			$('#forgotpwd').focus();	
		}

	});
	
}



