var image_num="";
var c_name,c_id;
var posi = new Array();
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/="; 
//Heres the encode function

// Removes leading whitespaces
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));
}

function base64_encode(inp)
{
var out = ""; //This is the output
var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded
var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes
var i = 0; //Position counter
do { //Set up the loop here
chr1 = inp.charCodeAt(i++); //Grab the first byte
chr2 = inp.charCodeAt(i++); //Grab the second byte
chr3 = inp.charCodeAt(i++); //Grab the third byte
//Here is the actual base64 encode part.
//There really is only one way to do it.
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;

if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
//Lets spit out the 4 encoded bytes
out = out + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
// OK, now clean out the variables used.
chr1 = chr2 = chr3 = "";
enc1 = enc2 = enc3 = enc4 = "";
} while (i < inp.length); //And finish off the loop
//Now return the encoded values.
return out;
}
var http=false;

function show_report_form(e,compname,comid){
	c_name=compname;
	hideall_div(comid);
	var posi = new Array();
	posi=trackClick(e);
	/* #FF6000*/
		var	spam_form='<form name="spam_form" onSubmit="return validatespamform(this); return false;"><table cellpadding="0" cellspacing="0" border="0" width="420" height="190" bgcolor="#ffffff" style="border:3px solid #FF6000;"><tr><td style="padding-left:15px;border:1px solid #ffffff;" colspan="2" height="25" bgcolor="#E7E7E7"><div style="float:left;margin-top:5px;margin-bottom:5px;"><div style="float:left;width:350px;" class="normaltext"><b>Report Invalid phone/address of '+compname+'</b></font></div><div style="float:left;margin-left:25px;width:20px;"><a href="javascript:;" onclick="javascript:hide_spam_div(\'div_reportspam\');" title="Close"><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd-pop-close.gif" width="15" height="14" border="0" alt=""></a></div></div></td></tr><tr><td class="smallText" style="padding-left:15px;" width="95"><b>Invalid details:</b></font>&nbsp;&nbsp;</td><td class="smallText"><input type="checkbox" name="phoneno" value=1 /> Phone&nbsp;&nbsp; <input type="checkbox" name="address" value=2 /> Address&nbsp;&nbsp;</td></tr><tr><td style="padding-left:15px;padding-top:20px;" valign="top"><font class="smallText"><b>Remarks (if any) :</b></td><td ><textarea name="remarks" id="ureview" class="textfield" style="width:252px; height:50px;border:1px solid #A7A7A7;"></textarea></font></td></tr><tr><td style="padding-left:15px;" class="smallText"><b>My Name:&nbsp;</b></td><td class="smallText"><input type="text" name="reporter_name" class="normaltext" style="width:80px;border:1px solid #A7A7A7;"/>&nbsp;&nbsp;&nbsp; <b>My Tel.No. :</b>&nbsp; <input type="text" name="reporter_phone" class="normaltext" style="width:80px;border:1px solid #A7A7A7;"/></td></tr>	<tr><td colspan="2" align="right" style="padding-right:25px;"><input type="image" src="http://imgs.bharatmatrimony.com/bmimages/wd/submit-button.gif" width="61" height="21" border="0" alt=""><input type="hidden" name="ad_id" id="ad_id" value="'+comid+'"></td></tr></table></form>';
	document.getElementById("div_reportspam").style.visibility="visible";
	document.getElementById("div_reportspam").style.left=posi[0]+"px";	
	document.getElementById("div_reportspam").style.top=posi[1]+"px";	
	document.getElementById("div_reportspam").innerHTML=spam_form;
}

