var SinglePropertyWebsites={Conf:{emailServicesUrl:"https://www.homefinder.com/emailServices/",activityServicesUrl:"http://www.homefinder.com/activityServices/",activityLogServicesUrl:"http://activitylogservices.homefinder.com/",userAgent:"Mozilla%2F4.0+%28compatible%3B+MSIE+5.5%3B+Windows+NT+4.0%3B+Proactivenet%29",userIpAddress:"172.20.193.228",videoApplicationId:"4ec4220be752e80e8febe079",singlePropertyWebsiteApplicationId:"4ec5072c3876113ef2a9a159"}};jQuery.toJSONString=function(val){try{if(val!==undefined&&val.constructor===Object){var sval='{ "_":""';jQuery.each(val,function(i,n){sval+=', "'+i+'": ';if(n!==undefined){if(n.constructor===Object){sval+=jQuery.toJSONString(n);}else if(n.constructor===Boolean){sval+=n?'true':'false';}else{if(n.constructor===Number){sval+=n;}else if(n.constructor===String){if(n===''){sval+='""';}else if(n=='true'||n=='false'){sval+=n;}else if(!isNaN(Number(n))&&!/0\d+/.test(n)){sval+=n;}else{sval+='"'+n+'"';}}}}else{sval+='undefined';}});sval+='}';val=sval;}
if(val!==undefined&&val.constructor===String){val=val.replace(/"_":"",/g,'');}}catch(e){}
return val;};(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}
var validator=$.data(this[0],'validator');if(validator){return validator;}
validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}
this.submit(function(event){if(validator.settings.debug)
event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}
validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}
return false;}
return true;}
if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}
if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}
return handle();}else{validator.focusInvalid();return false;}});}
return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)
settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}
var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}
var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}
return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)
return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}
if(params.constructor!=Array){params=[params];}
$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)
this.element(element);else if(element.parentNode.name in this.submitted)
this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"Required",remote:"Please fix this field.",email:"Invalid E-mail",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}."),defaultInvalid:"Please enter a value."},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}
$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)
$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())
$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}
return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}
if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}
this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}
this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}
this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)
$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)
count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))
return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}
var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}
dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}
if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}
if(dependencyMismatch)
return;if(this.objectLength(rules))
this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)
return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)
return arguments[i];}
return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}
this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)
toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}
if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}
if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}
if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}
this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}
if(!this.labelContainer.append(label).length)
this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}
if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}
this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))
return this.findByName(element.name).filter(':checked').length;}
return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)
this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}
if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}
return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}
return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}
if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}
if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}
if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}
if(rules.messages){delete rules.messages;}
return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}
return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))
return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))
return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))
return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])
this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}
previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}
return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))
return"dependency-mismatch";if(/[^0-9-]+/.test(value))
return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)
nDigit-=9;}
nCheck+=nDigit;bEven=!bEven;}
return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}
return(pendingRequests[port]=ajax.apply(this,arguments));}
return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);if(typeof(SinglePropertyWebsites.AdvertiserLeadController)==="undefined"){SinglePropertyWebsites.AdvertiserLeadController=function(){var _this=this;_this.sendAdvertiserLeadEmail=function(event){try{if(typeof(event.id)===""){throw"listing Id cannot be empty";}else if(typeof(event.firstName)!=="string"){throw"First name must be a string";}else if(typeof(event.lastName)!=="string"){throw"Last name must be a string";}else if(typeof(event.fromEmail)!=="string"){throw"From e-mail must be a string";}else if(typeof(event.comment)!=="string"){throw"Comment must be a string";}
var url=SinglePropertyWebsites.Conf.emailServicesUrl+"productLead";jQuery.ajax({dataType:"jsonp",url:url,data:{id:jQuery.toJSONString(event.id),firstName:jQuery.toJSONString(event.firstName),lastName:jQuery.toJSONString(event.lastName),fromEmailAddress:jQuery.toJSONString(event.fromEmail),comment:jQuery.toJSONString(event.comment),_logActivity:'true'},success:function(response){if(typeof(response.status.code)!=="undefined"&&response.status.code==200){var sendAdvertiserLeadEmailSuccessEvent=new jQuery.Event("sendAdvertiserLeadEmailSuccess");sendAdvertiserLeadEmailSuccessEvent.message="Your request has been sent, and you should be contacted shortly.";jQuery(event.target).trigger(sendAdvertiserLeadEmailSuccessEvent);}else{var message="A system error has occurred. Please contact support@homefinder.com if issue continues.";var code=503;if(typeof(response.message)!=="undefined"){message=response.message;}
if(typeof(response.status.code)!=="undefined"){code=response.status.code;}
var sendAdvertiserLeadEmailErrorEvent=new jQuery.Event("sendAdvertiserLeadEmailError");sendAdvertiserLeadEmailErrorEvent.message=message;sendAdvertiserLeadEmailErrorEvent.code=code;jQuery(event.target).trigger(sendAdvertiserLeadEmailErrorEvent);}}});}catch(message){var sendAdvertiserLeadEmailErrorEvent=new jQuery.Event("sendAdvertiserLeadEmailError");sendAdvertiserLeadEmailErrorEvent.message=message;sendAdvertiserLeadEmailErrorEvent.code=600;jQuery(event.target).trigger(sendAdvertiserLeadEmailErrorEvent);}};};}
if(typeof(SinglePropertyWebsites.GoogleController)==="undefined"){SinglePropertyWebsites.GoogleController=function(){var _this=this;_this.pinPointPath='/images/map/orangePinpoint.png';_this.setPinPointPath=function(pinPointPath){_this.pinPointPath=pinPointPath;};_this.setupGoogleMaps=function(poiArray){locations=poiArray;if(!locations.length||typeof(google)==="undefined"){return;}
var latlng=new google.maps.LatLng(locations[0].lat,locations[0].lng);var zoom;if(locations.length===1){zoom=15;}else{zoom=12;}
var myOptions={zoom:zoom,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};var map=new google.maps.Map(document.getElementById("mapCanvas"),myOptions);var marker,i;for(i=0;i<locations.length;i++){if(i===0){marker=new google.maps.Marker({position:new google.maps.LatLng(locations[i].lat,locations[i].lng),title:locations[i].name,icon:_this.pinPointPath,map:map,clickable:false});}else{marker=new google.maps.Marker({position:new google.maps.LatLng(locations[i].lat,locations[i].lng),title:locations[i].name,icon:'/images/map/school.png',map:map,clickable:false});}}};_this.callGoogleAnalytics=function(){var gaJsHost=(("https:"===document.location.protocol)?"https://ssl.":"http://www.");var pageTracker=[];jQuery.ajax({url:gaJsHost+"google-analytics.com/ga.js",dataType:"script",cache:true,success:function(){try{pageTracker=_gat._getTracker('UA-7013087-19');pageTracker._trackPageview();}catch(err){}}});};};}if(typeof(SinglePropertyWebsites.HomeController)==="undefined"){SinglePropertyWebsites.HomeController=function(){var _this=this;jQuery.validator.addMethod("defaultInvalid",function(value,element){if(element.value==element.defaultValue){return false;}else{return true;}});_this.validateLeadForm=function(){jQuery('#leadForm').validate({rules:{comment:{required:true},firstName:{required:true,defaultInvalid:true},lastName:{required:true,defaultInvalid:true},fromEmail:{required:true,defaultInvalid:true,email:true}},messages:{comment:{required:"Please Enter Comment"},firstName:{required:"Please Enter First Name",defaultInvalid:"Please Enter First Name"},lastName:{required:"Please Enter Last Name",defaultInvalid:"Please Enter Last Name"},fromEmail:{required:"Please Enter E-mail",defaultInvalid:"Please Enter E-mail",email:"Please Enter E-mail"}},errorElement:"label",errorContainer:jQuery('#leadForm .errorMessages'),errorPlacement:function(error,element){jQuery('#leadForm .errorMessages').append(error);jQuery('#leadFormErrorMessage').show();element.parent().addClass('error');},onfocusout:function(element){element.value=element.value.replace(/^\s+|\s+$/g,"");if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}
var visibleFlag=false;jQuery('#leadForm .errorMessages .error').each(function(index,element){if(jQuery(element).css("display")==="block"){visibleFlag=true;}});if(visibleFlag===false){jQuery('#leadFormErrorMessage').hide();}else{jQuery('#leadFormErrorMessage').show();}}});};_this.sendAdvertiserLeadEmail=function(){if(jQuery('#leadForm .sendEmailButton').attr('disabled')===true){return false;}
jQuery("#leadFormErrorMessage").hide();jQuery("p",this).removeClass("error");var sendAdvertiserLeadEmailEvent=new jQuery.Event("advertiserLeadEmailSubmit");sendAdvertiserLeadEmailEvent.id=jQuery("input[name=id]",this).val();sendAdvertiserLeadEmailEvent.firstName=jQuery("input[name=firstName]",this).val();sendAdvertiserLeadEmailEvent.lastName=jQuery("input[name=lastName]",this).val();sendAdvertiserLeadEmailEvent.fromEmail=jQuery("input[name=fromEmail]",this).val();sendAdvertiserLeadEmailEvent.comment=jQuery("textarea[name=comment]",this).val();jQuery(this).trigger(sendAdvertiserLeadEmailEvent);return false;};_this.sendAdvertiserLeadEmailSuccessHandler=function(event){jQuery(event.target).slideUp(function(){jQuery("#leadFormSuccessMessage .successMessage").text(event.message);jQuery("#leadFormSuccessMessage").show();});};_this.sendAdvertiserLeadEmailErrorHandler=function(event){if(jQuery('#leadForm .sendEmailButton').attr('disabled')===true){return false;}
jQuery("#leadFormErrorMessage .errorMessages").text(event.message);jQuery("#leadFormErrorMessage").show();var errorField=null;if(event.code==601){errorField=jQuery("input[name=firstName]",event.target);}else if(event.code==602){errorField=jQuery("input[name=lastName]",event.target);}else if(event.code==603){errorField=jQuery("input[name=fromEmail]",event.target);}else if(event.code==605){errorField=jQuery("textarea[name=comment]",event.target);}
if(errorField!==null){errorField.parents("p").addClass("error");}};SinglePropertyWebsites.utilityController.blankOrRestoreFieldLabel(jQuery('#leadForm input[name=firstName]'),'First Name - Required');SinglePropertyWebsites.utilityController.blankOrRestoreFieldLabel(jQuery('#leadForm input[name=lastName]'),'Last Name - Required');SinglePropertyWebsites.utilityController.blankOrRestoreFieldLabel(jQuery('#leadForm input[name=fromEmail]'),'Email - Required');}}
if(typeof(ActivityServicesClient)==="undefined"){ActivityServicesClient=function(activityServicesUrl){var _this=this;_this.activityServicesUrl=activityServicesUrl;_this.logProductEmailLead=function(parameters,successfulCallback,erroredCallback){successfulCallback=(typeof(successfulCallback)==="function")?successfulCallback:function(){};erroredCallback=(typeof(erroredCallback)==="function")?erroredCallback:function(){};var url=_this.activityServicesUrl+"logProductEmailLead";_this.callService(url,parameters,successfulCallback,erroredCallback);};_this.logExternalWebsiteLead=function(parameters,successfulCallback,erroredCallback){successfulCallback=(typeof(successfulCallback)==="function")?successfulCallback:function(){};erroredCallback=(typeof(erroredCallback)==="function")?erroredCallback:function(){};var url=_this.activityServicesUrl+"logExternalWebsiteLead";_this.callService(url,parameters,successfulCallback,erroredCallback);};_this.callService=function(url,data,successfulCallback,erroredCallback){jQuery.ajax({dataType:'jsonp',url:url,data:data,success:function(response){if(response.status.code===200){successfulCallback(response);}else{erroredCallback();}},error:function(){erroredCallback();}});};};}
(function($){var undef,window=this,doc=document,$doc=$(doc);var DEBUG=false,NAV=navigator.userAgent.toLowerCase(),HASH=window.location.hash.replace(/#\//,''),CLICK=function(){return Galleria.TOUCH?'touchstart':'click';},IE=(function(){var v=3,div=doc.createElement('div');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',div.getElementsByTagName('i')[0]);return v>4?v:undef;}()),DOM=function(){return{html:doc.documentElement,body:doc.body,head:doc.getElementsByTagName('head')[0],title:doc.title};},_timeouts={trunk:{},add:function(id,fn,delay,loop){loop=loop||false;this.clear(id);if(loop){var old=fn;fn=function(){old();_timeouts.add(id,fn,delay);};}
this.trunk[id]=window.setTimeout(fn,delay);},clear:function(id){var del=function(i){window.clearTimeout(this.trunk[i]);delete this.trunk[i];};if(!!id&&id in this.trunk){del.call(_timeouts,id);}else if(typeof id=='undefined'){for(var i in this.trunk){del.call(_timeouts,i);}}}},_galleries=[],_transitions={fade:function(params,complete){$(params.next).css('opacity',0).show().animate({opacity:1},params.speed,complete);if(params.prev){$(params.prev).css('opacity',1).show().animate({opacity:0},params.speed);}},flash:function(params,complete){$(params.next).css('opacity',0);if(params.prev){$(params.prev).animate({opacity:0},(params.speed/2),function(){$(params.next).animate({opacity:1},params.speed,complete);});}else{$(params.next).animate({opacity:1},params.speed,complete);}},pulse:function(params,complete){if(params.prev){$(params.prev).hide();}
$(params.next).css('opacity',0).animate({opacity:1},params.speed,complete);},slide:function(params,complete){var image=$(params.next).parent(),images=this.$('images'),width=this._stageWidth,easing=this.getOptions('easing');image.css({left:width*(params.rewind?-1:1)});images.animate({left:width*(params.rewind?1:-1)},{duration:params.speed,queue:false,easing:easing,complete:function(){images.css('left',0);image.css('left',0);complete();}});},fadeslide:function(params,complete){var x=0,easing=this.getOptions('easing'),distance=this.getStageWidth();if(params.prev){x=Utils.parseValue($(params.prev).css('left'));$(params.prev).css({opacity:1,left:x}).animate({opacity:0,left:x+(distance*(params.rewind?1:-1))},{duration:params.speed,queue:false,easing:easing});}
x=Utils.parseValue($(params.next).css('left'));$(params.next).css({left:x+(distance*(params.rewind?-1:1)),opacity:0}).animate({opacity:1,left:x},{duration:params.speed,complete:complete,queue:false,easing:easing});}},Utils=(function(){return{array:function(obj){return Array.prototype.slice.call(obj);},create:function(className,nodeName){nodeName=nodeName||'div';var elem=doc.createElement(nodeName);elem.className=className;return elem;},forceStyles:function(elem,styles){elem=$(elem);if(elem.attr('style')){elem.data('styles',elem.attr('style')).removeAttr('style');}
elem.css(styles);},revertStyles:function(){$.each(Utils.array(arguments),function(i,elem){elem=$(elem).removeAttr('style');if(elem.data('styles')){elem.attr('style',elem.data('styles')).data('styles',null);}});},moveOut:function(elem){Utils.forceStyles(elem,{position:'absolute',left:-10000});},moveIn:function(){Utils.revertStyles.apply(Utils,Utils.array(arguments));},hide:function(elem,speed,callback){elem=$(elem);if(!elem.data('opacity')){elem.data('opacity',elem.css('opacity'));}
var style={opacity:0};if(speed){elem.stop().animate(style,speed,callback);}else{elem.css(style);};},show:function(elem,speed,callback){elem=$(elem);var saved=parseFloat(elem.data('opacity'))||1,style={opacity:saved};if(saved==1){elem.data('opacity',null);}
if(speed){elem.stop().animate(style,speed,callback);}else{elem.css(style);};},addTimer:function(){_timeouts.add.apply(_timeouts,Utils.array(arguments));return this;},clearTimer:function(){_timeouts.clear.apply(_timeouts,Utils.array(arguments));return this;},wait:function(options){options=$.extend({until:function(){return false;},success:function(){},error:function(){Galleria.raise('Could not complete wait function.');},timeout:3000},options);var start=Utils.timestamp(),elapsed,now;window.setTimeout(function(){now=Utils.timestamp();elapsed=now-start;if(options.until(elapsed)){options.success();return false;}
if(now>=start+options.timeout){options.error();return false;}
window.setTimeout(arguments.callee,2);},2);},toggleQuality:function(img,force){if(!(IE==7||IE==8)||!!img===false){return;}
if(typeof force==='undefined'){force=img.style.msInterpolationMode=='nearest-neighbor';}
img.style.msInterpolationMode=force?'bicubic':'nearest-neighbor';},insertStyleTag:function(styles){var style=doc.createElement('style');DOM().head.appendChild(style);if(style.styleSheet){style.styleSheet.cssText=styles;}else{var cssText=doc.createTextNode(styles);style.appendChild(cssText);}},loadScript:function(url,callback){var done=false,script=$('<scr'+'ipt>').attr({src:url,async:true}).get(0);script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;if(typeof callback=='function'){callback.call(this,this);}
script.onload=script.onreadystatechange=null;}};var s=doc.getElementsByTagName('script')[0];s.parentNode.insertBefore(script,s);},parseValue:function(val){if(typeof val=='number'){return val;}else if(typeof val=='string'){var arr=val.match(/\-?\d/g);return arr&&arr.constructor==Array?arr.join('')*1:0;}else{return 0;}},timestamp:function(){return new Date().getTime();},loadCSS:function(href,id,callback){var link,ready=false,length;$('link[rel=stylesheet]').each(function(){if(new RegExp(href).test(this.href)){link=this;return false;}});if(typeof id=='function'){callback=id;id=undef;}
callback=callback||function(){};if(link){callback.call(link,link);return link;}
length=doc.styleSheets.length;if(DEBUG){href+='?'+Utils.timestamp();}
if($('#'+id).length){$('#'+id).attr('href',href);length--;ready=true;}else{link=$('<link>').attr({rel:'stylesheet',href:href,id:id}).get(0);window.setTimeout(function(){var styles=$('link[rel="stylesheet"], style');if(styles.length){styles.get(0).parentNode.insertBefore(link,styles[0]);}else{DOM().head.appendChild(link);}
if(IE){link.attachEvent('onreadystatechange',function(e){if(link.readyState=='complete'){ready=true;}});}else{ready=true;}},10);}
if(typeof callback=='function'){Utils.wait({until:function(){return ready&&doc.styleSheets.length>length;},success:function(){Utils.addTimer('css',function(){callback.call(link,link);},100);},error:function(){Galleria.raise('Theme CSS could not load');},timeout:1000});}
return link;}};})();Galleria=function(){var self=this;this._theme=undef;this._options={};this._playing=false;this._playtime=5000;this._active=null;this._queue={length:0};this._data=[];this._dom={};this._thumbnails=[];this._initialized=false;this._stageWidth=0;this._stageHeight=0;this._target=undef;this._id=Utils.timestamp();var divs='container stage images image-nav image-nav-left image-nav-right '+'info info-text info-title info-description info-author '+'thumbnails thumbnails-list thumbnails-container thumb-nav-left thumb-nav-right '+'loader counter tooltip',spans='current total';$.each(divs.split(' '),function(i,elemId){self._dom[elemId]=Utils.create('galleria-'+elemId);});$.each(spans.split(' '),function(i,elemId){self._dom[elemId]=Utils.create('galleria-'+elemId,'span');});var keyboard=this._keyboard={keys:{'UP':38,'DOWN':40,'LEFT':37,'RIGHT':39,'RETURN':13,'ESCAPE':27,'BACKSPACE':8,'SPACE':32},map:{},bound:false,press:function(e){var key=e.keyCode||e.which;if(key in keyboard.map&&typeof keyboard.map[key]=='function'){keyboard.map[key].call(self,e);}},attach:function(map){for(var key in map){var up=key.toUpperCase();if(up in keyboard.keys){keyboard.map[keyboard.keys[up]]=map[key];}}
if(!keyboard.bound){keyboard.bound=true;$doc.bind('keydown',keyboard.press);}},detach:function(){keyboard.bound=false;$doc.unbind('keydown',keyboard.press);}};var controls=this._controls={0:undef,1:undef,active:0,swap:function(){controls.active=controls.active?0:1;},getActive:function(){return controls[controls.active];},getNext:function(){return controls[1-controls.active];}};var carousel=this._carousel={next:self.$('thumb-nav-right'),prev:self.$('thumb-nav-left'),width:0,current:0,max:0,hooks:[],update:function(){var w=0,h=0,hooks=[0];$.each(self._thumbnails,function(i,thumb){if(thumb.ready){w+=thumb.outerWidth||$(thumb.container).outerWidth(true);hooks[i+1]=w;h=Math.max(h,thumb.outerHeight||$(thumb.container).outerHeight(true));}});self.$('thumbnails').css({width:w,height:h});carousel.max=w;carousel.hooks=hooks;carousel.width=self.$('thumbnails-list').width();carousel.setClasses();self.$('thumbnails-container').toggleClass('galleria-carousel',w>carousel.width);},bindControls:function(){carousel.next.bind(CLICK(),function(e){e.preventDefault();if(self._options.carousel_steps=='auto'){for(var i=carousel.current;i<carousel.hooks.length;i++){if(carousel.hooks[i]-carousel.hooks[carousel.current]>carousel.width){carousel.set(i-2);break;}}}else{carousel.set(carousel.current+self._options.carousel_steps);}});carousel.prev.bind(CLICK(),function(e){e.preventDefault();if(self._options.carousel_steps=='auto'){for(var i=carousel.current;i>=0;i--){if(carousel.hooks[carousel.current]-carousel.hooks[i]>carousel.width){carousel.set(i+2);break;}else if(i==0){carousel.set(0);break;}}}else{carousel.set(carousel.current-self._options.carousel_steps);}});},set:function(i){i=Math.max(i,0);while(carousel.hooks[i-1]+carousel.width>carousel.max&&i>=0){i--;}
carousel.current=i;carousel.animate();},getLast:function(i){return(i||carousel.current)-1;},follow:function(i){if(i==0||i==carousel.hooks.length-2){carousel.set(i);return;}
var last=carousel.current;while(carousel.hooks[last]-carousel.hooks[carousel.current]<carousel.width&&last<=carousel.hooks.length){last++;}
if(i-1<carousel.current){carousel.set(i-1);}else if(i+2>last){carousel.set(i-last+carousel.current+2);}},setClasses:function(){carousel.prev.toggleClass('disabled',!carousel.current);carousel.next.toggleClass('disabled',carousel.hooks[carousel.current]+carousel.width>carousel.max);},animate:function(to){carousel.setClasses();var num=carousel.hooks[carousel.current]*-1;if(isNaN(num)){return;}
self.$('thumbnails').animate({left:num},{duration:self._options.carousel_speed,easing:self._options.easing,queue:false});}};var tooltip=this._tooltip={initialized:false,open:false,init:function(){tooltip.initialized=true;var css='.galleria-tooltip{padding:3px 8px;max-width:50%;background:#ffe;color:#000;z-index:3;position:absolute;font-size:11px;line-height:1.3'+'opacity:0;box-shadow:0 0 2px rgba(0,0,0,.4);-moz-box-shadow:0 0 2px rgba(0,0,0,.4);-webkit-box-shadow:0 0 2px rgba(0,0,0,.4);}';Utils.insertStyleTag(css);self.$('tooltip').css('opacity',.8);Utils.hide(self.get('tooltip'));},move:function(e){var mouseX=self.getMousePosition(e).x,mouseY=self.getMousePosition(e).y,$elem=self.$('tooltip'),x=mouseX,y=mouseY,height=$elem.outerHeight(true)+1,width=$elem.outerWidth(true),limitY=height+15;var maxX=self.$('container').width()-width-2,maxY=self.$('container').height()-height-2;if(!isNaN(x)&&!isNaN(y)){x+=10;y-=30;x=Math.max(0,Math.min(maxX,x));y=Math.max(0,Math.min(maxY,y));if(mouseY<limitY){y=limitY;}
$elem.css({left:x,top:y});}},bind:function(elem,value){if(!tooltip.initialized){tooltip.init();}
var hover=function(elem,value){tooltip.define(elem,value);$(elem).hover(function(){Utils.clearTimer('switch_tooltip');self.$('container').unbind('mousemove',tooltip.move).bind('mousemove',tooltip.move).trigger('mousemove');tooltip.show(elem);Galleria.utils.addTimer('tooltip',function(){self.$('tooltip').stop();Utils.show(self.get('tooltip'),400);tooltip.open=true;},tooltip.open?0:1000);},function(){self.$('container').unbind('mousemove',tooltip.move);Utils.clearTimer('tooltip');self.$('tooltip').stop();Utils.hide(self.get('tooltip'),200,function(){Utils.addTimer('switch_tooltip',function(){tooltip.open=false;},1000);});});};if(typeof value=='string'){hover((elem in self._dom?self.get(elem):elem),value);}else{$.each(elem,function(elemID,val){hover(self.get(elemID),val);});}},show:function(elem){elem=$(elem in self._dom?self.get(elem):elem);var text=elem.data('tt');if(!text){return;}
text=typeof text=='function'?text():text;self.$('tooltip').html(text.replace(/\s/,'&nbsp;'));elem.bind('mouseup',function(e){window.setTimeout((function(ev){return function(){tooltip.move(ev);}})(e),10);elem.unbind('mouseup',arguments.callee);});},define:function(elem,value){if(typeof value!=='function'){var s=value;value=function(){return s;};}
elem=$(elem in self._dom?self.get(elem):elem).data('tt',value);tooltip.show(elem);}};var fullscreen=this._fullscreen={scrolled:0,enter:function(callback){Utils.hide(self.getActiveImage());self.$('container').addClass('fullscreen');fullscreen.scrolled=$(window).scrollTop();Utils.forceStyles(self.get('container'),{position:'fixed',top:0,left:0,width:'100%',height:'100%',zIndex:10000});var htmlbody={height:'100%',overflow:'hidden',margin:0,padding:0};Utils.forceStyles(DOM().html,htmlbody);Utils.forceStyles(DOM().body,htmlbody);self.attachKeyboard({escape:self.exitFullscreen,right:self.next,left:self.prev});self.rescale(function(){Utils.addTimer('fullscreen_enter',function(){Utils.show(self.getActiveImage());if(typeof callback=='function'){callback.call(self);}},100);self.trigger(Galleria.FULLSCREEN_ENTER);});$(window).resize(function(){fullscreen.scale();});},scale:function(){self.rescale();},exit:function(callback){Utils.hide(self.getActiveImage());self.$('container').removeClass('fullscreen');Utils.revertStyles(self.get('container'),DOM().html,DOM().body);window.scrollTo(0,fullscreen.scrolled);self.detachKeyboard();self.rescale(function(){Utils.addTimer('fullscreen_exit',function(){Utils.show(self.getActiveImage());if(typeof callback=='function'){callback.call(self);}},50);self.trigger(Galleria.FULLSCREEN_EXIT);});$(window).unbind('resize',fullscreen.scale);}};var idle=this._idle={trunk:[],bound:false,add:function(elem,to){if(!elem){return;}
if(!idle.bound){idle.addEvent();}
elem=$(elem);var from={};for(var style in to){from[style]=elem.css(style);}
elem.data('idle',{from:from,to:to,complete:true,busy:false});idle.addTimer();idle.trunk.push(elem);},remove:function(elem){elem=jQuery(elem);$.each(idle.trunk,function(i,el){if(el.length&&!el.not(elem).length){self._idle.show(elem);self._idle.trunk.splice(i,1);}});if(!idle.trunk.length){idle.removeEvent();Utils.clearTimer('idle');}},addEvent:function(){idle.bound=true;self.$('container').bind('mousemove click',idle.showAll);},removeEvent:function(){idle.bound=false;self.$('container').unbind('mousemove click',idle.showAll);},addTimer:function(){Utils.addTimer('idle',function(){self._idle.hide();},self._options.idle_time);},hide:function(){self.trigger(Galleria.IDLE_ENTER);$.each(idle.trunk,function(i,elem){var data=elem.data('idle');if(!data){return;}
elem.data('idle').complete=false;elem.stop().animate(data.to,{duration:600,queue:false,easing:'swing'});});},showAll:function(){Utils.clearTimer('idle');$.each(self._idle.trunk,function(i,elem){self._idle.show(elem);});},show:function(elem){var data=elem.data('idle');if(!data.busy&&!data.complete){data.busy=true;self.trigger(Galleria.IDLE_EXIT);Utils.clearTimer('idle');elem.stop().animate(data.from,{duration:300,queue:false,easing:'swing',complete:function(){$(this).data('idle').busy=false;$(this).data('idle').complete=true;}});}
idle.addTimer();}};var lightbox=this._lightbox={width:0,height:0,initialized:false,active:null,image:null,elems:{},init:function(){self.trigger(Galleria.LIGHTBOX_OPEN);if(lightbox.initialized){return;}
lightbox.initialized=true;var elems='overlay box content shadow title info close prevholder prev nextholder next counter image',el={},op=self._options,css='',cssMap={overlay:'position:fixed;display:none;opacity:'+op.overlay_opacity+';top:0;left:0;width:100%;height:100%;background:'+op.overlay_background+';z-index:99990',box:'position:fixed;display:none;width:400px;height:400px;top:50%;left:50%;margin-top:-200px;margin-left:-200px;z-index:99991',shadow:'position:absolute;background:#000;width:100%;height:100%;',content:'position:absolute;background-color:#fff;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden',info:'position:absolute;bottom:10px;left:10px;right:10px;color:#444;font:11px/13px arial,sans-serif;height:13px',close:'position:absolute;top:10px;right:10px;height:20px;width:20px;background:#fff;text-align:center;cursor:pointer;color:#444;font:16px/22px arial,sans-serif;z-index:99999',image:'position:absolute;top:10px;left:10px;right:10px;bottom:30px;overflow:hidden',prevholder:'position:absolute;width:50%;height:100%;cursor:pointer',nextholder:'position:absolute;width:50%;height:100%;right:0;cursor:pointer',prev:'position:absolute;top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;left:20px;display:none;line-height:40px;text-align:center;color:#000',next:'position:absolute;top:50%;margin-top:-20px;height:40px;width:30px;background:#fff;right:20px;left:auto;display:none;line-height:40px;text-align:center;color:#000',title:'float:left',counter:'float:right;margin-left:8px'},hover=function(elem){return elem.hover(function(){$(this).css('color','#bbb');},function(){$(this).css('color','#444');});};$.each(cssMap,function(key,value){css+='.galleria-lightbox-'+key+'{'+value+'}';});Utils.insertStyleTag(css);$.each(elems.split(' '),function(i,elemId){self.addElement('lightbox-'+elemId);el[elemId]=lightbox.elems[elemId]=self.get('lightbox-'+elemId);});lightbox.image=new Galleria.Picture();self.append({'lightbox-box':['lightbox-shadow','lightbox-content','lightbox-close','lightbox-prevholder','lightbox-nextholder'],'lightbox-info':['lightbox-title','lightbox-counter'],'lightbox-content':['lightbox-info','lightbox-image'],'lightbox-prevholder':'lightbox-prev','lightbox-nextholder':'lightbox-next'});$(el.image).append(lightbox.image.container);$(DOM().body).append(el.overlay,el.box);hover($(el.close).bind(CLICK(),lightbox.hide).html('&#215;'));$.each(['Prev','Next'],function(i,dir){var $d=$(el[dir.toLowerCase()]).html(/v/.test(dir)?'‹&nbsp;':'&nbsp;›');$(el[dir.toLowerCase()+'holder']).hover(function(){$d.show();},function(){$d.fadeOut(200);}).bind(CLICK(),function(){lightbox['show'+dir]();});});$(el.overlay).bind(CLICK(),lightbox.hide);},rescale:function(event){var width=Math.min($(window).width()-40,lightbox.width),height=Math.min($(window).height()-60,lightbox.height),ratio=Math.min(width/lightbox.width,height/lightbox.height),destWidth=(lightbox.width*ratio)+40,destHeight=(lightbox.height*ratio)+60,to={width:destWidth,height:destHeight,marginTop:Math.ceil(destHeight/2)*-1,marginLeft:Math.ceil(destWidth/2)*-1};if(event){$(lightbox.elems.box).css(to);}else{$(lightbox.elems.box).animate(to,self._options.lightbox_transition_speed,self._options.easing,function(){var image=lightbox.image,speed=self._options.lightbox_fade_speed;self.trigger({type:Galleria.LIGHTBOX_IMAGE,imageTarget:image.image});image.show();Utils.show(image.image,speed);Utils.show(lightbox.elems.info,speed);});}},hide:function(){lightbox.image.image=null;$(window).unbind('resize',lightbox.rescale);$(lightbox.elems.box).hide();Utils.hide(lightbox.elems.info);Utils.hide(lightbox.elems.overlay,200,function(){$(this).hide().css('opacity',self._options.overlay_opacity);self.trigger(Galleria.LIGHTBOX_CLOSE);});},showNext:function(){lightbox.show(self.getNext(lightbox.active));},showPrev:function(){lightbox.show(self.getPrev(lightbox.active));},show:function(index){lightbox.active=index=typeof index=='number'?index:self.getIndex();if(!lightbox.initialized){lightbox.init();}
$(window).unbind('resize',lightbox.rescale);var data=self.getData(index),total=self.getDataLength();Utils.hide(lightbox.elems.info);lightbox.image.load(data.image,function(image){lightbox.width=image.original.width;lightbox.height=image.original.height;$(image.image).css({width:'100.5%',height:'100.5%',top:0,zIndex:99998,opacity:0});lightbox.elems.title.innerHTML=data.title;lightbox.elems.counter.innerHTML=(index+1)+' / '+total;$(window).resize(lightbox.rescale);lightbox.rescale();});$(lightbox.elems.overlay).show();$(lightbox.elems.box).show();}};return this;};Galleria.prototype={constructor:Galleria,init:function(target,options){var self=this;_galleries.push(this);this._original={target:target,options:options,data:null};this._target=this._dom.target=target.nodeName?target:$(target).get(0);if(!this._target){Galleria.raise('Target not found.');return;}
this._options={autoplay:false,carousel:true,carousel_follow:true,carousel_speed:400,carousel_steps:'auto',clicknext:false,data_config:function(elem){return{};},data_selector:'img',data_source:this._target,debug:undef,easing:'galleria',extend:function(options){},height:'auto',idle_time:3000,image_crop:false,image_margin:0,image_pan:false,image_pan_smoothness:12,image_position:'50%',keep_source:false,lightbox_fade_speed:200,lightbox_transition_speed:500,link_source_images:true,max_scale_ratio:undef,min_scale_ratio:undef,on_image:function(img,thumb){},overlay_opacity:.85,overlay_background:'#0b0b0b',pause_on_interaction:true,popup_links:false,preload:2,queue:true,show:0,show_info:true,show_counter:true,show_imagenav:true,thumb_crop:true,thumb_event_type:CLICK(),thumb_fit:true,thumb_margin:0,thumb_quality:'auto',thumbnails:true,transition:'fade',transition_initial:undef,transition_speed:400,width:'auto'};if(options&&options.debug===true){DEBUG=true;}
$(this._target).children().hide();if(Galleria.theme){this._init();}else{Utils.addTimer('themeload',function(){Galleria.raise('No theme found.',true);},2000);$doc.one(Galleria.THEMELOAD,function(){Utils.clearTimer('themeload');self._init.call(self);});}},_init:function(){var self=this;if(this._initialized){Galleria.raise('Init failed: Gallery instance already initialized.');return this;}
this._initialized=true;if(!Galleria.theme){Galleria.raise('Init failed: No theme found.');return this;}
$.extend(true,this._options,Galleria.theme.defaults,this._original.options);this.bind(Galleria.DATA,function(){this._original.data=this._data;this.get('total').innerHTML=this.getDataLength();var $container=this.$('container');var num={width:0,height:0};var testElem=Utils.create('galleria-image');Utils.wait({until:function(){$.each(['width','height'],function(i,m){if(self._options[m]&&typeof self._options[m]=='number'){num[m]=self._options[m];}else{num[m]=Utils.parseValue($container.css(m))||Utils.parseValue(self.$('target').css(m))||$container[m]()||self.$('target')[m]();}});var thumbHeight=function(){return true;};if(self._options.thumbnails){self.$('thumbnails').append(testElem);thumbHeight=function(){return!!$(testElem).height();};}
return thumbHeight()&&num.width&&num.height>50;},success:function(){$(testElem).remove();$container.width(num.width);$container.height(num.height);if(Galleria.WEBKIT){window.setTimeout(function(){self._run();},1);}else{self._run();}},error:function(){Galleria.raise('Width & Height not found.',true);},timeout:2000});});var one=false;this.bind(Galleria.READY,function(){Utils.show(this.get('counter'));if(this._options.clicknext){$.each(this._data,function(i,data){delete data.link;});this.$('stage').css({cursor:'pointer'}).bind(CLICK(),function(e){self.next();});}
if(this._options.carousel){this._carousel.bindControls();}
if(this._options.autoplay){this.pause();if(typeof this._options.autoplay=='number'){this._playtime=this._options.autoplay;}
this.trigger(Galleria.PLAY);this._playing=true;}
if(one){if(typeof this._options.show=='number'){this.show(this._options.show);}
return;}
one=true;if(Galleria.History){Galleria.History.change(function(e){var val=parseInt(e.value.replace(/\//,''));if(isNaN(val)){window.history.go(-1);}else{self.show(val,undef,true);}});}
Galleria.theme.init.call(this,this._options);this._options.extend.call(this,this._options);if(/^[0-9]{1,4}$/.test(HASH)&&Galleria.History){this.show(HASH,undef,true);}else{this.show(this._options.show);}});this.append({'info-text':['info-title','info-description','info-author'],'info':['info-text'],'image-nav':['image-nav-right','image-nav-left'],'stage':['images','loader','counter','image-nav'],'thumbnails-list':['thumbnails'],'thumbnails-container':['thumb-nav-left','thumbnails-list','thumb-nav-right'],'container':['stage','thumbnails-container','info','tooltip']});Utils.hide(this.$('counter').append(this.get('current'),' / ',this.get('total')));this.setCounter('&#8211;');$.each(new Array(2),function(i){var image=new Galleria.Picture();$(image.container).css({position:'absolute',top:0,left:0});self.$('images').append(image.container);self._controls[i]=image;});this.$('images').css({position:'relative',top:0,left:0,width:'100%',height:'100%'});this.$('thumbnails, thumbnails-list').css({overflow:'hidden',position:'relative'});this.$('image-nav-right, image-nav-left').bind(CLICK(),function(e){if(self._options.clicknext){e.stopPropagation();}
if(self._options.pause_on_interaction){self.pause();}
var fn=/right/.test(this.className)?'next':'prev';self[fn]();});$.each(['info','counter','image-nav'],function(i,el){if(self._options['show_'+el.replace(/-/,'')]===false){Utils.moveOut(self.get(el));}});this.load();if(!this._options.keep_source&&!IE){this._target.innerHTML='';}
this.$('target').append(this.get('container'));if(this._options.carousel){this.bind(Galleria.THUMBNAIL,function(){this.updateCarousel();});}
this.bind(Galleria.IMAGE,function(e){this._options.on_image.call(this,e.imageTarget,e.thumbTarget);});return this;},_run:function(){var self=this,o=this._options,width=0,height=0,optval=typeof o.thumbnails=='string'?o.thumbnails.toLowerCase():null;for(var i=0;this._data[i];i++){var thumb,data=this._data[i],$container;if(o.thumbnails===true){thumb=new Galleria.Picture(i);var src=data.thumb||data.image;this.$('thumbnails').append(thumb.container);$container=$(thumb.container);var getStyle=function(prop){return doc.defaultView&&doc.defaultView.getComputedStyle?doc.defaultView.getComputedStyle(thumb.container,null)[prop]:$container.css(prop);};thumb.data={width:Utils.parseValue(getStyle('width')),height:Utils.parseValue(getStyle('height')),order:i};$container.css((o.thumb_fit&&o.thumb_crop!==true)?{width:0,height:0}:{width:thumb.data.width,height:thumb.data.height});thumb.load(src,function(thumb){thumb.scale({width:thumb.data.width,height:thumb.data.height,crop:o.thumb_crop,margin:o.thumb_margin,complete:function(thumb){var top=['left','top'];var arr=['Width','Height'];$.each(arr,function(i,meassure){var m=meassure.toLowerCase();if((o.thumb_crop!==true||o.thumb_crop==m)&&o.thumb_fit){var css={};css[m]=thumb[m];$(thumb.container).css(css);css={};css[top[i]]=0;$(thumb.image).css(css);}
thumb['outer'+meassure]=$(thumb.container)['outer'+meassure](true);});Utils.toggleQuality(thumb.image,o.thumb_quality===true||(o.thumb_quality=='auto'&&thumb.original.width<thumb.width*3));self.trigger({type:Galleria.THUMBNAIL,thumbTarget:thumb.image,index:thumb.data.order});}});});if(o.preload=='all'){thumb.add(data.image);}}else if(optval=='empty'||optval=='numbers'){thumb={container:Utils.create('galleria-image'),image:Utils.create('img','span'),ready:true};if(optval=='numbers'){$(thumb.image).text(i+1);}
this.$('thumbnails').append(thumb.container);window.setTimeout((function(image,index,container){return function(){$(container).append(image);self.trigger({type:Galleria.THUMBNAIL,thumbTarget:image,index:index});}})(thumb.image,i,thumb.container),50+(i*20));}else{thumb={container:null,image:null};}
$(thumb.container).add(o.keep_source&&o.link_source_images?data.original:null).data('index',i).bind(o.thumb_event_type,function(e){if(o.pause_on_interaction){self.pause();}
var index=$(e.currentTarget).data('index');if(self.getIndex()!==index){self.show(index);}
e.preventDefault();});this._thumbnails.push(thumb);}
Utils.wait({until:function(){self._stageWidth=self.$('stage').width();self._stageHeight=self.$('stage').height();return(self._stageWidth&&self._stageHeight>50);},success:function(){self.trigger(Galleria.READY);},error:function(){Galleria.raise('stage meassures not found');}});},load:function(source,selector,config){var self=this;this._data=[];this._thumbnails=[];this.$('thumbnails').empty();if(typeof selector=='function'){config=selector;selector=null;}
source=source||this._options.data_source;selector=selector||this._options.data_selector;config=config||this._options.data_config;if(source.constructor==Array){if(this.validate(source)){this._data=source;this.trigger(Galleria.DATA);}else{Galleria.raise('Load failed: JSON Array not valid.');}
return this;}
$(source).find(selector).each(function(i,img){var data={},img=$(img),parent=img.parent(),href=parent.attr('href');if(/\.(png|gif|jpg|jpeg)$/i.test(href)){data.image=href;}else if(href){data.link=href;}
self._data.push($.extend({title:img.attr('title'),thumb:img.attr('src'),image:img.attr('src'),description:img.attr('alt'),link:img.attr('longdesc'),original:img.get(0)},data,config(img)));});if(this.getDataLength()){this.trigger(Galleria.DATA);}else{Galleria.raise('Load failed: no data found.');}
return this;},_getActive:function(){return this._controls.getActive();},validate:function(data){return true;},bind:function(type,fn){this.$('container').bind(type,this.proxy(fn));return this;},unbind:function(type){this.$('container').unbind(type);return this;},trigger:function(type){type=typeof type=='object'?$.extend(type,{scope:this}):{type:type,scope:this};this.$('container').trigger(type);return this;},addIdleState:function(elem,styles){this._idle.add.apply(this._idle,Utils.array(arguments));return this;},removeIdleState:function(elem){this._idle.remove.apply(this._idle,Utils.array(arguments));return this;},enterIdleMode:function(){this._idle.hide();return this;},exitIdleMode:function(){this.idle._show();return this;},enterFullscreen:function(callback){this._fullscreen.enter.apply(this,Utils.array(arguments));return this;},exitFullscreen:function(callback){this._fullscreen.exit.apply(this,Utils.array(arguments));return this;},bindTooltip:function(elem,value){this._tooltip.bind.apply(this._tooltip,Utils.array(arguments));return this;},defineTooltip:function(elem,value){this._tooltip.define.apply(this._tooltip,Utils.array(arguments));return this;},refreshTooltip:function(){this._tooltip.show.apply(this._tooltip,Utils.array(arguments));return this;},openLightbox:function(){this._lightbox.show.apply(this._lightbox,Utils.array(arguments));return this;},closeLightbox:function(){this._lightbox.hide.apply(this._lightbox,Utils.array(arguments));return this;},getActiveImage:function(){return this._getActive().image||undef;},getActiveThumb:function(){return this._thumbnails[this._active].image||undef;},getMousePosition:function(e){return{x:e.pageX-this.$('container').offset().left,y:e.pageY-this.$('container').offset().top};},addPan:function(img){if(this._options.image_crop===false){return;}
img=$(img||this.getActiveImage());var self=this,x=img.width()/2,y=img.height()/2,curX=destX=parseInt(img.css('left'))||0,curY=destY=parseInt(img.css('top'))||0,distX=0,distY=0,active=false,ts=Utils.timestamp(),cache=0,move=0,position=function(dist,cur,pos){if(dist>0){move=Math.round(Math.max(dist*-1,Math.min(0,cur)));if(cache!=move){cache=move;if(IE==8){img.parent()['scroll'+pos](move*-1);}else{var css={};css[pos.toLowerCase()]=move;img.css(css);}}}},calculate=function(e){if(Utils.timestamp()-ts<50){return;}
active=true;x=self.getMousePosition(e).x;y=self.getMousePosition(e).y;},loop=function(e){if(!active){return;}
distX=img.width()-self._stageWidth;distY=img.height()-self._stageHeight;destX=x/self._stageWidth*distX*-1;destY=y/self._stageHeight*distY*-1;curX+=(destX-curX)/self._options.image_pan_smoothness;curY+=(destY-curY)/self._options.image_pan_smoothness;position(distY,curY,'Top');position(distX,curX,'Left');};if(IE==8){img.parent().scrollTop(curY*-1).scrollLeft(curX*-1);img.css({top:0,left:0});}
this.$('stage').unbind('mousemove',calculate).bind('mousemove',calculate);Utils.addTimer('pan',loop,50,true);return this;},proxy:function(fn,scope){if(typeof fn!=='function'){return function(){};}
scope=scope||this;return function(){return fn.apply(scope,Utils.array(arguments));};},removePan:function(){if(IE==8){}
this.$('stage').unbind('mousemove');Utils.clearTimer('pan');return this;},addElement:function(id){var dom=this._dom;$.each(Utils.array(arguments),function(i,blueprint){dom[blueprint]=Utils.create('galleria-'+blueprint);});return this;},attachKeyboard:function(map){this._keyboard.attach.apply(this._keyboard,Utils.array(arguments));return this;},detachKeyboard:function(){this._keyboard.detach.apply(this._keyboard,Utils.array(arguments));return this;},appendChild:function(parentID,childID){this.$(parentID).append(this.get(childID)||childID);return this;},prependChild:function(parentID,childID){this.$(parentID).prepend(this.get(childID)||childID);return this;},remove:function(elemID){this.$(Utils.array(arguments).join(',')).remove();return this;},append:function(data){for(var i in data){if(data[i].constructor==Array){for(var j=0;data[i][j];j++){this.appendChild(i,data[i][j]);}}else{this.appendChild(i,data[i]);}}
return this;},_scaleImage:function(image,options){options=$.extend({width:this._stageWidth,height:this._stageHeight,crop:this._options.image_crop,max:this._options.max_scale_ratio,min:this._options.min_scale_ratio,margin:this._options.image_margin,position:this._options.image_position},options);(image||this._controls.getActive()).scale(options);return this;},updateCarousel:function(){this._carousel.update();return this;},rescale:function(width,height,complete){var self=this;if(typeof width=='function'){complete=width;width=undef;}
var scale=function(){var o=self._options;self._stageWidth=width||self.$('stage').width();self._stageHeight=height||self.$('stage').height();self._scaleImage();if(self._options.carousel){self.updateCarousel();}
self.trigger(Galleria.RESCALE);if(typeof complete=='function'){complete.call(self);}};if(Galleria.WEBKIT&&!width&&!height){Utils.addTimer('scale',scale,5);}else{scale.call(self);}
return this;},refreshImage:function(){this._scaleImage();if(this._options.image_pan){this.addPan();}
return this;},show:function(index,rewind,_history){if(index===false||!this._options.queue&&this._queue.stalled){return;}
index=Math.max(0,Math.min(parseInt(index),this.getDataLength()-1));rewind=typeof rewind!='undefined'?!!rewind:index<this.getIndex();_history=_history||false;if(!_history&&Galleria.History){Galleria.History.value(index.toString());return;}
this._active=index;Array.prototype.push.call(this._queue,{index:index,rewind:rewind});if(!this._queue.stalled){this._show();}
return this;},_show:function(){var self=this,queue=this._queue[0],data=this.getData(queue.index);if(!data){return;}
var src=data.image,active=this._controls.getActive(),next=this._controls.getNext(),cached=next.isCached(src),thumb=this._thumbnails[queue.index];var complete=function(){self._queue.stalled=false;Utils.toggleQuality(next.image,self._options.image_quality);$(active.container).css({zIndex:0,opacity:0});$(next.container).css({zIndex:1,opacity:1});self._controls.swap();if(self._options.image_pan){self.addPan(next.image);}
if(data.link){$(next.image).css({cursor:'pointer'}).bind(CLICK(),function(){if(self._options.popup_links){var win=window.open(data.link,'_blank');}else{window.location.href=data.link;}});}
Array.prototype.shift.call(self._queue);if(self._queue.length){self._show();}
self._playCheck();self.trigger({type:Galleria.IMAGE,index:queue.index,imageTarget:next.image,thumbTarget:thumb.image});};if(this._options.carousel&&this._options.carousel_follow){this._carousel.follow(queue.index);}
if(this._options.preload){var p,n=this.getNext();try{for(var i=this._options.preload;i>0;i--){p=new Galleria.Picture();p.add(self.getData(n).image);n=self.getNext(n);}}catch(e){}}
Utils.show(next.container);$(self._thumbnails[queue.index].container).addClass('active').siblings('.active').removeClass('active');self.trigger({type:Galleria.LOADSTART,cached:cached,index:queue.index,imageTarget:next.image,thumbTarget:thumb.image});next.load(src,function(next){self._scaleImage(next,{complete:function(next){Utils.show(next.container);if('image'in active){Utils.toggleQuality(active.image,false);}
Utils.toggleQuality(next.image,false);self._queue.stalled=true;self.removePan();self.setInfo(queue.index);self.setCounter(queue.index);self.trigger({type:Galleria.LOADFINISH,cached:cached,index:queue.index,imageTarget:next.image,thumbTarget:self._thumbnails[queue.index].image});var transition=active.image===null&&self._options.transition_initial?self._options.transition_initial:self._options.transition;if(transition in _transitions===false){complete();}else{var params={prev:active.image,next:next.image,rewind:queue.rewind,speed:self._options.transition_speed||400};_transitions[transition].call(self,params,complete);}}});});},getNext:function(base){base=typeof base=='number'?base:this.getIndex();return base==this.getDataLength()-1?0:base+1;},getPrev:function(base){base=typeof base=='number'?base:this.getIndex();return base===0?this.getDataLength()-1:base-1;},next:function(){if(this.getDataLength()>1){this.show(this.getNext(),false);}
return this;},prev:function(){if(this.getDataLength()>1){this.show(this.getPrev(),true);}
return this;},get:function(elemId){return elemId in this._dom?this._dom[elemId]:null;},getData:function(index){return index in this._data?this._data[index]:this._data[this._active];},getDataLength:function(){return this._data.length;},getIndex:function(){return typeof this._active==='number'?this._active:false;},getStageHeight:function(){return this._stageHeight;},getStageWidth:function(){return this._stageWidth;},getOptions:function(key){return typeof key=='undefined'?this._options:this._options[key];},setOptions:function(key,value){if(typeof key=='object'){$.extend(this._options,key);}else{this._options[key]=value;}
return this;},play:function(delay){this._playing=true;this._playtime=delay||this._playtime;this._playCheck();this.trigger(Galleria.PLAY);return this;},pause:function(){this._playing=false;this.trigger(Galleria.PAUSE);return this;},playToggle:function(delay){return(this._playing)?this.pause():this.play(delay);},isPlaying:function(){return this._playing;},_playCheck:function(){var self=this,played=0,interval=20,now=Utils.timestamp();if(this._playing){Utils.clearTimer('play');var fn=function(){played=Utils.timestamp()-now;if(played>=self._playtime&&self._playing){Utils.clearTimer('play');self.next();return;}
if(self._playing){self.trigger({type:Galleria.PROGRESS,percent:Math.ceil(played/self._playtime*100),seconds:Math.floor(played/1000),milliseconds:played});Utils.addTimer('play',fn,interval);}};Utils.addTimer('play',fn,interval);}},setIndex:function(val){this._active=val;return this;},setCounter:function(index){if(typeof index=='number'){index++;}else if(typeof index=='undefined'){index=this.getIndex()+1;}
this.get('current').innerHTML=index;if(IE==8){var opacity=this.$('counter').css('opacity');this.$('counter').css('opacity',opacity);}
return this;},setInfo:function(index){var self=this,data=this.getData(index);$.each(['title','description','author'],function(i,type){var elem=self.$('info-'+type);if(!!data[type]){elem[data[type].length?'show':'hide']().html(data[type]);}else{elem.empty().hide();}});return this;},hasInfo:function(index){var d=this.getData(index);var check='title description'.split(' ');for(var i=0;check[i];i++){if(!!this.getData(index)[check[i]]){return true;}}
return false;},jQuery:function(str){var self=this,ret=[];$.each(str.split(','),function(i,elemId){elemId=$.trim(elemId);if(self.get(elemId)){ret.push(elemId);}});var jQ=$(self.get(ret.shift()));$.each(ret,function(i,elemId){jQ=jQ.add(self.get(elemId));});return jQ;},$:function(){return this.jQuery.apply(this,Utils.array(arguments));}};$.extend(Galleria,{DATA:'g_data',READY:'g_ready',THUMBNAIL:'g_thumbnail',LOADSTART:'g_loadstart',LOADFINISH:'g_loadfinish',IMAGE:'g_image',THEMELOAD:'g_themeload',PLAY:'g_play',PAUSE:'g_pause',PROGRESS:'g_progress',FULLSCREEN_ENTER:'g_fullscreen_enter',FULLSCREEN_EXIT:'g_fullscreen_exit',IDLE_ENTER:'g_idle_enter',IDLE_EXIT:'g_idle_exit',RESCALE:'g_rescale',LIGHTBOX_OPEN:'g_lightbox_open',LIGHTBOX_CLOSE:'g_lightbox_close',LIGHTBOX_IMAGE:'g_lightbox_image',IE9:IE==9,IE8:IE==8,IE7:IE==7,IE6:IE==6,IE:!!IE,WEBKIT:/webkit/.test(NAV),SAFARI:/safari/.test(NAV),CHROME:/chrome/.test(NAV),QUIRK:(IE&&doc.compatMode&&doc.compatMode=="BackCompat"),MAC:/mac/.test(navigator.platform.toLowerCase()),OPERA:!!window.opera,IPHONE:/iphone/.test(NAV),IPAD:/ipad/.test(NAV),ANDROID:/android/.test(NAV),TOUCH:!!(/iphone/.test(NAV)||/ipad/.test(NAV)||/android/.test(NAV))});Galleria.addTheme=function(theme){if(!!theme['name']===false){Galleria.raise('No theme name specified');}
if(typeof theme.defaults!='object'){theme.defaults={};}
if(typeof theme.css=='string'){var css;$('script').each(function(i,script){var reg=new RegExp('galleria\\.'+theme.name.toLowerCase()+'\\.');if(reg.test(script.src)){css=script.src.replace(/[^\/]*$/,'')+theme.css;Utils.addTimer("css",function(){Utils.loadCSS(css,'galleria-theme',function(){Galleria.theme=theme;$doc.trigger(Galleria.THEMELOAD);});},1);}});if(!css){Galleria.raise('No theme CSS loaded');}}else{Galleria.theme=theme;$doc.trigger(Galleria.THEMELOAD);}
return theme;};Galleria.loadTheme=function(src,options){var loaded=false,length=_galleries.length;Galleria.theme=undef;Utils.loadScript(src,function(){loaded=true;});Utils.wait({until:function(){return loaded;},error:function(){Galleria.raise("Theme at "+src+" could not load, check theme path.",true);},success:function(){if(length){var refreshed=[];$.each(Galleria.get(),function(i,instance){var op=$.extend(instance._original.options,{data_source:instance._data},options);instance.$('container').remove();var g=new Galleria();g._id=instance._id;g.init(instance._original.target,op);refreshed.push(g);});_galleries=refreshed;}},timeout:2000});};Galleria.get=function(index){if(!!_galleries[index]){return _galleries[index];}else if(typeof index!=='number'){return _galleries;}else{Galleria.raise('Gallery index '+index+' not found');}};Galleria.addTransition=function(name,fn){_transitions[name]=fn;};Galleria.utils=Utils;Galleria.log=function(){try{window.console.log.apply(window.console,Utils.array(arguments));}catch(e){try{opera.postError.apply(opera,arguments);}catch(er){alert(Utils.array(arguments).split(', '));}}};Galleria.raise=function(msg,fatal){if(DEBUG||fatal){var type=fatal?'Fatal error':'Error';throw new Error(type+': '+msg);}};Galleria.Picture=function(id){this.id=id||null;this.image=null;this.container=Utils.create('galleria-image');$(this.container).css({overflow:'hidden',position:'relative'});this.original={width:0,height:0};this.ready=false;this.loaded=false;};Galleria.Picture.prototype={cache:{},add:function(src){var self=this;var image=new Image();$(image).css('display','block');if(self.cache[src]){image.src=src;self.loaded=true;self.original={height:image.height,width:image.width};return image;}
image.onload=function(){self.original={height:this.height,width:this.width};self.cache[src]=src;self.loaded=true;};image.src=src;return image;},show:function(){Utils.show(this.image);},hide:function(){Utils.moveOut(this.image);},clear:function(){this.image=null;},isCached:function(src){return!!this.cache[src];},load:function(src,callback){var self=this;$(this.container).empty(true);this.image=this.add(src);Utils.hide(this.image);$(this.container).append(this.image);Utils.wait({until:function(){return self.loaded&&self.image.complete&&self.image.width;},success:function(){window.setTimeout(function(){callback.call(self,self);},50);},error:function(){window.setTimeout(function(){callback.call(self,self);},50);Galleria.raise('image not loaded in 10 seconds: '+src);},timeout:10000});return this.container;},scale:function(options){options=$.extend({width:0,height:0,min:undef,max:undef,margin:0,complete:function(){},position:'center',crop:false},options);if(!this.image){return this.container;}
var width,height,self=this,$container=$(self.container);Utils.wait({until:function(){width=options.width||$container.width()||Utils.parseValue($container.css('width'));height=options.height||$container.height()||Utils.parseValue($container.css('height'));return width&&height;},success:function(){var newWidth=(width-options.margin*2)/self.original.width,newHeight=(height-options.margin*2)/self.original.height,cropMap={'true':Math.max(newWidth,newHeight),'width':newWidth,'height':newHeight,'false':Math.min(newWidth,newHeight)},ratio=cropMap[options.crop.toString()];if(options.max){ratio=Math.min(options.max,ratio);}
if(options.min){ratio=Math.max(options.min,ratio);}
$(self.container).width(width).height(height);$.each(['width','height'],function(i,m){$(self.image)[m](self[m]=Math.ceil(self.original[m]*ratio));});var pos={},mix={},getPosition=function(value,meassure,margin){var result=0;if(/\%/.test(value)){var flt=parseInt(value)/100;result=Math.ceil($(self.image)[meassure]()*-1*flt+margin*flt);}else{result=Utils.parseValue(value);}
return result;},positionMap={'top':{top:0},'left':{left:0},'right':{left:'100%'},'bottom':{top:'100%'}};$.each(options.position.toLowerCase().split(' '),function(i,value){if(value=='center'){value='50%';}
pos[i?'top':'left']=value;});$.each(pos,function(i,value){if(positionMap.hasOwnProperty(value)){$.extend(mix,positionMap[value]);}});pos=pos.top?$.extend(pos,mix):mix;pos=$.extend({top:'50%',left:'50%'},pos);$(self.image).css({position:'relative',top:getPosition(pos.top,'height',height)-options.margin,left:getPosition(pos.left,'width',width)-options.margin});self.show();self.ready=true;options.complete.call(self,self);},error:function(){Galleria.raise('Could not scale image: '+self.image.src);},timeout:1000});return this;}};$.extend($.easing,{galleria:function(_,t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
return-c/2*((t-=2)*t*t*t-2)+b;},galleriaIn:function(_,t,b,c,d){return c*(t/=d)*t*t*t+b;},galleriaOut:function(_,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;}});$.fn.galleria=function(options){return this.each(function(){var gallery=new Galleria();gallery.init(this,options);});};window.Galleria=Galleria;})(jQuery);(function($){Galleria.addTheme({name:'classic',author:'Galleria',version:'1.5',defaults:{transition:'slide',thumb_crop:'height',_toggle_info:true},init:function(options){var toggle=this.$('image-nav-left,image-nav-right'),click=Galleria.TOUCH?'touchstart':'click';this.$('loader').show().css('opacity',.4)
if(!Galleria.TOUCH){this.$('thumbnails').children().hover(function(){$(this).not('.active').children().stop().fadeTo(100,1);},function(){$(this).not('.active').children().stop().fadeTo(400,.6);});}
this.bind(Galleria.THUMBNAIL,function(e){$(e.thumbTarget).parent(':not(.active)').children().css('opacity',.6)});this.bind(Galleria.LOADSTART,function(e){if(!e.cached){this.$('loader').show().fadeTo(200,.4);}
$(e.thumbTarget).css('opacity',1).parent().siblings().children().css('opacity',.6);});this.bind(Galleria.LOADFINISH,function(e){this.$('loader').fadeOut(200);});}});})(jQuery);if(typeof(ActivityLogServicesClient)==="undefined"){ActivityLogServicesClient=function(activityLogServicesUrl){var _this=this;_this.activityLogServicesUrl=activityLogServicesUrl;_this.method={clickToDetailsFromSearchResultsFeatured:"clickToDetailsFromSearchResultsFeatured",clickToExternalWebsite:"clickToExternalWebsite",clickToExternalFloorPlans:"clickToExternalFloorPlans",clickToExternalListingDetails:"clickToExternalListingDetails",clickToExternalPhotos:"clickToExternalPhotos",clickToExternalVideoTour:"clickToExternalVideoTour",clickToExternalVirualTour:"clickToExternalVirtualTour",emailThisListing:"emailThisListing",emailFeaturedVideo:"emailFeaturedVideo",emailLeadAdvertiser:"emailLeadAdvertiser",emailLeadProduct:"emailLeadProduct",viewDetails:"viewDetails",viewDrivingDirections:"viewDrivingDirections",viewFeaturedVideo:"viewFeaturedVideo",viewFloorPlans:"viewFloorPlans",viewMap:"viewMap",viewPhotos:"viewPhotos",viewPrintFlyer:"viewPrintFlyer",viewSearchResults:"viewSearchResults",viewSearchResultsFeatured:"viewSearchResultsFeatured"};_this.logActivity=function(method,data,successCallback,errorCallback){var successCallback=(typeof(successCallback)=="function")?successCallback:function(){};var errorCallback=(typeof(errorCallback)=="function")?errorCallback:function(){};var url=_this.activityLogServicesUrl+_this.method[method];_this.callWebService(data,url,successCallback,errorCallback);};_this.callWebService=function(data,url,successCallback,errorCallback){jQuery.ajax({dataType:"jsonp",url:url,data:data,cache:false,type:"GET",success:function(response){if(typeof(response.status.code)!=="undefined"&&response.status.code==200){successCallback();}else{errorCallback();}}});};}}
if(typeof(SinglePropertyWebsites.IndexController)==="undefined"){SinglePropertyWebsites.IndexController=function(){var _this=this;_this.activityServicesClient=new ActivityServicesClient(SinglePropertyWebsites.Conf.activityServicesUrl);_this.emailServicesClient=new EmailServicesClient(SinglePropertyWebsites.Conf.emailServicesUrl);_this.activityLogServicesClient=new ActivityLogServicesClient(SinglePropertyWebsites.Conf.activityLogServicesUrl);_this.logSuccessCallback=function(){return true;};_this.logViewWebsiteClick=function(advertiserId){var parameters={id:advertiserId,linkType:"advertiserWebsite"};_this.activityServicesClient.logExternalWebsiteLead(parameters);};_this.logVirtualTourClick=function(listingId){var parameters={id:listingId,linkType:"virtualTour"};_this.activityServicesClient.logExternalWebsiteLead(parameters,_this.logSuccessCallback);};_this.logDeepLinkClick=function(listingId){var parameters={id:listingId,linkType:"externalDetails"};_this.activityServicesClient.logExternalWebsiteLead(parameters);};_this.getListingActivityLogData=function(applicationId){var data={homeFinderListingKey:jQuery('#listingId').text(),childHomeFinderAdvertiserKey:jQuery('#childAdvertiserId').text(),parentHomeFinderAdvertiserKey:jQuery('#parentAdvertiserId').text(),_applicationId:applicationId,_userAgent:SinglePropertyWebsites.Conf.userAgent,_userIPAddress:SinglePropertyWebsites.Conf.userIpAddress};return data;};_this.getAdvertiserActivityLogData=function(advertiserId,applicationId){var data={homeFinderAdvertiserKey:advertiserId,_applicationId:applicationId,_userAgent:SinglePropertyWebsites.Conf.userAgent,_userIPAddress:SinglePropertyWebsites.Conf.userIpAddress};return data;};_this.enableGalleria=function(){if(jQuery(".photoFrame .photoMiddle img").length>1){jQuery(".photoFrame .photoMiddle").galleria({height:392,idle_time:0,show:(jQuery("#videoPlayer, .defaultVideoPlayerImage").length)?1:0,show_counter:false,show_info:true,transition_speed:200});}};SinglePropertyWebsites.utilityController.blankOrRestoreFieldLabel(jQuery('#drivingDirectionsText'),'Enter Your Address');};}
if(typeof(SinglePropertyWebsites.UtilityController)==="undefined"){SinglePropertyWebsites.UtilityController=function(){var _this=this;_this.blankOrRestoreFieldLabel=function(field,label){field.focus(function(){if(this.value===label){this.value='';}else{this.select();}});field.blur(function(){if(this.value===''){this.value=label;}});};};}
SinglePropertyWebsites.utilityController=new SinglePropertyWebsites.UtilityController();if(typeof(EmailServicesClient)==="undefined"){EmailServicesClient=function(emailServicesUrl){var _this=this;_this.emailServicesUrl=emailServicesUrl;_this.videoEmail=function(parameters,successfulCallback,erroredCallback){successfulCallback=(typeof(successfulCallback)==="function")?successfulCallback:function(){};erroredCallback=(typeof(erroredCallback)==="function")?erroredCallback:function(){};var url=_this.emailServicesUrl+"videoEmail";_this.callService(url,parameters,successfulCallback,erroredCallback);};_this.callService=function(url,data,successfulCallback,erroredCallback){jQuery.ajax({dataType:'jsonp',url:url,data:data,success:function(response){if(response.status.code===200){successfulCallback(response);}else{erroredCallback();}},error:function(){erroredCallback();}});};};}
if(typeof(SinglePropertyWebsites.ValidationController)==="undefined"){SinglePropertyWebsites.ValidationController=function(){var _this=this;jQuery.extend(jQuery.validator.messages,{maxlength:'This value is too long. Please shorten it.',minlength:'This value is not long enough.',number:'Please enter a valid number.',required:'Required',url:'Please enter a valid url.'});jQuery.validator.addMethod("usCurrency",function(value,element){return this.optional(element)||/^(\d+)(\.\d{1,2})?$/i.test(value);},"Enter a valid U.S. currency amount.");jQuery.validator.addMethod("listingDetailsUrl",function(value,element){return this.optional(element)||(/^((https?|ftp):\/\/)?(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value)&&/\/([0-9]+)d/.test(value));},"Enter a valid listing details URL.");jQuery.validator.addMethod("zipCode",function(value,element){return this.optional(element)||/^[0-9]{5}$/i.test(value);},"Enter a 5 digit zip code.");jQuery.validator.addMethod("urlDomain",function(value,element){return this.optional(element)||/^((https?|ftp):\/\/)?(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},"Enter a valid URL.");jQuery.validator.addMethod("phoneNumber",function(value,element){return this.optional(element)||value.match(/^(\([0-9]{3}\)|[0-9]{3}[\-.]?)[ ]?[0-9]{3}[ ]?[\-. ]?[ ]?[0-9]{4}$/);},"Please enter a valid phone number.");jQuery.validator.addMethod("dateOrMMDDYYYY",function(value,element,param){return this.optional(element)||value==="MM/DD/YYYY"||value===''||(value.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/)&&!/Invalid|NaN/.test(new Date(value)));},'Please enter a date in the MM/DD/YYYY format.');jQuery.validator.addMethod("selectNone",function(value,element){if(element.value==="none"){return false;}else{return true;}},"Please select an option.");jQuery.validator.addMethod("defaultInvalid",function(value,element){if(element.value===element.defaultValue){return false;}else{return true;}});jQuery.validator.addMethod("dateGreaterThan",function(value,element,params){if(value===""){return true;}
if(!/Invalid|NaN/.test(new Date(value))){return new Date(value)>=new Date(jQuery(params).val());}
return isNaN(value)&&(isNaN(jQuery(params).val())||(parseFloat(value)>parseFloat(jQuery(params).val())));},'Must be greater than {0}.');jQuery.validator.addMethod("emailMultiple",function(value,element,param){var testElement=element.value.replace(/ /g,'');var splitElements=testElement.split(',');var i;if(splitElements.length>0&&splitElements[0]!==''){for(i=0;i<splitElements.length;i++){if(!/^([a-zA-Z0-9\._%\-]+)(@)([a-zA-Z0-9\.\-]+)(\.)([a-zA-Z]{2,4})$/.test(splitElements[i])){return false;}}}
return true;},jQuery.validator.messages.email);jQuery.validator.addMethod('email',function(value,element){return this.optional(element)||/^([a-zA-Z0-9\._%\-]+)(@)([a-zA-Z0-9\.\-]+)(\.)([a-zA-Z]{2,4})$/.test(value);});_this.highlight=function(element,errorClass,validClass){if(jQuery(element).hasClass(validClass)){jQuery(element).addClass(errorClass).removeClass(validClass);}};_this.unhighlight=function(element,errorClass,validClass){if(!jQuery(element).hasClass(validClass)&&jQuery(element).val()!==''){jQuery(element).removeClass(errorClass).addClass(validClass);}};_this.onfocusout=function(element){jQuery(element).val(jQuery.trim(element.value));};_this.errorPlacement=function(error,element){jQuery(element).parent('.column').prev().append(error);};_this.onkeyup=function(element){}
_this.errorClass="errors";_this.errorElement="span";};}
(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.substring(0,q)||"*";var o=s.substring(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).substring(2,10)}var h=function(t,r,s){var q=this;var p={};var u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.substring(0,v.length-1);var w="onBefore"+v.substring(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var s={};var o=this;var u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var y=q._api().fp_getPlugin(p);if(!y){return}i(o,y);delete o.methods;if(!u){m(y.methods,function(){var A=""+this;o[A]=function(){var B=[].slice.call(arguments);var C=q._api().fp_invoke(p,A,B);return C==="undefined"||C===undefined?o:C}});u=true}}var z=s[w];if(z){z.apply(o,v);if(w.substring(0,1)=="_"){delete s[w]}}}})};function b(o,t,z){var E=this,y=null,x,u,p=[],s={},B={},r,v,w,D,A,q;i(E,{id:function(){return r},isLoaded:function(){return(y!==null)},getParent:function(){return o},hide:function(F){if(F){o.style.height="0px"}if(y){y.style.height="0px"}return E},show:function(){o.style.height=q+"px";if(y){y.style.height=A+"px"}return E},isHidden:function(){return y&&parseInt(y.style.height,10)===0},load:function(F){if(!y&&E._fireEvent("onBeforeLoad")!==false){m(a,function(){this.unload()});x=o.innerHTML;if(x&&!flashembed.isSupported(t.version)){o.innerHTML=""}flashembed(o,t,{config:z});if(F){F.cached=true;j(B,"onLoad",F)}}return E},unload:function(){if(x.replace(/\s/g,"")!==""){if(E._fireEvent("onBeforeUnload")===false){return E}try{if(y){y.fp_close()}}catch(F){}y=null;o.innerHTML=x;E._fireEvent("onUnload")}return E},getClip:function(F){if(F===undefined){F=D}return p[F]},getCommonClip:function(){return u},getPlaylist:function(){return p},getPlugin:function(F){var H=s[F];if(!H&&E.isLoaded()){var G=E._api().fp_getPlugin(F);if(G){H=new l(F,G,E);s[F]=H}}return H},getScreen:function(){return E.getPlugin("screen")},getControls:function(){return E.getPlugin("controls")},getConfig:function(F){return F?k(z):z},getFlashParams:function(){return t},loadPlugin:function(I,H,K,J){if(typeof K=="function"){J=K;K={}}var G=J?e():"_";E._api().fp_loadPlugin(I,H,K,G);var F={};F[G]=J;var L=new l(I,null,E,F);s[I]=L;return L},getState:function(){return y?y.fp_getState():-1},play:function(G,F){function H(){if(G!==undefined){E._api().fp_play(G,F)}else{E._api().fp_play()}}if(y){H()}else{E.load(function(){H()})}return E},getVersion:function(){var G="flowplayer.js 3.1.4";if(y){var F=y.fp_getVersion();F.push(G);return F}return G},_api:function(){if(!y){throw"Flowplayer "+E.id()+" not loaded when calling an API method"}return y},setClip:function(F){E.setPlaylist([F]);return E},getIndex:function(){return w}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var F="on"+this;if(F.indexOf("*")!=-1){F=F.substring(0,F.length-1);var G="onBefore"+F.substring(2);E[G]=function(H){j(B,G,H);return E}}E[F]=function(H){j(B,F,H);return E}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed").split(","),function(){var F=this;E[F]=function(H,G){if(!y){return E}var I=null;if(H!==undefined&&G!==undefined){I=y["fp_"+F](H,G)}else{I=(H===undefined)?y["fp_"+F]():y["fp_"+F](H)}return I==="undefined"||I===undefined?E:I}});E._fireEvent=function(O){if(typeof O=="string"){O=[O]}var P=O[0],M=O[1],K=O[2],J=O[3],I=0;if(z.debug){g(O)}if(!y&&P=="onLoad"&&M=="player"){y=y||c(v);A=y.clientHeight;m(p,function(){this._fireEvent("onLoad")});m(s,function(Q,R){R._fireEvent("onUpdate")});u._fireEvent("onLoad")}if(P=="onLoad"&&M!="player"){return}if(P=="onError"){if(typeof M=="string"||(typeof M=="number"&&typeof K=="number")){M=K;K=J}}if(P=="onContextMenu"){m(z.contextMenu[M],function(Q,R){R.call(E)});return}if(P=="onPluginEvent"){var F=M.name||M;var G=s[F];if(G){G._fireEvent("onUpdate",M);G._fireEvent(K,O.slice(3))}return}if(P=="onPlaylistReplace"){p=[];var L=0;m(M,function(){p.push(new h(this,L++,E))})}if(P=="onClipAdd"){if(M.isInStream){return}M=new h(M,K,E);p.splice(K,0,M);for(I=K+1;I<p.length;I++){p[I].index++}}var N=true;if(typeof M=="number"&&M<p.length){D=M;var H=p[M];if(H){N=H._fireEvent(P,K,J)}if(!H||N!==false){N=u._fireEvent(P,K,J,H)}}m(B[P],function(){N=this.call(E,M,K);if(this.cached){B[P].splice(I,1)}if(N===false){return false}I++});return N};function C(){if($f(o)){$f(o).getParent().innerHTML="";w=$f(o).getIndex();a[w]=E}else{a.push(E);w=a.length-1}q=parseInt(o.style.height,10)||o.clientHeight;if(typeof t=="string"){t={src:t}}r=o.id||"fp"+e();v=t.id||r+"_api";t.id=v;t.cachebusting=true;z.playerId=r;if(typeof z=="string"){z={clip:{url:z}}}if(typeof z.clip=="string"){z.clip={url:z.clip}}z.clip=z.clip||{};if(o.getAttribute("href",2)&&!z.clip.url){z.clip.url=o.getAttribute("href",2)}u=new h(z.clip,-1,E);z.playlist=z.playlist||[z.clip];var F=0;m(z.playlist,function(){var H=this;if(typeof H=="object"&&H.length){H={url:""+H}}m(z.clip,function(I,J){if(J!==undefined&&H[I]===undefined&&typeof J!="function"){H[I]=J}});z.playlist[F]=H;H=new h(H,F,E);p.push(H);F++});m(z,function(H,I){if(typeof I=="function"){if(u[H]){u[H](I)}else{j(B,H,I)}delete z[H]}});m(z.plugins,function(H,I){if(I){s[H]=new l(H,I,E)}});if(!z.plugins||z.plugins.controls===undefined){s.controls=new l("controls",null,E)}s.canvas=new l("canvas",null,E);t.bgcolor=t.bgcolor||"#000000";t.version=t.version||[9,0];t.expressInstall="http://www.flowplayer.org/swf/expressinstall.swf";function G(H){if(!E.isLoaded()&&E._fireEvent("onBeforeClick")!==false){E.load()}return f(H)}x=o.innerHTML;if(x.replace(/\s/g,"")!==""){if(o.addEventListener){o.addEventListener("click",G,false)}else{if(o.attachEvent){o.attachEvent("onclick",G)}}}else{if(o.addEventListener){o.addEventListener("click",f,false)}E.load()}}if(typeof o=="string"){flashembed.domReady(function(){var F=c(o);if(!F){throw"Flowplayer cannot access element: "+o}else{o=F;C()}})}else{C()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var r=arguments[1];var q=(arguments.length==3)?arguments[2]:{};if(typeof o=="string"){if(o.indexOf(".")!=-1){var t=[];m(n(o),function(){t.push(new b(this,k(r),k(q)))});return new d(t)}else{var s=c(o);return new b(s!==null?s:o,r,q)}}else{if(o){return new b(o,r,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.prototype.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";var i={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(e){jQuery.tools=jQuery.tools||{};jQuery.tools.flashembed={version:"1.0.4",conf:i}}function j(){if(c.done){return false}var l=document;if(l&&l.getElementsByTagName&&l.getElementById&&l.body){clearInterval(c.timer);c.timer=null;for(var k=0;k<c.ready.length;k++){c.ready[k].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(k){if(c.done){return k()}if(c.timer){c.ready.push(k)}else{c.ready=[k];c.timer=setInterval(j,13)}};function f(l,k){if(k){for(key in k){if(k.hasOwnProperty(key)){l[key]=k[key]}}}return l}function g(k){switch(h(k)){case"string":k=k.replace(new RegExp('(["\\\\])',"g"),"\\$1");k=k.replace(/^\s?(\d+)%/,"$1pct");return'"'+k+'"';case"array":return"["+b(k,function(n){return g(n)}).join(",")+"]";case"function":return'"function()"';case"object":var l=[];for(var m in k){if(k.hasOwnProperty(m)){l.push('"'+m+'":'+g(k[m]))}}return"{"+l.join(",")+"}"}return String(k).replace(/\s/g," ").replace(/\'/g,'"')}function h(l){if(l===null||l===undefined){return false}var k=typeof l;return(k=="object"&&l.push)?"array":k}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(k,n){var m=[];for(var l in k){if(k.hasOwnProperty(l)){m[l]=n(k[l])}}return m}function a(r,t){var q=f({},r);var s=document.all;var n='<object width="'+q.width+'" height="'+q.height+'"';if(s&&!q.id){q.id="_"+(""+Math.random()).substring(9)}if(q.id){n+=' id="'+q.id+'"'}if(q.cachebusting){q.src+=((q.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(q.w3c||!s){n+=' data="'+q.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(q.w3c||s){n+='<param name="movie" value="'+q.src+'" />'}q.width=q.height=q.id=q.w3c=q.src=null;for(var l in q){if(q[l]!==null){n+='<param name="'+l+'" value="'+q[l]+'" />'}}var o="";if(t){for(var m in t){if(t[m]!==null){o+=m+"="+(typeof t[m]=="object"?g(t[m]):t[m])+"&"}}o=o.substring(0,o.length-1);n+='<param name="flashvars" value=\''+o+"' />"}n+="</object>";return n}function d(m,p,l){var k=flashembed.getVersion();f(this,{getContainer:function(){return m},getConf:function(){return p},getVersion:function(){return k},getFlashvars:function(){return l},getApi:function(){return m.firstChild},getHTML:function(){return a(p,l)}});var q=p.version;var r=p.expressInstall;var o=!q||flashembed.isSupported(q);if(o){p.onFail=p.version=p.expressInstall=null;m.innerHTML=a(p,l)}else{if(q&&r&&flashembed.isSupported([6,65])){f(p,{src:r});l={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};m.innerHTML=a(p,l)}else{if(m.innerHTML.replace(/\s/g,"")!==""){}else{m.innerHTML="<h2>Flash version "+q+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(m.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(m.tagName=="A"){m.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!o&&p.onFail){var n=p.onFail.call(this);if(typeof n=="string"){m.innerHTML=n}}if(document.all){window[p.id]=document.getElementById(p.id)}}window.flashembed=function(l,m,k){if(typeof l=="string"){var n=document.getElementById(l);if(n){l=n}else{c(function(){flashembed(l,m,k)});return}}if(!l){return}if(typeof m=="string"){m={src:m}}var o=f({},i);f(o,m);return new d(l,o,k)};f(window.flashembed,{getVersion:function(){var m=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var l=navigator.plugins["Shockwave Flash"].description;if(typeof l!="undefined"){l=l.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var n=parseInt(l.replace(/^(.*)\..*$/,"$1"),10);var r=/r/.test(l)?parseInt(l.replace(/^.*r(.*)$/,"$1"),10):0;m=[n,r]}}else{if(window.ActiveXObject){try{var p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(q){try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");m=[6,0];p.AllowScriptAccess="always"}catch(k){if(m[0]==6){return m}}try{p=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}}if(typeof p=="object"){l=p.GetVariable("$version");if(typeof l!="undefined"){l=l.replace(/^\S+\s+(.*)$/,"$1").split(",");m=[parseInt(l[0],10),parseInt(l[2],10)]}}}}return m},isSupported:function(k){var m=flashembed.getVersion();var l=(m[0]>k[0])||(m[0]==k[0]&&m[1]>=k[1]);return l},domReady:c,asString:g,getHTML:a});if(e){jQuery.fn.flashembed=function(l,k){var m=null;this.each(function(){m=flashembed(this,l,k)});return l.api===false?this:m}}})();if(typeof(SinglePropertyWebsites.VideoController)==="undefined"){SinglePropertyWebsites.VideoController=function(){var _this=this;_this.emailServicesClient=new EmailServicesClient(SinglePropertyWebsites.Conf.emailServicesUrl);_this.activityLogServicesClient=new ActivityLogServicesClient(SinglePropertyWebsites.Conf.activityLogServicesUrl);_this.activityLogServicesCoreData={};SinglePropertyWebsites.validationController=new SinglePropertyWebsites.ValidationController();jQuery('.videoLeadForm').validate({rules:{'name':{required:true},'fromEmailAddress':{required:true,email:true},'toEmailAddress':{required:true,emailMultiple:true}},messages:{},errorPlacement:SinglePropertyWebsites.validationController.errorPlacement,submitHandler:function(form){jQuery('.endScreen .errorMessage').hide();_this.shareVideo(jQuery(form));return false;}});_this.logVideoPlay=function(){var homescapeActivityUrl="http://activity.homescape.com/SCS/activity.jsp?page%5Fto=featured%5Fvideo&page%5Ffrom=listing%5Fdetails&logging%5Ftype=product%2Cclickthru&affiliate%5Fname=realestate&filter%5Fproduct%5Fid=";homescapeActivityUrl+=_this.getListingIdFromVideoUrl();jQuery('#videoPlayer').append('<iframe class="activity" src="'+homescapeActivityUrl+'"></iframe>');var data={homeFinderListingKey:_this.getListingIdFromVideoUrl(),_applicationId:SinglePropertyWebsites.Conf.videoApplicationId};};_this.logEmailSent=function(){var listingId=_this.getListingIdFromVideoUrl();var homescapeActivityEmailUrl="http://activity.homescape.com/SCS/activity.jsp?affiliate%5Fname=realestate&filter%5Fproduct%5Fid="+listingId+"&page%5Fto=email%5Ffeatured%5Fvideo&page%5Ffrom=listing%5Fdetails&logging%5Ftype=product";var homescapeActivityLeadUrl="http://activity.homescape.com/SCS/activity.jsp?affiliate%5Fname=realestate&filter%5Fproduct%5Fid="+listingId+"&page%5Fto=featured%5Fvideo&page%5Ffrom=featured%5Fvideo&logging%5Ftype=lead";jQuery('#videoPlayer').append('<iframe class="activity" src="'+homescapeActivityEmailUrl+'"></iframe>');jQuery('#videoPlayer').append('<iframe class="activity" src="'+homescapeActivityLeadUrl+'"></iframe>');};_this.shareVideoSuccessCallback=function(response){if(response.status.code===200){jQuery('.videoLeadForm').each(function(){this.reset();});jQuery('.endScreen .successMessage').show();jQuery('.endScreen .videoLeadForm').fadeOut();jQuery('.endScreen .finishedScreen').fadeIn();_this.logEmailSent();}else{jQuery('.endScreen .errorMessage').show();}};_this.getListingIdFromVideoUrl=function(){var videoUrl=(jQuery("#theVideo source").length>0)?jQuery("#theVideo source").attr("src"):jQuery("#featuredVideo").attr("href");var matches=videoUrl.match(/\/([0-9]+)d|\/([0-9]+)\/videos\/movie/);return(matches.length>2)?((matches.length==3)?matches[2]:null):((matches.length==2)?matches[1]:null);};_this.shareVideo=function(form){var parameters={id:_this.getListingIdFromVideoUrl(),name:form.find("input[name$='name']").val(),fromEmailAddress:form.find("input[name$='fromEmailAddress']").val(),toEmailAddress:form.find("input[name$='toEmailAddress']").val(),comment:form.find("textarea[name$='comment']").val(),applicationId:SinglePropertyWebsites.Conf.videoApplicationId};if(form.find(".copySelfCheckbox").is(":checked")){parameters.ccEmailAddress=parameters.fromEmailAddress;}
_this.emailServicesClient.videoEmail(parameters,_this.shareVideoSuccessCallback);return false;};_this.replayVideo=function(){jQuery('.endScreen .background').fadeOut('slow');jQuery('.finishedScreen').fadeOut('slow',function(){jQuery('.endScreen .successMessage').hide();jQuery('.endScreen .errorMessage').hide();jQuery('.endScreen').hide();var theVideo=document.getElementById('theVideo');if(theVideo.webkitSupportsFullscreen){jQuery('#theVideo').fadeIn('slow',function(){theVideo.play();});}else{jQuery('video').trigger('play');}});};_this.displayEndScreen=function(){var theVideo=document.getElementById('theVideo');if(theVideo.webkitSupportsFullscreen){jQuery('#theVideo').fadeOut('slow');}
jQuery('.endScreen .background').fadeIn('slow');jQuery('.endScreen').fadeIn('slow');jQuery('.endScreen .finishedScreen').fadeIn();};_this.displayShareForm=function(){jQuery('.endScreen .successMessage').hide();jQuery('.endScreen .errorMessage').hide();jQuery('.endScreen .finishedScreen').fadeOut();jQuery('.endScreen .videoLeadForm').fadeIn();};_this.cancelShareForm=function(){jQuery('.endScreen .videoLeadForm').fadeOut();jQuery('.endScreen .finishedScreen').fadeIn();jQuery('.videoLeadForm').each(function(){this.reset();});jQuery('.endScreen .errorMessage').hide();};_this.displayVideoErrorScreen=function(){var theVideo=document.getElementById('theVideo');if(theVideo.webkitSupportsFullscreen){jQuery('#theVideo').fadeOut('slow');}
jQuery('.noFlashScreen .background').fadeIn('slow');jQuery('.noFlashScreen').fadeIn('slow');jQuery('.noFlashScreen .noFlashMessage').fadeIn();};if(jQuery("#videoPlayer.html5Video").length>0){VideoJS.setupAllWhenReady({controlsHiding:false});if(jQuery("#videoPlayer.html5Video video")){VideoJS.player.playerOnVideoEnded=function(event){var theVideo=document.getElementById('theVideo');if(theVideo.webkitDisplayingFullscreen){theVideo.webkitExitFullScreen();}
this.pause();this.currentTime(0);this.hasPlayed=false;_this.displayEndScreen();};VideoJS.player.linksInit=function(){_this.displayVideoErrorScreen();this.element=this.video;};VideoJS.player.playerOnVideoPlay=function(event){if(this.hasPlayed!==true){this.hasPlayed=true;if(navigator.userAgent.match(/iPad|iPhone/i)===null){jQuery('#videoPlayer').animate({'height':'335px'});}
_this.logVideoPlay();}};}}
if(jQuery("#videoPlayer.flashVideo").length>0){var videoPosterUrl=jQuery('#primaryPhoto').attr('src');var videoUrl=jQuery('#featuredVideo').attr('href');flowplayer("featuredVideo",{src:"http://www.homefinder.com/media/flash/listingVideo/emailToFriend.swf",onFail:function(){jQuery('#primaryPhoto').fadeOut('slow');jQuery('#featuredVideo').hide();jQuery('.noFlashScreen .background').fadeIn('slow');jQuery('.noFlashScreen').fadeIn('slow');jQuery('.noFlashScreen .noFlashMessage').fadeIn();}},{playlist:[{url:videoPosterUrl,scaling:"fit"},{url:videoUrl,autoPlay:false}]});}};}
SinglePropertyWebsites.indexController=new SinglePropertyWebsites.IndexController();jQuery(".advertiserWebsiteLink").live("click",function(event){SinglePropertyWebsites.indexController.logViewWebsiteClick(jQuery(this).parents('.personalInformation').find(".advertiserId").text());});jQuery(".virtualTourLink").live("click",function(event){SinglePropertyWebsites.indexController.logVirtualTourClick(jQuery("#listingId").text());});jQuery(".deepLink").live("click",function(event){SinglePropertyWebsites.indexController.logDeepLinkClick(jQuery("#listingId").text());});SinglePropertyWebsites.videoController=new SinglePropertyWebsites.VideoController();jQuery(".endScreen .replayButton").live("click",SinglePropertyWebsites.videoController.replayVideo);jQuery(".endScreen .emailButton").live("click",SinglePropertyWebsites.videoController.displayShareForm);jQuery(".videoLeadForm .cancelButton").live("click",SinglePropertyWebsites.videoController.cancelShareForm);SinglePropertyWebsites.indexController.enableGalleria();SinglePropertyWebsites.googleController=new SinglePropertyWebsites.GoogleController();SinglePropertyWebsites.googleController.callGoogleAnalytics();if(typeof(pinPointPath)!=='undefined'){SinglePropertyWebsites.googleController.setPinPointPath(pinPointPath);}
SinglePropertyWebsites.googleController.setupGoogleMaps(poiArray);SinglePropertyWebsites.advertiserLeadController=new SinglePropertyWebsites.AdvertiserLeadController();jQuery("body").live("advertiserLeadEmailSubmit",SinglePropertyWebsites.advertiserLeadController.sendAdvertiserLeadEmail);SinglePropertyWebsites.homeController=new SinglePropertyWebsites.HomeController();SinglePropertyWebsites.homeController.validateLeadForm();jQuery("#leadForm").live("submit",SinglePropertyWebsites.homeController.sendAdvertiserLeadEmail);jQuery("#leadForm").live("sendAdvertiserLeadEmailSuccess",SinglePropertyWebsites.homeController.sendAdvertiserLeadEmailSuccessHandler);jQuery("#leadForm").live("sendAdvertiserLeadEmailError",SinglePropertyWebsites.homeController.sendAdvertiserLeadEmailErrorHandler);(function($){$.fn.konami=function(fn,params){params=$.extend({},$.fn.konami.params,params);this.each(function(){var tgt=$(this);tgt.bind('konami',fn).bind('keyup',function(event){$.fn.konami.checkCode(event,params,tgt);});});return this;};$.fn.konami.params={'code':[38,38,40,40,37,39,37,39,66,65],'step':0};$.fn.konami.checkCode=function(event,params,tgt){if(event.keyCode==params.code[params.step]){params.step++;}else{params.step=0;}
if(params.step==params.code.length){tgt.trigger('konami');params.step=0;}};})(jQuery);(function($){$.fn.raptorize=function(options){var defaults={enterOn:'click',delayTime:5000};var options=$.extend(defaults,options);return this.each(function(){var _this=$(this);var audioSupported=false;if($.browser.mozilla&&$.browser.version.substr(0,5)>="1.9.2"||$.browser.webkit){audioSupported=true;}
var raptorImageMarkup='<img id="elRaptor" style="display: none" src="/images/raptor.png" />'
var raptorAudioMarkup='<audio id="elRaptorShriek" preload="auto"><source src="/audio/raptor-sound.mp3" /><source src="/audio/raptor-sound.ogg" /></audio>';var locked=false;$('body').append(raptorImageMarkup);if(audioSupported){$('body').append(raptorAudioMarkup);}
var raptor=$('#elRaptor').css({"position":"fixed","bottom":"-700px","right":"0","display":"block"})
function init(){locked=true;if(audioSupported){function playSound(){document.getElementById('elRaptorShriek').play();}
playSound();}
raptor.animate({"bottom":"0"},function(){$(this).animate({"bottom":"-130px"},100,function(){var offset=(($(this).position().left)+400);$(this).delay(300).animate({"right":offset},2200,function(){raptor=$('#elRaptor').css({"bottom":"-700px","right":"0"})
locked=false;})});});}
if(options.enterOn=='timer'){setTimeout(init,options.delayTime);}else if(options.enterOn=='click'){_this.bind('click',function(e){e.preventDefault();if(!locked){init();}})}else if(options.enterOn=='konami-code'){var kkeys=[],konami="38,38,40,40,37,39,37,39,66,65";$(window).bind("keydown.raptorz",function(e){kkeys.push(e.keyCode);if(kkeys.toString().indexOf(konami)>=0){init();$(window).unbind('keydown.raptorz');}},true);}});}})(jQuery);jQuery(document).konami(function(){jQuery('body').raptorize({'enterOn':'timer','delayTime':0});});
