	/*Click 2 Call*/
	var ipTrack = new ip_tracker();
	var setclick=0;
	var reqHTTP=null;
	var C2CForm = new Array();
	callStatus = false;
	function showC2CForm(ListID,diffID,fromObj){
		var indX= C2CForm.length;
		C2CForm[indX] = new c2c(ListID,fromObj);
		C2CForm[indX].pageFrom = "results";
		C2CForm[indX].diffID = diffID || null;
		C2CForm[indX].callAjax(diffID);
	}
	function c2c(ListID,fromObj){
		this.ListID = ListID;
		this.diffID = null;
		this.Status = null;
		this.ajax = null;
		this.sAjax = null;
		this.url  = "";
		this.statusURL = ip.host() + "/index.php?option=search&page=ajaxc2cform&notemplate=yes";
		this.C2CForm = ip.host() + "/index.php?option=search&page=ajaxc2cform&notemplate=yes&listingid=";
		this.successMsg = "";
		this.errorMsg = "";
		this.frm = null;
		this.divObj = $ip( ((fromObj=="sponsored") ? "HdivC2C" : "divC2C") +ListID) || new Object();
		this.statusTimer = null;
		this.pageFrom = "";
		this.resultFrom =  fromObj;
		this.InActiveObj = new Object();/*For Div Inactive Obj when call not intialised,  ex: C2C_unconnect_IP123456*/
		this.ActiveObj = new Object();/*For Div Active Obj when call connected,  ex: C2C_connect_IP123456*/
		this.ConnectBtn = new Object();/*Submit Button Object,  ex: submitC2C_IP123456*/
		this.DisConnectBtn= new Object();/*DisConnect Button Object,  ex: submitC2C_disconnect_IP123456*/
	};
	c2c.prototype.callAjax = function(newID){
		if(newID=="undefined" || newID==null || newID=="") newID=""; else {
			this.divObj =$ip(this.diffID);
			var newGenID = (String(this.divObj.id).indexOf("top")!=-1) ? String(this.divObj.id).replace("top","bot") : String(this.divObj.id).replace("bot","top");
			try{closeListingAjx(newGenID);}catch(e){}
		}
		ip.print("this.Status = " + this.Status);
		if(String(this.divObj.innerHTML).length>30 && this.Status==null){	 //If Already Opend
			try{
				this.frm.focus();
				if(this.frm.txtC2CName.value=="")this.frm.txtC2CName.focus(); else this.frm.txtC2CMobile.focus();
				this.divObj.style.display ="";
				return;
			}catch(e){traceErr(e,"c2c");return;}
		}
		/*if(this.divObj.style.display!="none"){	try{this.frm.txtC2CName.focus();return;}catch(e){return;}}*/
		this.sAjax = new getHTTPObject();
		if(!this.divObj || !this.sAjax)return;
		var thisObj = this;
		this.divObj.style.display="";
		this.divObj.innerHTML = ip.loadingStr;
		this.url = this.C2CForm + this.ListID+"&fromobject="+newID+"&resultFrom="+this.resultFrom+"&arrIndex="+parseInt(C2CForm.length-1);
		this.sAjax.open("GET",this.url,true);
		this.sAjax.onreadystatechange = function(){
			if(thisObj.sAjax.readyState==4){
				var res = (thisObj.sAjax.responseText=="") ? '<div style="padding:5px 10px;">Click 2 Call : Sending request failed</div>' : thisObj.sAjax.responseText;
				/* - <a href="javascript:void(0);" onclick="javascript:try{$ip(\'C2C'+thisObj.ListID+'\').style.display=\'none\';}catch(e){};showC2CForm(\''+thisObj.ListID+'\');">retry</a>*/
				thisObj.divObj.innerHTML = res;
				if(thisObj.sAjax.responseText==""){
					window.setTimeout(function(){thisObj.closeAjax();},10000);
				}else{
					window.setTimeout(function(){
						//thisObj.frm = $ip("frmC2C_"+thisObj.ListID);
						var frm = $ip( ((thisObj.resultFrom=='sponsored') ? "HfrmC2C_" : "frmC2C_") +thisObj.ListID);
						ip.print(" frm  = " +frm);
						thisObj.frm = frm;
						ip.print("thisObj.frm = " + thisObj.frm);
						thisObj.InActiveObj = $ip( ((thisObj.resultFrom=='sponsored') ? "HC2C_unconnect_" : "C2C_unconnect_") +thisObj.ListID);
						thisObj.ActiveObj = $ip( ((thisObj.resultFrom=='sponsored') ? "HC2C_connected_" : "C2C_connected_") +thisObj.ListID);
						thisObj.ConnectBtn = $ip( ((thisObj.resultFrom=='sponsored') ? "HsubmitC2C_" : "submitC2C_") +thisObj.ListID);
						thisObj.DisConnectBtn = $ip( ((thisObj.resultFrom=='sponsored') ? "HsubmitC2C_disconnect_" : "submitC2C_disconnect_") +thisObj.ListID);
						try{frm.txtC2CName.focus();}catch(e){ip.traceErr(e,'c2c.callAjax','c2c');}
					}
					,3000);
				}
			}
		};
		this.sAjax.send(null);
	};
	c2c.prototype.sendReqC2C = function(url,urlstr){/*,DivObject,frm*/
		callStatus = true;
		if(!this.validateC2C()) return false;
		ipTrack.ipC2C.trackSent();
		var thisObj = this;
		/*var DivObj = $ip( ((thisObj.resultFrom=='sponsored') ? "HC2C_connected_" : "C2C_connected_") +this.ListID);*/
		var DivObj = thisObj.ActiveObj;
		this.statusTimer = window.setInterval(
			function(){thisObj.SendReadTxt(thisObj.statusURL,thisObj.ActiveObj,thisObj.ListID);},4000
		);
		setclick=1;
		vars=url + urlstr;
		vars+="&visitor="+this.frm.txtC2CMobile.value;
		vars+="&visitorname="+this.frm.txtC2CName.value;
		reqHTTP = new getHTTPObject();
		this.ActiveObj.style.display ="";
		this.ActiveObj.innerHTML =  "Calling...";
		this.Status = "calling";
		this.InActiveObj.style.display = "none";
		this.ConnectBtn.style.display = "none";
		try{
			reqHTTP.open("GET", vars, true);
			reqHTTP.onreadystatechange = function(){
				if(reqHTTP.readyState == 4){
					thisObj.ActiveObj.style.display="";
					if(reqHTTP.responseText=="") thisObj.ActiveObj.innerHTML="Waiting for status..."; else thisObj.ActiveObj.innerHTML=reqHTTP.responseText;
				}
			}
			reqHTTP.send(null);
		}catch(e){ip.traceErr(e,'c2c.sendReqc2c','c2c');}
	};
	c2c.prototype.disconnectCall = function(status){
		try{reqHTTP.abort();}catch(e){}
		callStatus = false;
		clearInterval(this.statusTimer);
		if(this.pageFrom=="results"){
			if(this.diffID=="" || this.diffID==null || this.diffID=="undefined"){
				this.closeAjax();
				this.callAjax(this.diffID);
				/*showC2CForm(this.ListID,this.diffID,this.resultFrom);*/
			}else{
				try{closeListingAjx(this.diffID);}catch(e){}
				this.callAjax(this.diffID);
				/*showC2CForm(this.diffId,this.diffId,this.resultFrom);*/
			}
		}else{
			thisObj.InActiveObj.style.display="none";
			thisObj.ActiveObj.style.display="none";
			thisObj.ConnectBtn.style.display="none";
			thisObj.DisConnectBtn.style.display="none";
		}
	};
	c2c.prototype.validateC2C = function(){
		ip.print("this.frm = "+this.frm);
		if(!this.frm) this.frm=$ip( ((this.resultFrom=='sponsored') ? "HfrmC2C_" : "frmC2C_") +this.ListID);
		if(!IsMandatory(this.frm.txtC2CName,"text","Please enter your name",2)) return false;
		if(IsMin(this.frm.txtC2CName.value,3)) return ip.throwErr(this.frm.txtC2CName,"Name must contain a minimum of 3 characters.",2);
		if(!IsValidCharacters(this.frm.txtC2CName.value, alphabets + "&.-_ ",alphabets)) return ip.throwErr(this.frm.txtC2CName,"Special characters are not allowed. Please use only alphabets.",2);
		if(!IsMandatory(this.frm.txtC2CMobile,"text","Please enter a mobile number.",2)) return false;
		if(!IsValidCharacters(this.frm.txtC2CMobile.value, numbers , numbers)) return ip.throwErr(this.frm.txtC2CMobile,"Please use only numerals.",2);
		if(  String(this.frm.txtC2CMobile.value).length<10 || String(this.frm.txtC2CMobile.value).substr(0,1)!="9" || String(this.frm.txtC2CMobile.value).substr(0,2)=="91") return ip.throwErr(this.frm.txtC2CMobile,"Your mobile number should start with digit '9'. Do not Prefix '+', '0', '91'. ",2);
		/*if(	(!IsValidCharacters(this.frm.txtC2CMobile.value,numbers,numbers)) || (ip.strLen(this.frm.txtC2CMobile.value)<10) || (this.frm.txtC2CMobile.value.substr(0,1)!="9") ) return ip.throwErr(this.frm.txtC2CMobile,"Please enter a valid Mobile number");*/
		return true;
	};
	c2c.prototype.SendReadTxt = function(url,DivObject,id){
		if(!callStatus) return;
		reqHTTP = new getHTTPObject();
		txtFileId="&txtFileId="+id;
		thisObj = this;
		this.Status = "askrequest";
		if(setclick==1){
			try{
				reqHTTP.open("POST", url, true);
				reqHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				reqHTTP.send(txtFileId);
				reqHTTP.onreadystatechange = function(){
					if (reqHTTP.readyState == 4 ){
						//DivObject.style.display="";
						thisObj = thisObj;
						var req= reqHTTP.responseText;
						if(ip.Trim(req)=="") req="waiting for status...";
						DivObject.innerHTML=req;
						if(req.indexOf("Unable")!=-1){
							this.Status = "unable";
							window.setTimeout(function(){
								/*$ip("submitC2C_disconnect_"+thisObj.ListID).style.display="";*/
								thisObj.DisConnectBtn.style.display="";
							},1000);
						}
						if(req.indexOf("Connection established.")!=-1){
							this.Status = "success";
							if(this.pageFrom=="results"){
								window.setTimeout(function(){
									thisObj.disconnectCall(1);
									thisObj.closeAjax();
								},5000);
							}
						}
					}
				};
			}catch(e){ip.traceErr(e,'c2c.SendReadTxt','c2c');}
		}
	};
	c2c.prototype.closeAjax= function(){
		try{
			/*this.callAjax(this.diffID);*/
			this.ajax.abort();
			this.sAjax.abort();
		}catch(e){ip.traceErr(e,"closeAjax","c2c");}
	};
	/* End Click 2 Call */