		var text = $('#ad-desc').html();
		if (text.indexOf("caid:")) {

			var form = document.getElementById('ReplyToAdForm');
			var new_input_field = document.createElement('input');
			new_input_field.setAttribute('type', 'hidden');
			new_input_field.setAttribute('name', 'source');
			new_input_field.setAttribute('value', 'kijiji');
			form.appendChild(new_input_field);
			var new_input_field2 = document.createElement('input');
			new_input_field2.setAttribute('type', 'hidden');
			new_input_field2.setAttribute('name', 'ebayitemid');
			var pos1 = text.indexOf('caid:');
			var pos2 = text.lastIndexOf('</font>');
			if (pos2 <= 0) {
				pos2 = text.lastIndexOf('</FONT>');
			}
			if (pos1 > 0 && pos2 > 0) {

			new_input_field2.setAttribute('value', text.substring(pos1+5, pos2));
			form.appendChild(new_input_field2);
			
			//override onclick
			el = document.getElementById('send'); 
			el.onclick = function() { }
			$("#send").click(function(e) {
				var form = document.getElementById('ReplyToAdForm');

				var email = $("input[name='FromEmailAddress']").val(); 
				//this.disabled=true;copyFormFields();this.form.submit();return false;
				if (!email.length) {
				    //alert("email is empty");
					return true;
				}
				
				var etext = $("textarea[name='EmailText']").val(); 
				if (!etext.length) {
				    //alert("email text is empty");
					return true;
				} 

				var etext = $("input[name='BBUV']").val(); 
				if (!etext.length) {
					return true;
				} 	
				
				var href = $('.chg_city a').attr('href');
				//get city
				var city = 2600001;
                                var qapos = href.indexOf('qa-kijiji');
				var pos1 = href.indexOf('&Location=');
				city = href.substr(pos1+10, 7); 

				e.preventDefault();		
				if (qapos > 0) {
					form.action = "http://info.kijiji.com/scripts/replyCar.php?city="+city;				
				}
				else {	
				        form.action = "http://info.kijiji.com/scripts/replyCarP.php?city="+city;
                                }
				this.form.submit();
				return false;
			});				
			
			}
		}
