
function GetNewObject(){
	var httpObj = false;
	try {
		  httpObj = new XMLHttpRequest();
		} catch (trymicrosoft) {
		  try {
				httpObj = new ActiveXObject("Msxml2.XMLHTTP");
		  } catch (othermicrosoft) {
			try {
			  httpObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
			  httpObj = false;
			}
		}
	}
	return httpObj;
}

function HideDiv(DivName){
	document.getElementById(DivName).innerHTML = "";
	document.getElementById(DivName).style.display = "none";
}

function DisplayErrors(Message){
	HideDiv("success_msg_div");
	document.getElementById("msg_div").style.display = "block";
	document.getElementById("msg_div").innerHTML = Message;
	ShowShakingErrorMessage("msg_div");
}

function DisplaySuccess(Message){
	HideDiv("msg_div");
	document.getElementById("success_msg_div").style.display = "block";
	document.getElementById("success_msg_div").innerHTML = Message;
}

function HideErrorSms(){
	document.getElementById("msg_div").style.border = "";
	document.getElementById("msg_div").style.background = "";
	document.getElementById("msg_div").innerHTML = "";
	document.getElementById("msg_div").style.display = "none";
} 

function AddNewContact(){
	var httpObj = GetNewObject();
	var url = urlpath+"AddAddressBook.php";
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("address_book").innerHTML = "<p style='text-align:center;margin-top:80px; margin-bottom:80px;'><img src='./images/loadinfo.net.gif'><br><img src='./images/loading.gif'></p>";
		}
		if(httpObj.readyState==4){
			document.getElementById("address_book").innerHTML = httpObj.responseText;
		}
	}
	httpObj.send(null);
}

function addNewAddress(){	
	var httpObj = GetNewObject();

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	mobile_no = document.getElementById('contactno').value;
	
	if(trim(document.getElementById('contactname').value) == ''){
		DisplayErrorDiv("Please enter name.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	if(IsAlphaNumeric(trim(document.getElementById('contactname').value))){
		DisplayErrorDiv("Please enter only alphanumeric characters in name.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	if(mobile_no == ''){
		DisplayErrorDiv("Please enter mobile number.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	
	if(mobile_no){
		if( !IsOnlyNumbers(mobile_no) ) {
			DisplayErrorDiv("Mobile number appears to be incorrect!.","FreeSms_msg_div","success_msg_div");
			return false;
		}
		if( mobile_no.length != 10 ) {
			//DisplayErrorMessage("Mobile number appears to be incorrect!.","msg_div");
			DisplayErrorDiv("Mobile number appears to be incorrect! Please enter the 10 digit mobile number.","FreeSms_msg_div","success_msg_div");
			return false;
		}
		if( mobile_no.charAt(0) != '9' && mobile_no.charAt(0) != '8' && mobile_no.charAt(0) != '7') {
			DisplayErrorDiv("Mobile number appears to be incorrect!.","FreeSms_msg_div","success_msg_div");
			return false;
		} 
	}

	if(trim(document.getElementById('contactemail').value) != ''){
		if (!filter.test(document.getElementById('contactemail').value)) {
			DisplayErrorDiv("Please enter correct email.","FreeSms_msg_div","success_msg_div");
			return false;
		}
	}

	if(trim(document.getElementById('contactcity').value) != ''){
		if(IsAlphaNumeric(document.getElementById('contactcity').value)){
			DisplayErrorDiv("Only alphanumeric chracters are allowed in city.","FreeSms_msg_div","success_msg_div");
			return false;
		}
	}

	var contactname = document.getElementById("contactname").value;
	var contactno = document.getElementById("contactno").value;
	var contactemail = document.getElementById("contactemail").value;
	var contactcity = document.getElementById("contactcity").value;

	var url = urlpath+'freesmsaddphonebookajax.php?nickname='+contactname+'&contactno='+contactno+'&contactemail='+contactemail+'&contactcity='+contactcity;
	
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("add_contact_body").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/loading.gif'></p>";
		} 
		if(httpObj.readyState==4){
				window.location = urlpath+"FreeSms.php";
				document.getElementById('FreeSms_msg_div').style.visibility = 'hidden';
				DisplaySuccess('Your contact has been added successfully.');
				document.getElementById("FreeSms_msg_div").style.display = "none";
		}
	}
	httpObj.send(null);
}


function DelAddress(Id){
	
	var httpObj = GetNewObject();

	if(confirm('Are you sure you want to delete this contact from your addressbook.')){
		var alphabet = document.getElementById("alpha1").value;
		var url = urlpath+'AddAddressBook.php?id='+Id+"&alphabet="+alphabet;
	
		httpObj.open("POST",url,true);
		httpObj.onreadystatechange = function(){
			if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
				document.getElementById("contact_box").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/deleting.gif'></p>";
			}
			if(httpObj.readyState==4){
				DisplaySuccessDiv('Your contact has been deleted successfully.','success_msg_div','FreeSms_msg_div');
				document.getElementById("contact_box").innerHTML = httpObj.responseText;
			}
		}
		httpObj.send(null);
	}
}

function MobileNumber(Mobile){
	
	var httpObj = GetNewObject();

	document.getElementById("mobile").value = Mobile;
	var newno = 160;
	//var newno1 = 80;
	var newno1 = 160;
	var mobile = document.getElementById('mobile').value;
	SetFreeSmsValue('',mobile);
	var url = urlpath+"CheckRegMobile.php?mobile="+mobile;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if( httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3 ){}
		if(httpObj.readyState==4){
		var test = httpObj.responseText;
		if(test == 1){	
			 document.getElementById("remLen").value = newno;
			 document.getElementById("remLen1").value = newno;
			 checkMyCount();
		}else{
			document.getElementById("remLen").value = newno1;
		    document.getElementById("remLen1").value = newno1;
		}
	  }
	}
	httpObj.send(null);	
}