function show_forwardtofriend_form(e,compname,comid){
	hideall_div(comid);
	c_name=compname;
	var posi = new Array();
	posi=trackClick(e);
	var forwardto_form='<form name="forward_form" onSubmit="return validateforwardfriend(this);"><table cellpadding="0" cellspacing="0" border="0" width="360" height="200" bgcolor="#ffffff" style="border:3px solid #FF6000;"><tr bgcolor="#E7E7E7"><td colspan="2" style="padding-left:15px;border:1px solid #ffffff;" height="25" ><div style="float:left;" class="normaltext"><b>Forward to Friend</b></font></div>  <div style="float:right;padding-right:5px;"><a href="javascript:;" onclick="javascript:hide_spam_div(\'div_forwardtofriend\');" title="Close"><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd-pop-close.gif" width="15" height="14" border="0" alt=""></div></td></tr><tr><td width="120" style="padding-left:15px;"><font class="smallText"><b>Your Name</b></font></td><td ><input type="text" name="yourname" class="normaltext" style="width:180px;border:1px solid #A7A7A7;"/></td></tr><tr><td style="padding-left:15px;"><font class="smallText"><b>Your Email</b></font></td><td><input type="text" name="youremail" class="normaltext" style="width:180px;border:1px solid #A7A7A7;"/></td></tr><tr><td style="padding-left:15px;"><font class="smallText"><b>Friend\'s Name</b></font></td><td><input type="text" name="yourfname" class="normaltext" style="width:180px;border:1px solid #A7A7A7;"/></td></tr><tr><td style="padding-left:15px;"><font class="smallText"><b>Friend\'s Email</b></font></td><td><input type="text" name="yourfemail" class="normaltext" style="width:180px;border:1px solid #A7A7A7;"/></td></tr><tr><td colspan="2" valign="top" style="padding-left:240px;"><input type="hidden" name="comp_id" id="comp_id" value="'+comid+'"><input type="image" src="http://imgs.bharatmatrimony.com/bmimages/wd/submit-button.gif" width="61" height="21" border="0" alt=""></td></tr></table></form>';

							
	document.getElementById("div_forwardtofriend").style.visibility="visible";
	document.getElementById("div_forwardtofriend").style.left=posi[0]+"px";	
	document.getElementById("div_forwardtofriend").style.top=posi[1]+"px";	
	document.getElementById("div_forwardtofriend").innerHTML=forwardto_form;
}


function gen_img(imageno){
	var spamurl="imageload.php";
	http=false;
	http = createRequestObject();
	if (http){
		http.open('GET',spamurl,true);
		http.send(null);
		http.onreadystatechange = function() {
			if(http.readyState == 4){
				image_num = http.responseText;
				bn=base64_encode(image_num);
				var imagevalue = '<img src="lib/regcode.php?cr='+bn+'" alt="Please type this word." name='+image_num+' width="100" height="27">';
				if(document.getElementById('Genimage'+imageno)){
                document.getElementById('Genimage'+imageno).style.display="block";
				document.getElementById('Genimage'+imageno).innerHTML = imagevalue;
				}
			}
		}
	}
}

/*function gen_imgResponse(){
    if(http.readyState == 4){
		alert(http.responseText);
		image_num = http.responseText;
		bn=base64_encode(image_num);
		/*var sms_form='<form name="sms_form" onsubmit="return validatemobile(this);"><table cellpadding="0" cellspacing="0" border="0" width="360" height="220" bgcolor="#ffffff" style="border:3px solid #FF6000;"><tr bgcolor="#E7E7E7"><td style="padding-left:15px; line-height:20px;border:1px solid #ffffff;"><div style="float:left;width:290px;" class="normaltext"><b>'+c_name+' details to my mobile</b></font></div><div style="float:left;margin-left:24px;width:15px;"><a href="javascript:;"onclick="javascript:hide_spam_div(\'div_sms\');" title="Close"><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd-pop-close.gif" width="15" height="14" border="0"></a></td><td valign="top"></td></tr><tr><td class="normaltext" style="padding-left:25px;">(Only in India)</td></tr><tr><td valign="top" style="padding-left:25px; line-height:20px;" colspan="3"><div class="normaltext" style="color:#ff0000;" id="div_error"></div></td></tr><tr><td valign="top" style="padding-left:25px; line-height:20px;" colspan="2"><font class="smallText"><b>My Mobile No:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></font><input type="text" maxlength="10" name="smobile_no" class="textfield" style="width:180px;border:1px solid #A7A7A7;"/></td></tr><tr><td class="smallText" style="padding-left:25px;padding-right:40px;">Would you like to be contacted by this vendor on your mobile?<br><input type="radio" name="vendoropt" id="vendoropt" value="yes"> Yes <input type="radio" name="vendoropt" id="vendoropt" value="no" checked> No</td></tr><tr><td class="smallText" style="padding-left:25px; "><b>Enter the text as it is shown in the box below : </b></td></td><tr><td class="normaltext" style="padding-left:25px;"><div style="float:left;" class="normaltext"><img src="lib/regcode.php?cr='+bn+'" alt="Please type this word." name='+image_num+' width="100" height="27"></div><div style="float:left;padding-left:6px;"><input type="text" maxlength="10" name="security_number" class="textfield" style="width:180px;border:1px solid #A7A7A7;"/></div></td></tr><tr><td class="smallText" align="right" style="padding-left:250px; "><input type="image" src="http://imgs.bharatmatrimony.com/bmimages/wd/sms-button.gif" width="61" height="21" border="0" alt=""></td></tr></table><input type="hidden" name="comp_id" id="comp_id" value="'+c_id+'"></form>';
		
		document.getElementById("div_sms").style.visibility="visible";
		document.getElementById("div_sms").style.left=posi[0]+"px";	
		document.getElementById("div_sms").style.top=posi[1]+"px";	
		document.getElementById("div_sms").innerHTML=sms_form;

		var imagevalue = '<img src="lib/regcode.php?cr='+bn+'" alt="Please type this word." name='+image_num+' width="100" height="27">';
		document.getElementById('Genimage').innerHTML = imagevalue;
	}
}*/

