var hasChanges=false;function doAction(skipValidation,actionName,linkURL,submitForm_0,skipConfirmation){bCancel=skipValidation;document.forms[0].cmd.value=actionName;if(linkURL&&document.forms[0].linkForwardName){document.forms[0].linkForwardName.value=linkURL;}
if((skipConfirmation==undefined)||(skipConfirmation==false)){result=eval("invoke"+document.forms[0].getAttributeNode("name").value+"Action(actionName)");if(result==false){return;}}
if((submitForm_0!="undefined")&&(submitForm_0==true)){if(document.forms[0].onsubmit()!=false){document.forms[0].submit();}
return;}
return true;}
function getContext(path){var parts=path.split("/");return parts[1];}
function updateUrlPaging(element){if(element=="Prev"||element=="Next"||element=="Mid"||element=="First"||element=="Last"){var main="url"+element;var urlRoot=window.location.protocol+"//"+window.location.host+app;alert("urlRoot====>> "+urlRoot);alert("document.getElementById(main).value====>> "+document.getElementById(main).value);window.parent.location=urlRoot+document.getElementById(main).value+"&cmd=doManage";}}
function checkUncheckAll(theElement){var theForm=theElement.form,z=0;for(z=0;z<theForm.length;z++){if(theForm[z].type=="checkbox"&&theForm[z].name!="checkall"){theForm[z].checked=theElement.checked;}}}
function check(theElement){var theForm=theElement.form,z=0;var flag;for(z=0;z<theForm.length;z++){if(theForm[z].checked==true){return true;}}}
function validate_delete(theElement){var flag=check(theElement);if(flag==true){var delete_flag=confirm("Are you sure you wish to delete record[s] ?");if(delete_flag==true){return doAction(true,"doDelete",null,false,true);}else{return false;}}else{alert("Please select atleast one record.");return false;}}
function checkUploadFileFormat(){var logoVal=document.getElementById("logo").value;var strLen=logoVal.length;var strIndex=strLen-3;var newStr=logoVal.substring(strIndex).toLowerCase();if(!((newStr=="jpg")||(newStr=="gif")||(newStr=="png"))){alert("Only .jpg / .gif / .png formats allowed.");document.getElementById("logo").value="";document.getElementById("fileInput").innerHTML="<input type='file' id='logo' class='input_filebox' onchange='checkUploadFileFormat();' onkeypress='clearFileBox();'>";}}
function clearFileBox(){document.getElementById("fileInput").innerHTML="<input type='file' id='logo' class='input_filebox' onchange='checkUploadFileFormat();' onkeypress='clearFileBox();'>";}
function uncheckMainChk(){document.getElementById("mainChk").checked=false;}
function section8AjaxRequest(actionForwardName,cmdMethodName,parameterString,onCompleteFunctionName){var urlRoot=actionForwardName;var pars=parameterString+"&cmd="+cmdMethodName;var url=window.location.protocol+"//"+window.location.host+"/"+
getContext(window.location.pathname)+"/"+urlRoot;var myAjax=new Ajax.Request(url,{method:'post',parameters:pars,onComplete:onCompleteFunctionName});}
function section8AjaxRequest(actionForwardName,cmdMethodName,onCompleteFunctionName){var urlRoot=actionForwardName;var pars="&cmd="+cmdMethodName;var url=window.location.protocol+"//"+window.location.host+"/"+
getContext(window.location.pathname)+"/"+urlRoot;var myAjax=new Ajax.Request(url,{method:'get',parameters:pars,onComplete:onCompleteFunctionName});}
function onClickViewImage(path){var urlRoot=path;var ajaxMethod="doAjaxReport";section8AjaxRequest(urlRoot,ajaxMethod,onAjaxReturnViewImage);}
function onAjaxReturnViewImage(originalRequest){var s=new String();s=String(originalRequest.responseText);var responseText=originalRequest.responseText;if(responseText=="not-found"){var messageFail='Could not find HOW PACKED for the ADDRESS NUMBER and MARKS';setStatusBar(messageFail);alert(messageFail);return;}
if(responseText!=null&&responseText!=""){var wnd=window.open('about:blank','_blank','width=650,height=500,status=no,menubar=no,resizable=yes,scrollbars=yes');wnd.location.replace(responseText);}else{var wnd=window.open('about:blank','_blank','width=650,height=500,status=no,menubar=no,resizable=yes,scrollbars=yes');wnd.location.replace('/upload/default.png');}}
function checkUploadFileFormatOfferLogo(){var logoVal=document.getElementById("offerLogo").value;var strLen=logoVal.length;var strIndex=strLen-3;var newStr=logoVal.substring(strIndex).toLowerCase();if(!((newStr=="jpg")||(newStr=="gif")||(newStr=="png"))){alert("Only .jpg / .gif / .png formats allowed.");document.getElementById("offerLogo").value="";document.getElementById("fileInput").innerHTML="<input type='file' name='offerLogo' id='offerLogo' class='input_filebox' onchange='checkUploadFileFormatOfferLogo();' onkeypress='clearFileBoxOfferLogo();'>";}}
function clearFileBoxOfferLogo(){document.getElementById("fileInput").innerHTML="<input type='file' name='offerLogo' id='offerLogo' class='input_filebox' onchange='checkUploadFileFormatOfferLogo();' onkeypress='clearFileBoxOfferLogo();'>";}
function makeAjaxRequest(actionForwardName,cmdMethodName,parameterString,returnMethod){var urlRoot=actionForwardName;var pars=parameterString+"&cmd="+cmdMethodName;var url=window.location.protocol+"//"+window.location.host+"/"+
urlRoot+"?"+pars;http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.open('GET',url,true);http_request.send(null);}
function ajaxReturnMethod(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;}
else{}}}
function updateCounter(methodName,searchType,adSection,contextPath){if(searchType==""){searchType="BLANK";}
var actionNameWithContextPath=contextPath+'property.do';var parameterString="methodName="+methodName+"&adSection="+adSection+"&searchType="+searchType+"&remoteIpAddress="+remoteIpAddress;makeAjaxRequest(actionNameWithContextPath,'doAjaxUpdateCounter',parameterString,'ajaxReturnMethod');}
function updatePropetyAnalyics(contextPath,propertyid,type){var url=contextPath+'/common/callAjax.do';$.post(url,{cmd:'updatePropetyAnalyics',pid:propertyid,type:type},function(data){if(data=='success'){}else{//alert('Error in processing request');}});}
function updateAgentAnalytics(contextPath,agentid,type){var url=contextPath+'/common/callAjax.do';$.post(url,{cmd:'updateAgentAnalyics',aid:agentid,type:type},function(data){if(data=='success'){}else{//alert('Error in processing request');}});}
function updateAgencyAnalytics(contextPath,agentid,type){var url=contextPath+'/common/callAjax.do';$.post(url,{cmd:'updateAgencyAnalyics',aid:agentid,type:type},function(data){if(data=='success'){}else{//alert('Error in processing request');}});}
function checkEmail(email){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){return true;}
return false;}
function popUpwindox(value){if(value.indexOf('http//')=='-1'){value='http://'+value;}
var wnd=window.open('about:blank','_blank','width=800,height=600,status=no,menubar=no,resizable=yes,scrollbars=yes');wnd.location.replace(value.replace('http://http://','http://'));}
function checkUploadFilePdf(actionName){var logoVal=document.getElementById("pdfFile").value;var strLen=logoVal.length;var strIndex=strLen-3;var newStr=logoVal.substring(strIndex).toLowerCase();if(!(newStr=="pdf")){alert("Only .pdf format allowed.");document.getElementById("pdfFile").value="";document.getElementById("fileInput").innerHTML="<input type='file' id='pdfFile' name='pdfFile'  onchange=\"javascript:checkUploadFilePdf(\'doUploadPdf\');\" onkeypress='javascript:clearPdfFileBox();'>";}else{document.forms[0].cmd.value=actionName;document.forms[0].submit();}}
function clearPdfFileBox(){document.getElementById("fileInput").innerHTML="<input type='file' id='pdfFile' name='pdfFile'  onchange=\"javascript:checkUploadFilePdf(\'doUploadPdf\');\" onkeypress='javascript:clearPdfFileBox();'>";}
function isValidFloat(value){return/^((\d+(\.\d*)?)|((\d*\.)?\d+))$/.test(value);}
function isAlphaNumeric(value){if(/^[a-zA-Z]+$/.test(value)){return false;}
if(/^\d+$/.test(value)){return false;}
return true;}
function isValidInteger(value){return/^\d+$/.test(value);}
function callUrlAjax(url){var wnd=window.open('${root}/admin/analytics/doExportCSVAgentAnalytics/t=${param.t}/name=${param.name}');wnd.close();}