/*function MobileNumber(Mobile){
	document.getElementById("mobile").value = Mobile;
}*/

function AddMyNumber(mobilenumber){
	var httpObj = GetNewObject();
	var url = urlpath+'AddMyMobileNumber.php?MobileNumber='+mobilenumber;
	httpObj.open("GET",url,true);
	httpObj.onreadystatechange = function(){		
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){}
		if(httpObj.readyState==4){}
	}
	httpObj.send(null);
}

function SendSMS(){
	var httpObj = GetNewObject();

	mobile_no = document.getElementById('mobile').value;
	friends = document.getElementById('friends').value;
	friends_mob = document.getElementById('from_no').value;
	message = document.getElementById('message').value;
	
	/*if((mobile_no == friends_mob)){	
	
		DisplayErrors("Don't worry,this service works! You don't need to send a message to yourself. :-)");
		return false;
	}*/
	if((mobile_no == '')  && ( friends == 'select')){
		DisplayErrorDiv("Please enter the recipients mobile number.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	if(mobile_no == '9717709456' || mobile_no == '9999400964' || mobile_no == '9868894135' || mobile_no == '9418033126' || mobile_no == '9805510111' || mobile_no == '9845030652'){	
		DisplayErrorDiv("You can't send message to this no.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	if((mobile_no != '')  && (friends != 'select')){
		DisplayErrorDiv("Please select only one.","FreeSms_msg_div","success_msg_div");
		return false;
	}
	if(mobile_no){
		if( !IsOnlyNumbers(mobile_no) ) {
			DisplayErrorDiv("Mobile number appears to be incorrect!","FreeSms_msg_div","success_msg_div");
			return false;
		}
		if( mobile_no.length != 10 ) {
			DisplayErrorDiv("Mobile number appears to be incorrect! Please enter the 10 digit mobile number.","FreeSms_msg_div","success_msg_div");
			return false;
		}

		if( mobile_no.charAt(0) != '9' && mobile_no.charAt(0) != '8' && mobile_no.charAt(0) != '7') {
			DisplayErrorDiv("Mobile number appears to be incorrect!","FreeSms_msg_div","success_msg_div");
			return false;
		}
	}

	if(document.getElementById('message').value == ''){
		DisplayErrorDiv("Please Enter Your Message","FreeSms_msg_div","success_msg_div");
		return false;
	}
	//document.getElementById('sponsorAdDiv').style.display = 'block';
	//document.getElementById('sponsorAdDiv').className = 'show';

	var url = urlpath+'SendingSms.php?ToMobileNumber='+mobile_no+'&Message='+message+'&FromMobileNumber='+friends_mob;
	//alert(url);
	httpObj.open("GET",url,true);
	httpObj.onreadystatechange = function(){
		 
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("FreeSmsDisplay").innerHTML = "<p style='text-align:center;margin-top:80px; margin-bottom:80px;'><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/sending.gif'></p>";
		}
		if(httpObj.readyState==4){
			HideDiv('FreeSms_msg_div');
			//alert(httpObj.responseText);
			if(httpObj.responseText.indexOf('--not authenticated--') != -1){
				ShowAuthentication(mobile_no,message,friends_mob);
			}else if(httpObj.responseText.indexOf('--yes--') != -1){ 
				//ShowSmsSuccess();
				ShowFreeSmsLoadingDiv();
			}else {
				document.getElementById('FreeSmsDisplay').innerHTML = httpObj.responseText;
			}
		}

	}
	httpObj.send(null);
}

function SendNewSMS(){

	var httpObj = GetNewObject();

	mobile_no = document.getElementById('mobile').value;
	friends = document.getElementById('friends').value;
	friends_mob = document.getElementById('from_no').value;
	message = document.getElementById('message').value;
	
	if((mobile_no == friends_mob)){	
		DisplayErrors("Don't worry,this service works! You don't need to send a message to yourself. :-)");
		return false;
	}
	if((mobile_no == '')  && ( friends == 'select')){
		DisplayErrors("Please enter the recipients mobile number.");
		return false;
	}

	if((mobile_no != '')  && (friends != 'select')){
		DisplayErrors("Please select only one.");
		return false;
	}

	if(mobile_no){
		if( !IsOnlyNumbers(mobile_no) ) {
			DisplayErrors("Mobile number appears to be incorrect!");
			return false;
		}
		if( mobile_no.length != 10 ) {
			DisplayErrors("Mobile number appears to be incorrect!");
			return false;
		}

		if( mobile_no.charAt(0) != '9' && mobile_no.charAt(0) != '8') {
			DisplayErrors("Mobile number appears to be incorrect!");
			return false;
		}
	}

	if(document.getElementById('message').value == ''){
		DisplayErrors("Please Enter Your Message");
		return false;
	}
	
	document.getElementById('sponsorAdDiv').style.display = 'block';
	document.getElementById('sponsorAdDiv').className = 'show';

	var url = urlpath+'SendingNewSms.php?ToMobileNumber='+mobile_no+'&Message='+message+'&FromMobileNumber='+friends_mob;
	httpObj.open("GET",url,true);
	httpObj.onreadystatechange = function(){
		
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("FreeSmsDisplay").innerHTML = "<p style='text-align:center;margin-top:80px; margin-bottom:80px;'><img src='./images/loadinfo.net.gif'><br><img src='./images/sending.gif'></p>";
		}
		if(httpObj.readyState==4){
			if(httpObj.responseText.indexOf('--not authenticated--') != -1){
				ShowAuthentication(mobile_no,message,friends_mob);
			}else if(httpObj.responseText.indexOf('--yes--') != -1){				
				ShowSmsSuccess();	
			}else {
				document.getElementById('FreeSmsDisplay').innerHTML = httpObj.responseText;
			}
		}

	}
	httpObj.send(null);
}