function show_sms_form(e,compname,comid,pre_ad){
	c_name=compname;
	c_id=comid;
	var date=new Date();
	var time=date.getTime();	
	hideall_div(comid);
	posi=trackClick(e);
	//Added for Dual SMS - myname field validation by Ramesh
	validate_myname=pre_ad;
	gen_img();
		
}

function hideall_div(advid){
	document.getElementById("div_sms").style.visibility="hidden";
	document.getElementById("div_forwardtofriend").style.visibility="hidden";
	document.getElementById("div_reportspam").style.visibility="hidden";
	document.getElementById("div_review").style.visibility="hidden";
	//document.getElementById('reviewpop'+advid).style.visibility="hidden";
	
		
}

function trackClick(e) {
	var posi = new Array();
	if (document.layers){
		posi[0]=e.pageX;
		posi[1]=e.pageY;
	}else{
		posi[0]=e.clientX+document.body.scrollLeft;
		posi[1]=e.clientY+document.body.scrollTop;
	}
	return posi;
}

function hide_spam_div(div_name){
	document.getElementById(div_name).style.visibility="hidden";
}

function validatespamform(frm)
{
	if((document.spam_form.address.checked==false) && (document.spam_form.phoneno.checked==false))
	{
		alert("Please specify which one is invalid.");
		frm.phoneno.focus();
		return false;
	}
	if(frm.reporter_name.value=="")
	{
		alert("Please enter your name.");
		frm.reporter_name.focus();
		return false;
	}
	
	if(frm.reporter_phone.value=="")
	{
		alert("Please enter your phone number.");
		frm.reporter_phone.focus();
		return false;
	}

	if(isNaN(frm.reporter_phone.value)){
		alert("Please enter your valid phone number.");
		frm.reporter_phone.focus();
		return false;
	}

	
	var report_for;
	if(frm.address.checked==true){
		report_for="add";
	}
	if(frm.phoneno.checked==true){
		report_for="phone";
	}
	if((frm.address.checked==true)&&(frm.phoneno.checked==true)){
		report_for="both";
	}
	report_spam_func(frm.reporter_name.value,frm.reporter_phone.value,report_for,frm.ad_id.value,frm.remarks.value);
	return false;
}

function ValidateEmail( Email )
{
	var atCharPresent = false;
	var dotPresent = false;

	for ( var Idx = 0; Idx < Email.length; Idx++ )
	{
		if ( Email.charAt ( Idx ) == '@' )
			atCharPresent = true;
		if ( Email.charAt ( Idx ) == '.' )
			dotPresent = true;
	}
	
	for ( var Idx = 0; Idx < Email.length; Idx++ )		{
			if ( Email.charAt(Idx) == '	'
				|| Email.charAt(Idx) == ' '
				|| Email.charAt(Idx) == ','
				|| Email.charAt(Idx) == ';' )
			{
				//alert( "No spaces or other invalid characters are not allowed in the email. Please enter only one main email address" );
				return false;
			}
		}
	
	if ( !atCharPresent || !dotPresent )
		return false;
		
		var last_ar=Email.split(".");
		if (last_ar[last_ar.length-1].length<2)
			return false;

	return true;
	}

