var modalLoader=new Array();
modalLoader.modal={open:function(modalname,location,width,callback){if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modal.open(modalname,location,width,callback);
$.ajaxSetup({cache:false})
})
}else{modal.open(modalname,location,width,callback)
}},youtube:function(youtubeId){if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modal.youtube(youtubeId);
$.ajaxSetup({cache:false})
})
}else{modal.youtube(youtubeId)
}}};
modalLoader.modalContact={argumentsArray:new Array(),open:function(){delete modalLoader.modalContact.argumentsArray;
modalLoader.modalContact.argumentsArray=new Array();
modalLoader.modalContact.argumentsArray=arguments;
if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modalLoader.modalContact.loadmodalContact();
$.ajaxSetup({cache:false})
})
}else{modalLoader.modalContact.loadmodalContact()
}},loadmodalContact:function(){if(typeof(modalContact)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalContact.js",function(){modalContact.open.apply(this,modalLoader.modalContact.argumentsArray);
$.ajaxSetup({cache:false})
})
}else{modalContact.open.apply(this,modalLoader.modalContact.argumentsArray)
}}};
modalLoader.modalCareer={argumentsArray:new Array(),open:function(){delete modalLoader.modalCareer.argumentsArray;
modalLoader.modalCareer.argumentsArray=new Array();
modalLoader.modalCareer.argumentsArray=arguments;
if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modalLoader.modalCareer.loadmodalCareer();
$.ajaxSetup({cache:false})
})
}else{modalLoader.modalCareer.loadmodalCareer()
}},loadmodalCareer:function(){if(typeof(modalCareer)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalCareer.js",function(){modalCareer.open.apply(this,modalLoader.modalCareer.argumentsArray);
$.ajaxSetup({cache:false})
})
}else{modalCareer.open.apply(this,modalLoader.modalCareer.argumentsArray)
}}};
modalLoader.modalFranchising={argumentsArray:new Array(),open:function(){delete modalLoader.modalFranchising.argumentsArray;
modalLoader.modalFranchising.argumentsArray=new Array();
modalLoader.modalFranchising.argumentsArray=arguments;
if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modalLoader.modalFranchising.loadmodalFranchising();
$.ajaxSetup({cache:false})
})
}else{modalLoader.modalFranchising.loadmodalFranchising()
}},loadmodalFranchising:function(){if(typeof(modalFranchising)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalFranchising.js",function(){modalFranchising.open.apply(this,modalLoader.modalFranchising.argumentsArray);
$.ajaxSetup({cache:false})
})
}else{modalFranchising.open.apply(this,modalLoader.modalFranchising.argumentsArray)
}},close:function(id,type){shade.hide();
$(window).bind("resize",function(){shade.setsize($(window).width(),$("body").height())
});
$("#modal"+type+id).fadeOut(1000)
}};
modalLoader.modalSuccessfulMessage={argumentsArray:new Array(),open:function(){delete modalLoader.modalSuccessfulMessage.argumentsArray;
modalLoader.modalSuccessfulMessage.argumentsArray=new Array();
modalLoader.modalSuccessfulMessage.argumentsArray=arguments;
if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){modalLoader.modalSuccessfulMessage.loadmodalSuccessfulMessage();
$.ajaxSetup({cache:false})
})
}else{modalLoader.modalSuccessfulMessage.loadmodalSuccessfulMessage()
}},loadmodalSuccessfulMessage:function(){if(typeof(modalSuccessfulMessage)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalSuccessfulMessage.js",function(){modalSuccessfulMessage.open.apply(this,modalLoader.modalSuccessfulMessage.argumentsArray);
$.ajaxSetup({cache:false})
})
}else{modalSuccessfulMessage.open.apply(this,modalLoader.modalSuccessfulMessage.argumentsArray)
}},close:function(id,type){shade.hide();
$(window).bind("resize",function(){shade.setsize($(window).width(),$("body").height())
});
$("#modal"+type+id).fadeOut(1000)
}};
modalLoader.listings={getContent:function(listingsType,target,type,id,ascending,pageNumber,pageSize,countryId,sortField,callback){if(typeof(listings)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/listings.js",function(xhr){try{listings.getContent(listingsType,target,type,id,ascending,pageNumber,pageSize,countryId,sortField,callback)
}catch(err){eval(xhr);
listings.getContent(listingsType,target,type,id,ascending,pageNumber,pageSize,countryId,sortField,callback)
}$.ajaxSetup({cache:false})
})
}else{try{listings.getContent(listingsType,target,type,id,ascending,pageNumber,pageSize,countryId,sortField,callback)
}catch(err){listings.getContent(listingsType,target,type,id,ascending,pageNumber,pageSize,countryId,sortField,callback)
}}}};
modalLoader.modalDetail={argumentsArray:new Array(),open:function(){delete modalLoader.modalDetail.argumentsArray;
modalLoader.modalDetail.argumentsArray=new Array();
modalLoader.modalDetail.argumentsArray=arguments;
if(typeof(modalDetail)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalDetail.js",function(){modalLoader.modalDetail.loadHandler();
$.ajaxSetup({cache:false})
})
}else{modalLoader.modalDetail.loadHandler()
}},loadHandler:function(){var type=modalLoader.modalDetail.argumentsArray[1];
if(modalDetail.templateHandlers[type]==undefined){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalDetail.handlers."+type+".js",function(){modalDetail.open.apply(this,modalLoader.modalDetail.argumentsArray);
$.ajaxSetup({cache:false})
})
}else{modalDetail.open.apply(this,modalLoader.modalDetail.argumentsArray)
}}};
modalLoader.mortgage={openAffordability:function(){modalLoader.mortgage.load(function(){MortgageModals.openAffordability()
})
},openMonthlyPayments:function(){modalLoader.mortgage.load(function(){MortgageModals.openMonthlyPayments()
})
},openRefinance:function(){modalLoader.mortgage.load(function(){MortgageModals.openRefinance()
})
},areRentVsBuyDepsLoaded:false,openRentVsBuy:function(){if(modalLoader.mortgage.areRentVsBuyDepsLoaded){modalLoader.mortgage.load(function(){MortgageModals.openRentVsBuy()
})
}else{$.getScript("/js/global/modal/rentVsBuy/getMonthlyPayments.js",function(){$.getScript("/js/global/modal/rentVsBuy/PMICalculator.js",function(){$.getScript("/js/global/modal/rentVsBuy/AmortScheduleCalculator.js",function(){$.getScript("/js/global/modal/rentVsBuy/EstimatedClosingCosts.js",function(){$.getScript("/js/global/modal/rentVsBuy/RentVsBuyCalculator.js",function(){modalLoader.mortgage.areRentVsBuyDepsLoaded=true;
modalLoader.mortgage.load(function(){MortgageModals.openRentVsBuy()
})
})
})
})
})
})
}},load:function(callback){var loadModalMortgageJs=function(){if(typeof(MortgageModals)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modalMortgage.js",function(){callback();
$.ajaxSetup({cache:false})
})
}else{callback()
}};
if(typeof(modal)=="undefined"){$.ajaxSetup({cache:true});
$.getScript("/js/global/modal/modal.js",function(){loadModalMortgageJs();
$.ajaxSetup({cache:false})
})
}else{loadModalMortgageJs()
}}};