/*function ShowAuthentication(to_no,message,from_no){
	DisplayErrors("You cannot send more than 160 characters .");
	document.getElementById("FreeSmsDisplay").innerHTML = '<ul><li>Mobile No. :</li><li><input name="mobile" id="mobile" value="'+ to_no +'" type="text" maxlength="10" onBlur="javascript:CheckMyMobile();" /></li><li>Message :</li><li><textarea name="message" id="message" onKeyUp="javascript:checkMyCount();">'+ message +'</textarea></li><li><input class="counter" type="text" id="remLen" name="remLen" maxlength="3" value="160" readonly /><input type="hidden" id="remLen1" name="remLen1" value="160" /> <span style=" font-weight:normal;">Characters Left</span></li><li><input value="Send SMS" class="fbbtn" onclick="javascript:SendSMS();" /></li></ul>';
}*/

function ShowAuthentication(to_no,message,from_no){
	DisplayErrors("You cannot send more than "+document.getElementById("smslengthcounthere").value+" characters .");
	document.getElementById("FreeSmsDisplay").innerHTML = '<ul><li>Mobile No. :</li><li><input name="mobile" id="mobile" value="'+ to_no +'" type="text" maxlength="10" onBlur="javascript:CheckMyMobile();" /></li><li>Message :</li><li><textarea name="message" id="message" onKeyUp="javascript:checkMyCount();">'+ message +'</textarea></li><li><input class="counter" type="text" id="remLen" name="remLen" maxlength="3" value="'+document.getElementById("smslengthcounthere").value+'" readonly /><input type="hidden" id="remLen1" name="remLen1" value="'+document.getElementById("smslengthcounthere").value+'" /> <span style=" font-weight:normal;">Characters Left</span></li><li><input value="Send SMS" class="fbbtn" onclick="javascript:SendSMS();" /></li></ul>';
}


/*function ShowFreeSmsLoadingDiv(){
	document.getElementById("FreeSmsDisplay").innerHTML = '<ul style="font-size:14px;"><li style="margin:0 0px 0px 0px; padding:0px 0px 8px 20px;">Message Sent Successfully.</li><li style="background:url(./images/ajax-loader.gif) 0 0 no-repeat; margin:0 0px 0px 0px; padding:0px 0px 8px 20px; display:block;" id="awaiting"> Awaiting Delivery Report.</li><li style=" margin:0 0px 0px 0px; padding:0px 0px 8px 20px; display:none;" id="successfully"> Delivered Successfully.</li></ul>';
	pid = setTimeout(function(){ShowSmsSuccess()}, 3000);
}*/




<!--======================================================= Delivery status start ================================================================================================

function ShowFreeSmsLoadingDiv(){
	/*document.getElementById("FreeSmsDisplay").innerHTML = '<ul style="font-size:14px;"><li style="margin:0 0px 0px 0px; padding:0px 0px 8px 20px;">Message Sent Successfully.</li><li style="background:url(./images/ajax-loader.gif) 0 0 no-repeat; margin:0 0px 0px 0px; padding:0px 0px 8px 20px; display:block;" id="awaiting"> Awaiting Delivery Report.</li><li style=" margin:0 0px 0px 0px; padding:0px 0px 8px 20px; display:none;" id="successfully"> Delivered Successfully.</li></ul>';*/
	pid = setTimeout(function(){ShowSmsSuccess()}, 3000);
}

function ShowSmsSuccess(){	
	var httpObj = GetNewObject();
	var url = urlpath+"FreeSmsSuccess.php";
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if( httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3 ){}
		if(httpObj.readyState==4){
			HideDiv('FreeSms_msg_div');
			ResponseArray = httpObj.responseText.split('~');
			document.getElementById('FreeSmsDisplay').innerHTML = ResponseArray[0];
			document.getElementById('To').value = ResponseArray[1];

			if( ResponseArray[2] != '' )
				document.getElementById('Status').value = ResponseArray[2];
			else
				document.getElementById('Status').value = 'Failed';

			var text1 = 'SMS Submitted to the System';
			var text2 = 'SMS Sent to ';
			var text3 = 'SMS Delivery : ';

			document.getElementById('runtimedeliveryreport').style.display = 'block';
			
			setTimeout( "startTyping('"+text1+" ' , 100 , 'textDestination1')" , 1000 );
			setTimeout( "startTyping('"+text2+" ' , 100 , 'textDestination2')" , 5000 );
			//setTimeout( "startTyping('"+text3+" ' , 100 , 'textDestination3')" , 8000 );

			document.getElementById("FreeSmsAgain").style.display = 'block';

			<!--================================================================= Add Contact ===============================================================================================-->
			if( ResponseArray[3] == '--1--' ){
				setTimeout("OpenMaskDiv('contact_0_0');",7000);
				document.getElementById('friend_mobile_0_0').value = document.getElementById('To').value;
			}
			<!--================================================================= Add Contact ===============================================================================================-->
		}
	}
	httpObj.send(null); 
}

  var delay=50;
  var currentChar=1;
  var destination="[not defined]";