function validatetestimonial() {
frm = document.frmtestimonial
	if(frm.testiname.value == "") {
		alert("Please Enter Your Business Name");
		frm.testiname.focus();
		return false;
	}
	if (frm.testiemail.value == "")	{
		alert ("Please Enter Your Email Id");
		frm.testiemail.focus();
		return false;
	}
	if (!ValidateEmail(frm.testiemail.value) )	{
		alert("Please Enter a valid E-mail id.");
		frm.testiemail.focus( );
		return false;
	}
	if(trim(frm.testicomments.value) == "") {
		alert("Comments should not be empty");
		frm.testicomments.focus();
		return false;
	}
	var str = trim(frm.testicomments.value)
	if(str.length <= 150) {
		alert("Minimum 150 Characters");
		frm.testicomments.focus();
		return false;
	}

	if(frm.testiphoto.value) {
	 var imagePath = frm.testiphoto.value;
	 var pathLength = imagePath.length;
	 var lastDot = imagePath.lastIndexOf(".");
	 var fileType = imagePath.substring(lastDot,pathLength);
	 var oas = new ActiveXObject("Scripting.FileSystemObject");
	 var d = frm.testiphoto.value;
	 var e = oas.getFile(d);
	 var f = e.size;
	 alert(f + " bytes");
	 if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".bmp") ||(fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG") || (fileType == ".BMP")) {
	  return true;
	 } else {
	  alert("We supports .JPG, .PNG, and .GIF image formats. Your file-type is " + fileType + ".");
	   return false;		 
	 }
	}
	return true;
}


function validateforwardfriend(frm,comp_id,divname1,divname2){
var field1 = frm.yourname.value;

	if (frm.yourname.value == "")	{
		alert ("Please Enter Your Name");
		frm.yourname.focus();
		return false;
	}
	if (frm.youremail.value == "")	{
		alert ("Please Enter Your Email Id");
		frm.youremail.focus();
		return false;
	}
	if (!ValidateEmail(frm.youremail.value) )	{
			alert("Please enter a valid E-mail id.");
			frm.youremail.focus( );
			return false;
	}
	if (frm.yourfname.value == "")	{
		alert ("Please enter your friends name.");
		frm.yourfname.focus();
		return false;
	}
	if (frm.yourfemail.value == "")	{
		alert ("Please enter your friend's E-mail id.");
		frm.yourfemail.focus();
		return false;
	}
	if ( !ValidateEmail(frm.yourfemail.value) )	{
			alert("Please enter a valid E-mail id.");
			frm.yourfemail.focus();
			return false;
	}
	forward_to_friend(frm.yourname.value,frm.youremail.value,frm.yourfname.value,frm.yourfemail.value,comp_id,divname1,divname2);
	return false;
}


/*function Requestimg(divname1) {
	document.getElementById(divname1).style.display = "block";
	document.getElementById(divname1).innerHTML = '<div style="height:450px;float:left;padding:12px;"><div style="float:left;width:430px;"><p style="padding-left:10px;padding-top:5px;padding-right:10px;" align="center"><font class="headText"><b>Loading...</b><br><br><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd_ajaxloader.gif" border="0" alt="" ></font></p></div></div>';
}*/

