$(function(){if($.Watermark){$(".searchFields #txtHouseNo").Watermark("House No.");$(".searchFields #txtPostCode").Watermark("Post Code");$(".searchFields #txtRefNo").Watermark("Ref. No.")}$(".optionMenu.partner :text").live("keydown",function(a){if(a.keyCode==13){$(this).parent().find("a").click();a.stopPropagation();a.preventDefault();return false}})});function listInventory(c,h,e,d,f,a,b,g,i){$.getJSON("listinventory.php",{branch:c,offset:e,pagesize:d,houseno:b==null?"":b,postcode:g==null?"":g,refno:i==null?"":i},function(m){var k=[];k.push('<table class="inventoryGrid"><tr class="header"><td style="width:100%;">Property</td>');if(f){k.push("<td>View</td>");k.push("<td>Download</td>")}if(a){k.push("<td>Delete</td>")}k.push("</tr>");if(m.totalcount>0){for(var l=0;l<m.dataset.count;l++){var j=m.dataset.results[l];k.push('<tr prop="'+j.property+'" '+(l>0?' class="topSeperator"':"")+">");k.push("<td><table><tr><td nowrap>House No.:</td><td>"+j.name+"</td></tr>");k.push("<tr><td nowrap>Post Code:</td><td>"+j.postcode+"</td></tr>");k.push('<tr><td nowrap>Ref. Num.:</td><td class="refnumvalue">'+j.refnumber+"</td></tr>");k.push("</table></td>");if(f){k.push('<td class="viewInv"><a href="javascript:;"><img src="../images/partners/view.gif" alt="View PDF" /></a></td>');k.push('<td class="viewInv"><a href="javascript:;"  download="true"><img src="../images/partners/download.gif" alt="Download PDF" /></a></td>')}if(a){k.push('<td class="delInv"><a href="javascript:;">Delete</a></td>')}k.push("</tr>")}}k.push("</table>");if(m.totalcount==0){k.push("No properties found for requested search.")}k.push('<div class="inventoryPages"><span class="pagingInidactor">Page ');k.push((e/d)+1);k.push(" of ");k.push(Math.ceil(m.totalcount/d));k.push("</span>");if(e>0&&m.totalcount>m.dataset.count){k.push('<a href="javascript:listInventory('+c+",'"+h+"', "+(e-d)+", "+d+", "+f+", "+a+');">&lt; Prev</a>')}if((e+m.dataset.count)<m.totalcount){k.push('<a href="javascript:listInventory('+c+",'"+h+"', "+(e+d)+", "+d+", "+f+", "+a+');">Next &gt;</a>')}k.push("</div>");var n=$(h).html(k.join("")).find(".viewInv>a").click(function(){var q=$(this).parents("tr:eq(0)").attr("prop"),o=$(this).attr("download")=="true",p="viewinventory.php?id="+q+"&download="+o;if(o){location.href=p}else{fb.start({href:p,title:"Viewing Inventory"})}}).end();if(a){n.find(".delInv>a").click(delInventory)}})}function submitQuery(b,c,d){$(b).attr("disabled","true").val("Submitting . . .");var a=function(e){var f=typeof(e)=="string"&&(e=="success");$(b).removeAttr("disabled").val("Submit Query");$("#queryResponse").text(f?"Query submitted, we will contact you shortly.":"Error submitting query, please try again.").removeClass().addClass(f?"success":"error")};$.ajax({type:"POST",url:c+"/sendquery.php",data:"to="+d+"&name="+escape(($("#txtname").val()||""))+"&tel="+escape(($("#txttel").val()||""))+"&email="+escape(($("#txtemail").val()||""))+"&query="+escape(($("#txtQuery").val()||"")),success:a,error:a})};