function type(){

  if (document.getElementById){
    var dest=document.getElementById(destination);
    if (dest){
      dest.innerHTML=text.substr(0, currentChar);
      currentChar++
      if (currentChar>text.length){
		
		if(destination == 'textDestination1'){
			dest.innerHTML = dest.innerHTML+' <img src="'+urlpath+'images/accept.png" align="absmiddle">';
		}else if(destination == 'textDestination2'){
			dest.innerHTML = dest.innerHTML+'<span style="font-weight:bold;">'+document.getElementById('To').value+' <img src="'+urlpath+'images/accept.png" align="absmiddle"></span>';
		}else if(destination == 'textDestination3'){
			if( document.getElementById('Status').value == 'Successful' )
				dest.innerHTML = dest.innerHTML+'<span style="font-weight:normal;color:green; font-weight:bold;">'+document.getElementById('Status').value+' <img src="'+urlpath+'images/accept.png" align="absmiddle"></span>';
			else
				dest.innerHTML = dest.innerHTML+'<span style="font-weight:normal;color:red; font-weight:bold;">'+document.getElementById('Status').value+' <img src="'+urlpath+'images/delete.png" align="absmiddle"></span>';
		}		
		
		clearTimeout(pid);
      }else{
        pid = setTimeout("type()", delay);
      }
    }
  }
}

function startTyping(textParam, delayParam, destinationParam){
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  document.getElementById(destinationParam).style.display = 'block';
  type();
}

<!--======================================================= Delivery status end ================================================================================================


function SendEventSMS(eventvalue){ // Like Diwali SMS,New Year SMS etc....
	var httpObj = GetNewObject();
	mobile_no = document.getElementById('mobile').value;
	friends = document.getElementById('friends').value;
	friends_mob = document.getElementById('from_no').value;
	message = document.getElementById('message').value;
	
	if((mobile_no == friends_mob)){		
		DisplayErrors("Don't worry,this service works! You don't need to send a message to yourself. :-)");
		return false;
	}
	if((mobile_no == '')  && ( friends == 'select')){
		DisplayErrors("Please enter the recipients mobile number.");
		return false;
	}
	if(mobile_no == '9717709456' || mobile_no == '9999400964' || mobile_no == '9868894135' || mobile_no == '9418033126' || mobile_no == '9805510111' || mobile_no == '9845030652'){	
		DisplayErrors("You can't send message to this no.");
		return false;
	}
	if((mobile_no != '')  && (friends != 'select')){
		DisplayErrors("Please select only one.");
		return false;
	}
	if(mobile_no){
		if( !IsOnlyNumbers(mobile_no) ) {
			DisplayErrors("Mobile number appears to be incorrect!");
			return false;
		}
		if( mobile_no.length != 10 ) {
			DisplayErrors("Mobile number appears to be incorrect! Please enter the 10 digit mobile number.");
			return false;
		}

		if( mobile_no.charAt(0) != '9' && mobile_no.charAt(0) != '8' && mobile_no.charAt(0) != '7') {
			DisplayErrors("Mobile number appears to be incorrect!");
			return false;
		}
	}

	if(document.getElementById('message').value == ''){
		DisplayErrors("Please Enter Your Message");
		return false;
	}
	document.getElementById('sponsorAdDiv').style.display = 'block';
	document.getElementById('sponsorAdDiv').className = 'show';

	var url = urlpath+'SendingEventSms.php?ToMobileNumber='+mobile_no+'&Message='+message+'&FromMobileNumber='+friends_mob+'&ev='+eventvalue;
	httpObj.open("GET",url,true);
	httpObj.onreadystatechange = function(){
		
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("FreeSmsDisplay").innerHTML = "<p style='text-align:center;margin-top:80px; margin-bottom:80px;'><img src='./images/loadinfo.net.gif'><br><img src='./images/sending.gif'></p>";
		}
		if(httpObj.readyState==4){
			HideDiv('msg_div');
			if(httpObj.responseText.indexOf('--not authenticated--') != -1){
				ShowEventAuthentication(mobile_no,message,friends_mob,eventvalue);
			}else if(httpObj.responseText.indexOf('--yes--') != -1){
				ShowEventSmsSuccess();
			}else {
				document.getElementById('FreeSmsDisplay').innerHTML = httpObj.responseText;
			}
		}
	}
	httpObj.send(null);
}

function ShowEventAuthentication(to_no,message,from_no,eventvalue){
	DisplayErrors("You cannot send more than 160 characters in a free sms.");
	document.getElementById("FreeSmsDisplay").innerHTML = '<input type="hidden" id="freesmscheck" name="freesmscheck" value="999" /><ul><li>Mobile No. :</li><li><input name="mobile" id="mobile" value="'+ to_no +'" type="text" maxlength="10" onBlur="javascript:CheckMyMobile();" /></li><li>Message :</li><li><textarea name="message" id="message" onKeyUp="javascript:checkMyCount();">'+ message +'</textarea></li><li><input class="counter" type="text" id="remLen" name="remLen" maxlength="3" value="160" readonly /><input type="hidden" id="remLen1" name="remLen1" value="160" /> <span style=" font-weight:normal;">Characters Left</span></li><li><input value="Send SMS" type="button" class="fbbtn" onclick="javascript:SendEventSMS(\''+eventvalue+'\');" /></li></ul>';
}

function ShowEventSmsSuccess(){
	var httpObj = GetNewObject();
	var url = urlpath+"FreeSmsEventSuccess.php";
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if( httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3 ){}
		if(httpObj.readyState==4){
			HideErrorSms();
			document.getElementById("FreeSmsDisplay").innerHTML = httpObj.responseText;
			document.getElementById("FreeSmsAgain").style.display = 'block';
		}
	}
	httpObj.send(null);
}


function ShowContacts(value){
	var httpObj = GetNewObject();
	//HideErrorSms();
	var url = urlpath + "AddAddressBook.php?alphabet=" + value;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("contact_body").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/loading.gif'></p>";
		}
		if(httpObj.readyState==4){
			document.getElementById("contact_box").innerHTML = httpObj.responseText;
		}
	}
	httpObj.send(null);
}	