function forward_to_friend(yourname,youremail,yourfname,yourfemail,ad_id,divname1,divname2)
{	http=false;
	http = createRequestObject();
    //Requestimg(divname1);
	document.getElementById(divname1).innerHTML = '<div style="height:450px;float:left;padding:12px;"><div style="float:left;width:430px;"><p style="padding-left:10px;padding-top:5px;padding-right:10px;" align="center"><font class="headText"><b>Loading...</b><br><br><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd_ajaxloader.gif" border="0" alt="" ></font></p></div></div>';
	var forwfurl="wdfeaturestrip.php?yourname="+yourname+"&youremail="+youremail+"&yourfname="+yourfname+"&yourfemail="+yourfemail+"&ad_id="+ad_id+"&ftf=1";
	if (http) 
	{
		http.open("GET",forwfurl, true);
		http.send(null);
		http.onreadystatechange = function() {	
		if(http.readyState == 4){
			var response = http.responseText;
			//alert(response);
			document.getElementById(divname1).style.display="none";
			document.getElementById(divname2).style.display="block";
			document.getElementById(divname2).innerHTML = response;
	
		} }
	}
}

/*function handlerforwtofHttpResponse(divname1,divname2){

	if(http.readyState == 4){

			var response = http.responseText;
			//alert(response);
			document.getElementById(divname1).style.display="none";
			document.getElementById(divname2).style.display="block";
			document.getElementById(divname2).innerHTML = response;
	
    }
}*/
 

function report_spam_func(rep_name, rep_phone,report_for, ad_id,remarks){
	http=false;
	http = createRequestObject();
	var spamurl="wdfeaturestrip.php?rep_name="+rep_name+"&rep_phone="+rep_phone+"&report_for="+report_for+"&ad_id="+ad_id+"&remarks="+remarks+"&rspam=1";;
	if (http){
		http.open('get', spamurl,true);
		http.onreadystatechange = handleResponse;
		http.send(null);
	}
}

function handleResponse(){
    if(http.readyState == 4){
        var response = http.responseText;
		var response_sp=response.split("~~");
		var str;
		if(response_sp[0]=="Success"){
			if(response_sp[1]=="both"){
				str="Thank you for reporting the invalid phone number and address of "+c_name+" as this information will help us serve you better. We will look into the same at the earliest.";
			}else if(response_sp[1]=="phone"){
				str="Thank you for reporting the invalid phone number of "+c_name+" This information will help us serve you better. We will look into the same at the earliest.";
			}else if(response_sp[1]=="add"){
				str="Thank you for reporting the invalid address of "+c_name+" as this information will help us serve you better. We will look into the same at the earliest.";
			}
		}else{
			str="Oops! server is busy, please try after some time";
		}
		try{   
			 var loading_form='<table cellpadding="0" cellspacing="0" border="1" width="360" bgcolor="#ffffff" style="border:3px solid #FF6000;"><tr bgcolor="#E7E7E7"><td height="25" style="padding-left:15px; line-height:20px;border:1px solid #ffffff;"><div style="float:right;padding-right:5px;"><a href="javascript:;"onclick="javascript:hide_spam_div(\'div_reportspam\');" title="Close"><img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd-pop-close.gif" width="15" height="14" border="0"></a></td><td valign="top"></td></tr><tr><td class="smallText" align="left" style="padding:15px; ">'+str+'</td></tr></table>';
			 document.getElementById("div_reportspam").innerHTML=loading_form;
        }
		catch(e) {
			alert(e);
		}
    }
}

function validatecall(frm,custno,id)
{
	if(frm.contactno.value=="")
	{
		alert("Please enter your contact number.");
		frm.contactno.focus();
		return false;
	}
	if(isNaN(frm.contactno.value))
	{
		alert("Please enter a valid contact number.");
		frm.contactno.focus();
		return false;
	}
	forward_to_call(frm.contactno.value,custno,id);
	return false;
}
function forward_to_call(visitno,custno,id) {
	
	visitor = visitno;
	customer = custno;
	//var callurl="http://ivrs.bharatmatrimony.com/click2call.php?visitor="+visitor+"&customer="+customer+"&bu=11&duration=180000";
	var callurl ="wdcallus.php?visitor="+visitor+"&customer="+customer+"&bu=12&duration=180000";
	http=false;
	http = createRequestObject();
	if (http){
		http.open("GET", callurl, true);
		http.send(null);
		http.onreadystatechange = function() {
		if(http.readyState == 4){
			var return_str=http.responseText;
			var str;
			if(return_str == 'Y'){
			str="Thank you .You will receive call at the earliest.";
			}else{
			str="Error.Please try again";
			}
			document.getElementById("innerCall"+id).innerHTML=str;
/*			var loading_form=' The ad has been successfully sent to your mobile.';
			document.getElementById("innerSms"+errno).innerHTML=loading_form;*/
		}
	  }
	}
}

