;if(window.jQuery)(function($){if($.browser.msie)try{document.execCommand("BackgroundImageCache",false,true)}catch(e){};$.fn.rating=function(options){if(this.length==0)return this;if(typeof arguments[0]=='string'){if(this.length>1){var args=arguments;return this.each(function(){$.fn.rating.apply($(this),args);});};$.fn.rating[arguments[0]].apply(this,$.makeArray(arguments).slice(1)||[]);return this;};var options=$.extend({},$.fn.rating.options,options||{});$.fn.rating.calls++;this.not('.star-rating-applied').addClass('star-rating-applied').each(function(){var control,input=$(this);var eid=(this.name||'unnamed-rating').replace(/\[|\]/g,'_').replace(/^\_+|\_+$/g,'');var context=$(this.form||document.body);var raters=context.data('rating');if(!raters||raters.call!=$.fn.rating.calls)raters={count:0,call:$.fn.rating.calls};var rater=raters[eid];if(rater)control=rater.data('rating');if(rater&&control)
control.count++;else{control=$.extend({},options||{},($.metadata?input.metadata():($.meta?input.data():null))||{},{count:0,stars:[],inputs:[]});control.serial=raters.count++;rater=$('<span class="star-rating-control"/>');input.before(rater);rater.addClass('rating-to-be-drawn');if(input.attr('disabled'))control.readOnly=true;rater.append(control.cancel=$('<div class="rating-cancel"><a title="'+control.cancel+'">'+control.cancelValue+'</a></div>').mouseover(function(){$(this).rating('drain');$(this).addClass('star-rating-hover');}).mouseout(function(){$(this).rating('draw');$(this).removeClass('star-rating-hover');}).click(function(){$(this).rating('select');}).data('rating',control));};var star=$('<div class="star-rating rater-'+control.serial+'"><a title="'+(this.title||this.value)+'">'+this.value+'</a></div>');rater.append(star);if(this.id)star.attr('id',this.id);if(this.className)star.addClass(this.className);if(control.half)control.split=2;if(typeof control.split=='number'&&control.split>0){var stw=($.fn.width?star.width():0)||control.starWidth;var spi=(control.count%control.split),spw=Math.floor(stw/control.split);star.width(spw).find('a').css({'margin-left':'-'+(spi*spw)+'px'})};if(control.readOnly)
star.addClass('star-rating-readonly');else
star.addClass('star-rating-live').mouseover(function(){$(this).rating('fill');$(this).rating('focus');}).mouseout(function(){$(this).rating('draw');$(this).rating('blur');}).click(function(){$(this).rating('select');});if(this.checked)control.current=star;input.hide();input.change(function(){$(this).rating('select');});star.data('rating.input',input.data('rating.star',star));control.stars[control.stars.length]=star[0];control.inputs[control.inputs.length]=input[0];control.rater=raters[eid]=rater;control.context=context;input.data('rating',control);rater.data('rating',control);star.data('rating',control);context.data('rating',raters);});$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');return this;};$.extend($.fn.rating,{calls:0,focus:function(){var control=this.data('rating');if(!control)return this;if(!control.focus)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.focus)control.focus.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},blur:function(){var control=this.data('rating');if(!control)return this;if(!control.blur)return this;var input=$(this).data('rating.input')||$(this.tagName=='INPUT'?this:null);if(control.blur)control.blur.apply(input[0],[input.val(),$('a',input.data('rating.star'))[0]]);},fill:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;this.rating('drain');this.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-hover');},drain:function(){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.rater.children().filter('.rater-'+control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');},draw:function(){var control=this.data('rating');if(!control)return this;this.rating('drain');if(control.current){control.current.data('rating.input').attr('checked','checked');control.current.prevAll().andSelf().filter('.rater-'+control.serial).addClass('star-rating-on');}
else
$(control.inputs).removeAttr('checked');control.cancel[control.readOnly||control.required?'hide':'show']();this.siblings()[control.readOnly?'addClass':'removeClass']('star-rating-readonly');},select:function(value,wantCallBack){var control=this.data('rating');if(!control)return this;if(control.readOnly)return;control.current=null;if(typeof value!='undefined'){if(typeof value=='number')
return $(control.stars[value]).rating('select',undefined,wantCallBack);if(typeof value=='string')
$.each(control.stars,function(){if($(this).data('rating.input').val()==value)$(this).rating('select',undefined,wantCallBack);});}
else
control.current=this[0].tagName=='INPUT'?this.data('rating.star'):(this.is('.rater-'+control.serial)?this:null);this.data('rating',control);this.rating('draw');var input=$(control.current?control.current.data('rating.input'):null);if((wantCallBack||wantCallBack==undefined)&&control.callback)control.callback.apply(input[0],[input.val(),$('a',control.current)[0]]);},readOnly:function(toggle,disable){var control=this.data('rating');if(!control)return this;control.readOnly=toggle||toggle==undefined?true:false;if(disable)$(control.inputs).attr("disabled","disabled");else $(control.inputs).removeAttr("disabled");this.data('rating',control);this.rating('draw');},disable:function(){this.rating('readOnly',true,true);},enable:function(){this.rating('readOnly',false,false);}});$.fn.rating.options={cancel:'Cancel Rating',cancelValue:'',split:0,starWidth:16};$(function(){$('input[type=radio].star').rating();});})(jQuery);;$(document).ready(function(){$("#ui-dialog-title-vip-feedback-content").css({'font-size':'10px','color':'#fff'});$("#vip-feedback-content").css({'font-size':'10px','color':'#000','height':'auto'});$("#vip-feedback-tab").click(function(){$("input[name='starrate']:checked").attr("checked",false);$("#feedback-2-step").hide();$("#feedback-wait").hide();$("#feedback-1-step").show();$("#feedback_email").css("background-color","#fff").css("color","#000");$("#hover-test").html("");$("#comments").html("");$("#salesman").html("");$(".star-rating").removeClass("star-rating-on");$("#vip-feedback-content").dialog({resizable:false,height:470,width:400,modal:true,closeOnEscape:false,open:function(event,ui){},close:function(event,ui){$(this).dialog('destroy');},buttons:{'Exit':function(){$(this).dialog('close');$(this).dialog('destroy');},'Send Feedback':function(){if(validateFeedback()){$("#feedback-1-step").hide();$("#feedback-wait").show();starrate=$("input[name='starrate']:checked").val();salesman=$("#feedback_salesman").val();comments=$("#feedback_comments").val();email=$("#feedback_email").val();name=$("#feedback_name").val();timerate=$("input[name='timerate']:checked").val();$.post(post_url,{starrate:starrate,salesman:salesman,comments:comments,email:email,name:name,timerate:timerate,feedback_action:"send"},function(data){$("#feedback-wait").hide();$("#feedback-2-step").show();$("#vip-feedback-content").parent().find("button.ui-state-default:contains('Send Feedback')").hide();},"json");}}}});$('.hover-star').rating({focus:function(value,link){var tip=$('#hover-test');tip[0].data=tip[0].data||tip.html();tip.html(link.title||'value: '+value);},blur:function(value,link){var tip=$('#hover-test');$('#hover-test').html(tip[0].data||'');}});$('.hover-star2').rating({focus:function(value,link){var tip=$('#hover-test2');tip[0].data=tip[0].data||tip.html();tip.html(link.title||'value: '+value);},blur:function(value,link){var tip=$('#hover-test2');$('#hover-test2').html(tip[0].data||'');}});});});$("#vip-feedback-tab").live("click",feedbackdata);function feedbackdata(){$.post(baseurl+"/components/com_php/files/feedback-ajax.php",{OurOffice:"true"},function(data){var flnames="<option value=\"0\">Please select your sales person</option>";$(data).each(function(i){flnames+="<option value=\""+this.id+"\">"
+this.first_name+" "+this.last_name+"</option>";});$("#feedback_salesman").html(flnames);},"json");}
function validateFeedback(){var valid=true;validEmail=isValidEmailAddress($("#feedback_email").val());if($("input[name='starrate']:checked").val()==undefined){$("#hover-test").html("<strong style=\"color: #E91712;\">Please rate our services!</strong>");valid=false;}else{$("#hover-test").html("");}
if($("input[name='timerate']:checked").val()==undefined){$("#hover-test2").html("<strong style=\"color: #E91712;\">Please rate our sales manager response time!</strong>");valid=false;}else{$("#hover-test2").html("");}
if(($("#feedback_email").val()=="")||(!(validEmail))){$("#feedback_email").css({'background':'#E91712','color':'#fff'});valid=false;}else{$("#feedback_email").css({'background':'#FFF','color':'#000'});}
if($("#feedback_name").val()==""){$("#feedback_name").css({'background':'#E91712','color':'#fff'});valid=false;}else{$("#feedback_name").css({'background':'#FFF','color':'#000'});}
if($("#feedback_comments").val()==""){$("#feedback_comments").css({'background':'#E91712','color':'#fff'});valid=false;}else{$("#feedback_comments").css({'background':'#FFF','color':'#000'});}
if($("#feedback_salesman").val()=="0"){$("#feedback_salesman").css({'background':'#E91712','color':'#fff'});valid=false;}else{$("#feedback_salesman").css({'background':'#FFF','color':'#000'});}
if(valid){return true;}else return false;}
function isValidEmailAddress(emailAddress){var pattern=new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);return pattern.test(emailAddress);}