function DisplayEditRecords(id,count){
	var hidediv = "contact_"+id;
	var opendiv = "contact_"+id+"_"+count; 
	document.getElementById('mask_div').style.visibility = 'visible';
	document.getElementById(opendiv).style.display = "block";
}

function CloseEditRecords(id,count){
	var opendiv = "contact_"+id+"_"+count;
	document.getElementById(opendiv).style.display = "none";
	document.getElementById('mask_div').style.visibility = 'hidden';
}

/*function SaveEditAddress(id,count){
	var httpObj = GetNewObject();

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	var friend_name = "friend_name_"+id+"_"+count;
	var friend_mobile = "friend_mobile_"+id+"_"+count;
	var friend_email = "friend_email_"+id+"_"+count;
	var friend_city = "friend_city_"+id+"_"+count;

	var name = trim(document.getElementById(friend_name).value);
	var mobile = trim(document.getElementById(friend_mobile).value);
	var email = trim(document.getElementById(friend_email).value);
	var city = trim(document.getElementById(friend_city).value);
	
	if(name == ''){
		DisplayErrorMessage("Please enter name.","EditMsgDiv_"+id);
		return false;
	}
	if(IsAlphaNumeric(name)){
		DisplayErrorMessage("Please enter only alphanumeric characters in name.","EditMsgDiv_"+id);
		return false;
	}
	if(mobile == ''){
		DisplayErrorMessage("Please enter mobile number.","EditMsgDiv_"+id);
		return false;
	}
	if(mobile){
		if(!IsOnlyNumbers(mobile)) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id);
			return false;
		}
		if( mobile.length != 10 ) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id);
			return false;
		}
		if( mobile.charAt(0) != '9'  && mobile.charAt(0) != '8' ) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id); 
			return false;
		}
	}

	if(email!=''){
		if (!filter.test(email)) {
			DisplayErrorMessage("Please enter correct email.","EditMsgDiv_"+id);
			return false;
		}
	}

	if(city!=''){
		if(IsAlphaNumeric(city)){
			DisplayErrorMessage("Only alphanumeric chracters are allowed in city.","EditMsgDiv_"+id);
			return false;
		}
	}

	CloseEditRecords(id,count);
	var opendiv = "edit_"+id;
	var opendiv1 = "contact_"+id;
	var alphabet = document.getElementById("alpha1").value;
	
	
	var url = urlpath+"AddAddressBook.php?alphabet="+alphabet+"&nickname="+name+"&mobile="+mobile+"&email="+email+"&city="+city+"&id="+id+"&count="+count;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById('contact_box').innerHTML = "<p style='text-align:center;margin-top:30px;'><img src='./images/updating.gif'></p>";
		}
		if(httpObj.readyState==4){
			document.getElementById('contact_box').innerHTML = httpObj.responseText;
			DisplaySuccessDiv("Contact has been updated.","success_msg_div","FreeSms_msg_div")
		}	
	}
	httpObj.send(null);
}*/

function MobileVerifyPage(){
	window.location = urlpath+"MobileVerification.html";
}

function ReSendVerificationCode(){

	var httpObj = GetNewObject();
	
	var mobile = document.getElementById('mobile').value;
	var codesent = document.getElementById('numberofverificationcodesent').value;
	var url = urlpath+"MobileVerifyFreeSms.php?CodeSent="+codesent;
	httpObj.open("POST",url,true);
	document.getElementById('msg_div').style.display = "block"; 
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3){
			document.getElementById('msg_div').innerHTML = "<p style='text-align:center;margin-top:5px;margin-bottom:5px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/sending.gif'></p>";
			document.getElementById('VerificationCodeDiv').style.display = "none";
			document.getElementById('savebutton').style.display = "none";
		}else{
			var response = 	httpObj.responseText;
			ResponseArray = response.split('--');
			
			if(ResponseArray[0]==4){
				//document.getElementById('msg_div').innerHTML = 'A verification code has been sent to your mobile (+91'+mobile+') as an SMS.';
				DisplaySuccess('A verification code has been sent to your mobile (+91'+mobile+') as an SMS.');
				document.getElementById('MailCustomerSupport').style.display = "block";
				document.getElementById('savebutton').style.display = "block";
			}else{
				document.getElementById('savebutton').style.display = "block";
				//document.getElementById('msg_div').innerHTML = 'A verification code has been sent to your mobile (+91'+mobile+') as an SMS.';
				DisplaySuccess('A verification code has been sent to your mobile '+mobile+' as an SMS.');
				document.getElementById('VerificationCodeDiv').style.display = "block";
				document.getElementById('numberofverificationcodesent').value = response;
			}
		}
	}
	httpObj.send(null); 
}

function VerifyMobile(){

	var httpObj = GetNewObject();

	var mobilecode = document.getElementById('mobilecode').value;
	
		if(mobilecode==''){
			DisplayErrors("Please enter verification code."); 
			return false;
		}

	var url = urlpath+"MobileVerifyFreeSms.php?code="+mobilecode;
	httpObj.open("POST",url,true);
	document.getElementById('msg_div').style.display = "block";
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3){
			document.getElementById('msg_div').innerHTML = "<p style='text-align:center;margin-top:5px;margin-bottom:5px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/updating.gif'></p>";
			document.getElementById('VerificationCodeDiv').style.display = "none";
			document.getElementById('savebutton').style.display = "none";
		}
		if(httpObj.readyState==4){
			document.getElementById('msg_div').innerHTML = '';
			document.getElementById('msg_div').style.display = "none";
			if(httpObj.responseText=='--11--'){
				if(document.getElementById('MailCustomerSupport').style.display == "block")
					document.getElementById('VerificationCodeDiv').style.display = "none";
				else
					document.getElementById('VerificationCodeDiv').style.display = "block;";
				document.getElementById('savebutton').style.display = "block";
				DisplayErrors("Please enter correct verification code.");
				return false;
			}else{
				window.location = urlpath+"FreeSms.php";
				return false;
			}
		}
	}
	httpObj.send(null);
}	