function validatemobile(frm,errno,adid)
{
	/*for (var i=0; i < frm.vendoropt.length; i++) {
		if (frm.vendoropt[i].checked) {
	      vendor_val = frm.vendoropt[i].value;
		}
	}*/
	vendor_val ="yes";
	if(frm.smobile_no.value=="")
	{
		alert("Please enter your mobile number.");
		frm.smobile_no.focus();
		return false;
	}
	if(isNaN(frm.smobile_no.value))
	{
		alert("Please enter a valid mobile number.");
		frm.smobile_no.focus();
		return false;
	}
	if (trim(frm.smobile_no.value).length < 10 )
	{
		alert ("Please enter 10 digit Mobile number.");
		frm.smobile_no.focus();
		return false;	
	}
	if (trim(frm.smobile_no.value).length > 10 )
	{
		alert ("Please enter a valid mobile number.");
		frm.smobile_no.focus();
		return false;	
	}
	if((frm.smobile_no.value).substr(0,1)!="9")
	{
		alert ("Mobile number starts with '9' only.");
		frm.smobile_no.focus();
		return false;
	}
	if(frm.security_number.value=="")
	{
		alert("Please enter given security text.");
		frm.security_number.focus();
		return false;
	}
	if(frm.security_number.value!=''){
		mobile_num=frm.smobile_no.value;
		advt_id=frm.comp_id.value;
		var sec_num=frm.security_number.value;
		check_security(sec_num,errno,adid);
	}
	
	return false;
}

function check_security(c_id,errno,advt_id){
	var check_url="wdchecksecurity.php?c_id="+c_id;
	http=false;
	http = createRequestObject();
	if (http) {
		http.open("GET", check_url, true);
		http.send(null);
		http.onreadystatechange = function() {
		if(http.readyState == 4){
		return_check=http.responseText;
			if(parseInt(return_check)==1){
			send_sms(mobile_num,errno,advt_id);
			}else{
			//document.getElementById("div_sms").innerHTML=form_content;
			document.getElementById("div_error"+errno).innerHTML="<font class='errtxt'>Please enter correct security text</font>";
			}
		}
	  }
	 }
}
/*function handlersendsmsHttpResponse1(){
	
	if(http.readyState == 4){
		return_check=http.responseText;
		if(parseInt(return_check)==1){
			alert(return_check);
			send_sms(mobile_num,advt_id);
		}else{
			//document.getElementById("div_sms").innerHTML=form_content;
			document.getElementById("div_error").innerHTML="<font class='errtxt'>Please enter correct security text</font>";
		}
	}
}*/
function send_sms(mobile_num,errno,ad_id){
	var loading_form='<img src="http://imgs.bharatmatrimony.com/bmimages/wd/wd_ajaxloader.gif" height="32" width="32" /><br /><font class="normaltext">Please wait.. the data is being transferred.</font>';
	document.getElementById("innerSms"+errno).innerHTML=loading_form;
	var smsurl="wdsendsms.php?mobile_num="+mobile_num+"&ad_id="+ad_id+"&vendor_option="+vendor_val;
	http=false;
	http = createRequestObject();
	if (http){
		http.open("GET", smsurl, true);
		http.send(null);
		http.onreadystatechange = function() {
		if(http.readyState == 4){
			var return_str=http.responseText;
			var str;
			if(return_str=="J"){
			str="Sucess";
			}else{
			str="Error";
			}
			var loading_form=' The ad has been successfully sent to your mobile.';
			document.getElementById("innerSms"+errno).innerHTML=loading_form;
		}
	  }
	}
}

/*function handlersendsmsHttpResponse(errno){
	if(http.readyState == 4){
		var return_str=http.responseText;
		var str;
		if(return_str=="J"){
		str="Sucess";
		}else{
		str="Error";
		}
		var loading_form=' The ad has been successfully sent to your mobile.';
		document.getElementById("SmsSuccess"+errno).innerHTML=loading_form;
	}
}*/