function VerifyMobile1(){

	var httpObj = GetNewObject();

	var code = document.getElementById('hidden_code').value;
	var mobilecode = document.getElementById('mobilecode').value;
	
		if(mobilecode==''){
			DisplayErrors("Please enter verification code.");
			return false;
		}
		if(mobilecode!=code){
			DisplayErrors("Please enter correct verification code.");
			return false;
		}
	var url = urlpath+"MobileVerifyFreeSms.php";
	httpObj.open("POST",url,true);
	document.getElementById('msg_div').style.display = "block";
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3){
			document.getElementById('msg_div').innerHTML = "<p style='text-align:center;margin-top:5px;margin-bottom:5px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/updating.gif'></p>";
		}
		if(httpObj.readyState==4){
			document.getElementById('msg_div').innerHTML = '';
			document.getElementById('msg_div').style.display = "none";	
			window.location = urlpath+"FreeSms.php";
			return false;
		}
	}
	httpObj.send(null);
}	

function ChangeMobile(){

	var httpObj = GetNewObject();

	var mobile = document.getElementById('new_mobile').value;
	var url = urlpath+"ChangeMobileNumber.php?mobile="+mobile;
	document.getElementById('msg_div').style.display = "block";
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1 || httpObj.readyState==2 || httpObj.readyState==3){
			document.getElementById('msg_div').innerHTML = "<p style='text-align:center;margin-top:5px;margin-bottom:5px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/updating.gif'></p>";
		}
		if(httpObj.readyState==4){
			var strContent = httpObj.responseText;
			if(strContent=='--1--'){
				document.getElementById('msg_div').innerHTML = '';
				document.getElementById('msg_div').style.display = "none";	
				DisplayErrors("Mobile number already registered on YouMint.");
			}else if(strContent=='--2--'){
				document.getElementById('msg_div').innerHTML = '';
				document.getElementById('msg_div').style.display = "none";	
				DisplayErrors("Mobile is blocked. Contact Support.");
			}else if(strContent=='--3--'){
				document.getElementById('msg_div').innerHTML = '';
				document.getElementById('msg_div').style.display = "none";	
				DisplayErrors("Mobile number seems to be incorrect.");
			}else if(strContent=='--4--'){
				document.getElementById('msg_div').innerHTML = '';
				document.getElementById('msg_div').style.display = "none";	
				DisplayErrors("Mobile number should have 10 digits.");
			}else{
				document.getElementById('msg_div').innerHTML = '';
				document.getElementById('msg_div').style.display = "none";
				document.getElementById('ShowMobileNumber').style.display = "none";
				document.getElementById('details').style.display = "block";
				document.getElementById('details').style.display = strContent;
			}
		}
	}
	httpObj.send(null);
}

function checkMyCount(){
	var fT, count, msga, ulta;
	msga = document.getElementById("remLen1").value;
	count = document.getElementById("message").value.length;
	ulta = msga - count;
	document.getElementById("remLen").value = ulta;
	if( count > msga ){
		document.getElementById("message").value = document.getElementById("message").value.substring(0, msga);
		document.getElementById("remLen").value = msga - document.getElementById("message").value.length;
	}
}


function CheckMyMobile(){
	
	var httpObj = GetNewObject();

	var newno = 160;
	//var newno1 = 80;
	var newno1 = 160;
	var mobile = document.getElementById('mobile').value;
	var url = urlpath+"CheckRegMobile.php?mobile="+mobile;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==4){
		var test = httpObj.responseText;
		if(test == 1){	
			 document.getElementById("remLen").value = newno;
			 document.getElementById("remLen1").value = newno;
		}else{
			document.getElementById("remLen").value = newno1;
		    document.getElementById("remLen1").value = newno1;
		}
	  }
	}
	httpObj.send(null);	
}


function contact_box(){
	document.getElementById("contact_box").style.display = "block";
	document.getElementById("add_contact_body").style.display = "none";
	document.getElementById("ContactsStyle").innerHTML = '<div id="add_contact_tab_middle"><p style="font-size:12px; font-weight:bold; color:#000000; text-align:right; position:relative; top:3px; right:20px;">Contacts <div style="position:absolute; top:5px; left:10px;"><img src="images/contacts.gif"/></div></p></div>';
	document.getElementById("AddContactsStyle").innerHTML = '<div id="add_contact_tab_middle"><p style="font-size:12px; font-weight:bold; color:#00489c; text-align:right; position:relative; top:3px; right:15px; ">	Add Contacts <div style="position:absolute; top:5px; left:10px;"><img src="images/add_contacts.gif"/></div></p></div>';
	document.getElementById("msg_div").innerHTML = "";
	document.getElementById("msg_div").style.display = "none";
}

function add_contact_body(){
	document.getElementById("contact_box").style.display = "none";
	document.getElementById("add_contact_body").style.display = "block";
	document.getElementById("ContactsStyle").innerHTML = '<div id="add_contact_tab_middle"><p style="font-size:12px; font-weight:bold; color:#00489c; text-align:right; position:relative; top:3px; right:20px;">Contacts <div style="position:absolute; top:5px; left:10px;"><img src="images/contacts.gif"/></div></p></div>';
	document.getElementById("AddContactsStyle").innerHTML = '<div id="add_contact_tab_middle"><p style="font-size:12px; font-weight:bold; color:#000000; text-align:right; position:relative; top:3px; right:15px; ">	Add Contacts <div style="position:absolute; top:5px; left:10px;"><img src="images/add_contacts.gif"/></div></p></div>';
	document.getElementById("msg_div").innerHTML = "";
	document.getElementById("msg_div").style.display = "none";
}

function smsoutbox(){
	window.location = urlpath+"freesmsoutbox.php";
}

function ShowThanksMessage(){
	DisplayErrors('Your mobile number has been verified.');
}

<!--===============================================================================================================================================================================-->
function CloseMaskDiv(divname){
	document.getElementById(divname).style.display = 'none';
	document.getElementById('mask_div').style.visibility = 'hidden';
}

function OpenMaskDiv(divname){
	document.getElementById(divname).style.display = 'block';
	document.getElementById('mask_div').style.visibility = 'visible';
}


function DisplayErrorMessage(Message,DivName){
	HideDiv(DivName);
	HideDiv("success_msg_div");
	document.getElementById(DivName).style.display = "block";	
	document.getElementById(DivName).innerHTML = Message;	
	ShowShakingErrorMessage(DivName);
}

function HideErrorMessage(DivName){
	document.getElementById(DivName).style.border = "";
	document.getElementById(DivName).style.background = "";
	document.getElementById(DivName).innerHTML = "";
	document.getElementById(DivName).style.display = "none";
}

function ShowOutBoxDiv(){
	
	document.getElementById('ContactDiv').style.display = "none";
	document.getElementById('OutboxDiv').style.display = "block";
}

function ShowContactsWithCookies(value){
	var httpObj = GetNewObject();
	var url = urlpath + "AddAddressBookWithCookies.php?alphabet=" + value;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("contact_body").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='./images/loadinfo.net.gif'><br><img src='./images/loading.gif'></p>";
		}
		if(httpObj.readyState==4){
			document.getElementById("contact_box").innerHTML = httpObj.responseText;
		}
	}
	httpObj.send(null);
}	

function DeleteBulkContacts(FormName, FieldName, totalrecords){
	
	var flag = false;
	var value = '';
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	
	if(!countCheckBoxes){
		if(objCheckBoxes.checked){
			value = objCheckBoxes.value;
			value = value+',';
			flag = true;
		}
	}
	else{
		for(var i = 0; i < countCheckBoxes; i++){
			if(objCheckBoxes[i].checked){
				//alert(objCheckBoxes[i].value);
				flag = true; 
				if(value=='')
					value = objCheckBoxes[i].value+',';
				else
					value = value+objCheckBoxes[i].value+',';
			}
		}
	}
	if(!flag){  
		alert('Please select checkbox to delete contacts.');
		return false;
	}else{
		if(confirm("Are you sure you want to delete these contact(s) from your addressbook.")){
			var alphabet = document.getElementById("alpha1").value;
			var url = urlpath+"AddAddressBook.php?bulkdel_id="+value+"&tr="+totalrecords+"&alphabet="+alphabet;
			httpObj.open("POST",url,true);
			httpObj.onreadystatechange = function(){
				/*if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
					document.getElementById("TestSmsOutBox").innerHTML = '<div id="account_main"  style="margin-top:0px;"><div id="account_main_top"><div id="tr_gray5"></div></div><div id="account_main_middle"><div id="account_whitebox"><div id="account_whitebox_top"><div id="tl_white"> </div><div id="tr_white"> </div></div><div id="account_whitebox_middle" style="padding-bottom:0px;"><p style="text-align:center;margin-top:40px;margin-bottom:40px;"><img src="./images/loadinfo.net.gif"><br><img src="./images/loading.gif"></p></div><div id="account_whitebox_bottom"><div id="bl_white"> </div><div id="br_white"> </div></div></div></div><div id="account_main_bottom"><div id="bl_gray5"> </div><div id="br_gray5"> </div></div></div>';
				}*/ 
				
				if(httpObj.readyState==4){
					document.getElementById("contact_box").innerHTML = httpObj.responseText;
					DisplaySuccessDiv('Contacts from your addressbook has been deleted successfully.','success_msg_div','FreeSms_msg_div');
				}
			}
			httpObj.send(null);
		}
	}
}

function DisplayErrorDiv(Message,DivName1,DivName2){
	HideDiv(DivName2);
	document.getElementById(DivName1).style.display = "block";
	document.getElementById(DivName1).innerHTML = Message;
	ShowShakingErrorMessage(DivName1);
}

function DisplaySuccessDiv(Message,DivName1,DivName2){
	HideDiv(DivName2);
	document.getElementById(DivName1).style.display = "block";
	document.getElementById(DivName1).innerHTML = Message;
}
/*
function PreviledgeSms(){
	alert("hi");
	var httpObj = GetNewObject();
	var url = preurlpath+"index.php";
	alert(url);
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("PreDiv").innerHTML = "<p style='text-align:center;margin-top:80px; margin-bottom:80px;'><img src='./images/loadinfo.net.gif'><br><img src='./images/loading.gif'></p>";
		}
		if(httpObj.readyState==4){
			alert(httpObj.responseText);
			document.getElementById("PreDiv").style.display = "block";
			document.getElementById("PreDiv").innerHTML = httpObj.responseText;
		}
	}
	httpObj.send(null);
} */

<!--================================================================= Add Contact ===============================================================================================-->

/*function addOverlayNewAddress(){	
	var httpObj = GetNewObject();

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	mobile_no = document.getElementById('contactno').value;
	
	if(document.getElementById('contactname').value == ''){
		DisplayErrorDiv("Please enter name.","MsgDiv","success_msg_div");
		return false;
	}
	if(IsAlphaNumeric(document.getElementById('contactname').value)){
		DisplayErrorDiv("Please enter only alphanumeric characters in name.","MsgDiv","success_msg_div");
		return false;
	}
	if(mobile_no == ''){ 

		DisplayErrorDiv("Please enter mobile number.","MsgDiv","success_msg_div");
		return false;
	}
	
	if(mobile_no){
		if( !IsOnlyNumbers(mobile_no) ) {
			DisplayErrorDiv("Mobile number appears to be incorrect!.","MsgDiv","success_msg_div");
			return false;
		}
		if( mobile_no.length != 10 ) {
			//DisplayErrorMessage("Mobile number appears to be incorrect!.","msg_div");
			DisplayErrorDiv("Mobile number appears to be incorrect! Please enter the 10 digit mobile number.","MsgDiv","success_msg_div");
			return false;
		}
		if( mobile_no.charAt(0) != '9' && mobile_no.charAt(0) != '8' && mobile_no.charAt(0) != '7') {
			DisplayErrorDiv("Mobile number appears to be incorrect!.","MsgDiv","success_msg_div");
			return false;
		} 
	}

	if(trim(document.getElementById('contactemail').value) != ''){
		if (!filter.test(document.getElementById('contactemail').value)) {
			DisplayErrorDiv("Please enter correct email.","MsgDiv","success_msg_div");
			return false;
		}
	}

	if(trim(document.getElementById('contactcity').value) != ''){
		if(IsAlphaNumeric(document.getElementById('contactcity').value)){
			DisplayErrorDiv("Only alphanumeric chracters are allowed in city.","MsgDiv","success_msg_div");
			return false;
		}
	}

	var contactname = document.getElementById("contactname").value; 
	var contactno = document.getElementById("contactno").value;
	var contactemail = document.getElementById("contactemail").value;
	var contactcity = document.getElementById("contactcity").value;

	var url = urlpath+'freesmsaddphonebookajax.php?nickname='+contactname+'&contactno='+contactno+'&contactemail='+contactemail+'&contactcity='+contactcity;
	httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			document.getElementById("OverlayDiv").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/loading.gif'></p>";
		} 
		if(httpObj.readyState==4){
			if( trim(httpObj.responseText) == '--1--'){
				CloseMaskDiv('contactdiv');
				window.location.href = urlpath + 'FreeSms.html'
			}
		}
	}
	httpObj.send(null);
}*/


function SaveEditAddress(id,count){
	var httpObj = GetNewObject();
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	var friend_name = "friend_name_"+id+"_"+count;
	var friend_mobile = "friend_mobile_"+id+"_"+count;
	var friend_email = "friend_email_"+id+"_"+count;
	var friend_city = "friend_city_"+id+"_"+count;

    var name = trim(document.getElementById(friend_name).value);
	var mobile = trim(document.getElementById(friend_mobile).value);
	var email = trim(document.getElementById(friend_email).value);
	var city = trim(document.getElementById(friend_city).value);
	
	if(name == ''){
		DisplayErrorMessage("Please enter name.","EditMsgDiv_"+id);
		return false;
	}
	if(IsAlphaNumeric(name)){
		DisplayErrorMessage("Please enter only alphanumeric characters in name.","EditMsgDiv_"+id);
		return false;
	}
	if(mobile == ''){
		DisplayErrorMessage("Please enter mobile number.","EditMsgDiv_"+id);
		return false;
	}
	if(mobile){
		if(!IsOnlyNumbers(mobile)) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id);
			return false;
		}
		if( mobile.length != 10 ) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id);
			return false;
		}
		if( mobile.charAt(0) != '9'  && mobile.charAt(0) != '8' ) {
			DisplayErrorMessage("Mobile number appears to be incorrect!.","EditMsgDiv_"+id); 
			return false;
		}
	}

	if(email!=''){
		if (!filter.test(email)) {
			DisplayErrorMessage("Please enter correct email.","EditMsgDiv_"+id);
			return false;
		}
	}

	if(city!=''){
		if(IsAlphaNumeric(city)){
			DisplayErrorMessage("Only alphanumeric chracters are allowed in city.","EditMsgDiv_"+id);
			return false;
		}
	}

	CloseEditRecords(id,count);
	var opendiv = "edit_"+id;
	var opendiv1 = "contact_"+id;
	var alphabet = document.getElementById("alpha1").value;

    if(id==0){
		var url = urlpath+"AddAddressBook.php?alphabet="+alphabet+"&nickname="+name+"&mobile="+mobile+"&email="+email+"&city="+city+"&Update=Update";
	}else{
		var url = urlpath+"AddAddressBook.php?alphabet="+alphabet+"&nickname="+name+"&mobile="+mobile+"&email="+email+"&city="+city+"&id="+id+"&count="+count;

	}

    httpObj.open("POST",url,true);
	httpObj.onreadystatechange = function(){
		if(httpObj.readyState==1||httpObj.readyState==2||httpObj.readyState==3){
			
			if(id==0){
			document.getElementById("OverlayDiv").innerHTML = "<p style='text-align:center;margin-top:40px;margin-bottom:40px; '><img src='"+urlpath+"images/loadinfo.net.gif'><br><img src='"+urlpath+"images/loading.gif'></p>";
			}else{
				document.getElementById('contact_box').innerHTML = "<p style='text-align:center;margin-top:30px;'><img src='./images/updating.gif'></p>";
			}
			
		}
		if(httpObj.readyState==4){
			if(id==0){
			   window.location.href = urlpath+"FreeSms.html"
			}else{
				document.getElementById('contact_box').innerHTML = httpObj.responseText;
				DisplaySuccessDiv("Contact has been updated.","success_msg_div","FreeSms_msg_div")
			}
		}	
	}
	httpObj.send(null);
}

<!--================================================================= Add Contact ===============================================================================================-->
