
RegisterNamespace("VP.Search");VP.Search.SearchFor=function(){var searchText=VP.Search.FormatSearchText();if(searchText!=""){var searchResultsPageUrl=$('#hdnSearchResultsPageUrl').val()+'?search='+searchText;$("form").attr("action",searchResultsPageUrl);$("form").submit();}};VP.Search.KeyPress=function(event){if(event.keyCode==13||event.which==13){VP.Search.SearchFor();event.returnValue=false;event.cancel=true;event.keyCode=0;return false;}};VP.Search.FormatSearchText=function(){var searchText=$("#txtSearchFor").val();searchText=searchText.replace(/</g,'');searchText=searchText.replace(/>/g,'');searchText=searchText.replace(/^\s+/,'');if(searchText!=""){searchText=escape(searchText);}
if(searchText==""){$("#txtSearchFor").val(searchText)}
return searchText;};;RegisterNamespace("VP.Login");VP.Login.ModalDialog;VP.Login.CurrentPageUrl;VP.Login.SiteUrl;VP.Login.PasswordResetPageUrl;VP.Login.RegisterFields=new Array();VP.Login.IsValidateAllPages=false;VP.Login.ValidatePageId;VP.Login.Initialize=function(){$(document).ready(function(){VP.Login.ModalDialog=$("#modalPopup");VP.Login.ModalDialog.jqm({modal:true});$(".loginPopup").click(function(){if($(".loginPopup").text()=="Login"){VP.Login.ShowLoginDialog();}
else{VP.Login.Logout();}});$(".registerPopup").click(function(){VP.Login.ShowRegisterDialog();});$(document).keyup(function(event){if(event.keyCode==27){VP.Login.HideDialog();}});});};VP.Login.ShowDialog=function(top){VP.Login.ModalDialog.empty();VP.Login.ModalDialog.css("top",top);VP.Login.ModalDialog.jqmShow();};VP.Login.HideDialog=function(){VP.Login.ModalDialog.jqmHide();};VP.Login.ShowLoginDialog=function(email){VP.Login.ShowDialog("30%");$.ajax({type:"POST",async:false,cache:false,url:VP.AjaxWebServiceUrl+"/GetLoginHtml",data:"{}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){VP.Login.ModalDialog.append(msg.d);VP.Login.SetLoginProperties(email);VP.Login.BindToLoginEvents();}});};VP.Login.ShowRegisterDialog=function(){VP.Login.ShowDialog("5%");var pageId='p_0';$.ajax({type:"POST",async:false,cache:false,url:VP.AjaxWebServiceUrl+"/GetRegisterUserHtml",data:"{'SiteId':'"+VP.SiteId+"','PageId':'"+pageId+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){VP.Login.ModalDialog.append(msg.d);VP.Login.SetRegisterProperties(pageId);VP.Login.BindToRegisterEvents();}});};VP.Login.SetLoginProperties=function(email){if(email!=null){$("#txtEmail",VP.Login.ModalDialog).val(email);$("#txtPassword",VP.Login.ModalDialog).focus();}
else{$("#txtEmail",VP.Login.ModalDialog).focus();}};VP.Login.SetRegisterProperties=function(pageId){VP.Login.ShowPage(pageId);VP.Login.RegisterFields=$("#hiddenFields",VP.Login.ModalDialog).text().split(',');};VP.Login.StopEventPropagation=function(event){if(event.stopPropagation){event.stopPropagation();}
else{event.cancelBubble=true;}};VP.Login.BindToLoginEvents=function(){$("div.login",VP.Login.ModalDialog).unbind("keypress").keypress(function(event){VP.Login.KeyPressEvent(event,"btnLogin");VP.Login.StopEventPropagation(event);});$("div.forgotPassword",VP.Login.ModalDialog).unbind("keypress").keypress(function(event){VP.Login.KeyPressEvent(event,"btnForgotPassword");VP.Login.StopEventPropagation(event);});$("#btnLogin",VP.Login.ModalDialog).click(function(){VP.Login.ClearPasswordResetControls();$("#loginMessage",VP.Login.ModalDialog).text("");if(VP.Login.ValidateLogin()){VP.Login.Authenticate();}});$("#btnForgotPassword",VP.Login.ModalDialog).click(function(){VP.Login.ClearLoginControls();$("#forgotPasswordMessage",VP.Login.ModalDialog).text("");if(VP.Login.ValidateResetPassword()){VP.Login.ResetPassword();}});$("#btnCancelLogin",VP.Login.ModalDialog).click(function(){VP.Login.HideDialog();});};VP.Login.BindToRegisterEvents=function(){VP.Login.ModalDialog.unbind("keypress").keypress(function(event){if(event.which==13){VP.Login.Register("p_0");event.returnValue=false;event.cancel=true;event.keyCode=0;return false;}});};VP.Login.KeyPressEvent=function(event,controlIdToClick){if(event.which==13){$("#"+controlIdToClick,VP.Login.ModalDialog).click();event.returnValue=false;event.cancel=true;event.keyCode=0;return false;}};VP.Login.ClearPasswordResetControls=function(){$("#txtForgotPasswordEmail",VP.Login.ModalDialog).val("");$("#rfvForgotPasswordEmail",VP.Login.ModalDialog).text("").css("display","none");$("#forgotPasswordMessage",VP.Login.ModalDialog).text("");};VP.Login.ClearLoginControls=function(){$("#txtEmail",VP.Login.ModalDialog).val("");$("#rfvEmail",VP.Login.ModalDialog).text("").css("display","none");$("#txtPassword",VP.Login.ModalDialog).val("");$("#rfvPassword",VP.Login.ModalDialog).text("").css("display","none");$("#loginMessage",VP.Login.ModalDialog).text("");};VP.Login.SetCookie=function(cookieValue){document.cookie="VpLogin="+cookieValue+"; path=/";};VP.Login.RedirectToCurrentPage=function(){window.location=VP.Login.CurrentPageUrl;};VP.Login.Authenticate=function(){$.ajax({type:"POST",url:VP.AjaxWebServiceUrl+"/Authenticate",async:false,cache:false,data:"{'email':'"+$('#txtEmail',VP.Login.ModalDialog).val()+"','password':'"+$('#txtPassword',VP.Login.ModalDialog).val()+"','siteId':'"+VP.SiteId+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){if(msg.d==""){$("#loginMessage",VP.Login.ModalDialog).text("Login failed");$("#txtPassword",VP.Login.ModalDialog).val("");}
else{VP.Login.SetCookie(msg.d);VP.Login.HideDialog();VP.Login.RedirectToCurrentPage();}}});};VP.Login.Logout=function(){var date=new Date();date.setTime(date.getTime()+(-2*24*60*60*1000));document.cookie="VpLogin=sometghing; expires="+date.toGMTString()+"; path=/";window.location=VP.Login.CurrentPageUrl;};VP.Login.ResetPassword=function(){$.ajax({type:"POST",url:VP.AjaxWebServiceUrl+"/ResetPassword",async:false,cache:false,data:"{'email':'"+$('#txtForgotPasswordEmail',VP.Login.ModalDialog).val()+"','siteId' : '"+VP.SiteId+"','siteHomeUrl':'"+VP.Login.SiteUrl+"','passwordResetUrl':'"+VP.Login.PasswordResetPageUrl+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){$("#forgotPasswordMessage",VP.Login.ModalDialog).text(msg.d);$("#txtForgotPasswordUserName",VP.Login.ModalDialog).val("");$("#txtForgotPasswordEmail",VP.Login.ModalDialog).val("");}});};VP.Login.Register=function(pageId){if(VP.Login.ValidateRegister(pageId)){var registerFormData=VP.Login.GetRegisterFormData();$.ajax({type:"POST",url:VP.AjaxWebServiceUrl+"/RegisterPublicUser",async:false,cache:false,data:"{'args':'"+registerFormData+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){var flag=msg.d.charAt(0);if(flag=="-"){var message=msg.d.substring(1,msg.d.length)
$("#modalPopup .formList").append("<li id='errorMessage'>"+
message+"</li>");}
else{VP.Login.SetCookie(msg.d);VP.Login.HideDialog();VP.Login.RedirectToCurrentPage();}},error:function(XMLHttpRequest,textStatus,errorThrown){$(".formList",VP.Login.ModalDialog).append("<li id='errorMessage'>User creation failed. Please try again later</li>");}});}};VP.Login.ValidateLogin=function(){var isValid=true;isValid=VP.Login.ValidateEmail("txtEmail","rfvEmail")&&isValid;isValid=VP.Login.ValidateTextBox("txtPassword","rfvPassword")&&isValid;return isValid;};VP.Login.ValidateResetPassword=function(){var isValid=true;isValid=VP.Login.ValidateEmail("txtForgotPasswordEmail","rfvForgotPasswordEmail")&&isValid;return isValid;};VP.Login.ValidateRegister=function(pageId){VP.Login.IsValidateAllPages=true;VP.Login.ValidatePageId=pageId;return VP.Login.ValidateRegisterFormData();};VP.Login.ValidateRegisterPage=function(pageId){VP.Login.IsValidateAllPages=false;VP.Login.ValidatePageId=pageId;return VP.Login.ValidateRegisterFormData();};VP.Login.ValidateRegisterFormData=function(){VP.Login.ClearAllErrorMessages();var isValidate=VP.Login.ClientValidate();if(!isValidate){$(".formList",VP.Login.ModalDialog).prepend("<li id='errorMessage'>"+
$("#"+VP.Login.ValidatePageId,VP.Login.ModalDialog).find(".hiddenPageError").html()+"</li>");}
return isValidate;};VP.Login.ValidateEmail=function(textboxId,validatorId){var isValid=VP.Login.ValidateTextBox(textboxId,validatorId);if(isValid){var regularExpression=new RegExp(VP.EmailRegEx);if($("#"+textboxId,VP.Login.ModalDialog).val().match(regularExpression)){return true;}
else{$("#"+validatorId,VP.Login.ModalDialog).text("Invalid email").css("display","inline");}
return false;}
return isValid;};VP.Login.ValidateTextBox=function(textboxId,validatorId){if($("#"+textboxId,VP.Login.ModalDialog).val()==""){$("#"+validatorId,VP.Login.ModalDialog).text("*").css("display","inline");return false;}
else{$("#"+validatorId,VP.Login.ModalDialog).css("display","none");return true;}};VP.Login.PreviousPage=function(pageId){VP.Login.ClearAllErrorMessages();var pages=$(".formHolder",VP.Login.ModalDialog);var prevPageId=null;for(var i=0;i<pages.length;i++){var currentPageId=$(pages[i]).attr('id');if(currentPageId==pageId){if(prevPageId!=null){VP.Login.ShowPage(prevPageId);page=prevPageId;break;}}
prevPageId=currentPageId;}
return false;};VP.Login.NextPage=function(pageId){if(VP.Login.ValidateRegisterPage(pageId)){var pages=$(".formHolder",VP.Login.ModalDialog);var isNextPage=false;for(var i=0;i<pages.length;i++){var currentPageId=$(pages[i]).attr('id');if(isNextPage){VP.Login.ShowPage(currentPageId);page=currentPageId;break;}
if(currentPageId==pageId){isNextPage=true;}}}
return false;};VP.Login.ShowPage=function(pageId){var pages=$(".formHolder",VP.Login.ModalPopup);for(var i=0;i<pages.length;i++){if($(pages[i]).attr('id')==pageId){$(pages[i]).show();}
else{$(pages[i]).hide();}}};VP.Login.ValidateField=function(fieldType,controlId,listId,isRequired,requiredErrorMessage,shouldMatchRegex,regularExpression,regularExpressionErrorMessage,pageId){var isValidate=true;if(isRequired){isValidate=VP.Login.ValidateRequiredField(fieldType,controlId,listId,requiredErrorMessage,pageId);}
if(isValidate&&shouldMatchRegex){isValidate=VP.Login.ValidateRegularExpressionField(fieldType,controlId,listId,regularExpression,regularExpressionErrorMessage,pageId);}
return isValidate;};VP.Login.ValidateRequiredField=function(fieldType,controlId,listId,requiredErrorMessage,pageId){switch(fieldType){case 1:return VP.Login.ValidateDropdownInput(controlId,listId,requiredErrorMessage,pageId);case 2:case 5:case 12:return VP.Login.ValidateTextboxInput(controlId,listId,requiredErrorMessage,pageId);case 3:return VP.Login.ValidateCheckboxlistInput(controlId,listId,requiredErrorMessage,pageId);}
return true;};VP.Login.ValidateRegularExpressionField=function(fieldType,controlId,listId,regularExpression,regularExpresionErrorMessage,pageId){switch(fieldType){case 2:case 5:case 12:return VP.Login.ValidateRegularExpression(controlId,listId,regularExpression,regularExpresionErrorMessage,pageId);}
return true;};VP.Login.ClearAllErrorMessages=function(){$(".formList",VP.Login.ModalDialog).find("#errorMessage").remove();$(".formList li",VP.Login.ModalDialog).removeClass("error").find(".error").remove();};VP.Login.ClearErrorMessage=function(listId){$("#"+listId,VP.Login.ModalDialog).removeClass("error").find(".error").remove();};VP.Login.AddErrorMessage=function(listId,errorMessage,pageId){if(VP.Login.ModalDialog.find("#"+listId+" p.error").length==0){VP.Login.ModalDialog.find("#"+listId).addClass("error").append("<p class=\"error\">"+errorMessage+"</p>");}
else{VP.Login.ModalDialog.find("#"+listId+" p.error").append("<br />"+errorMessage);}};VP.Login.ValidateRegularExpression=function(controlId,listId,regularExpression,errorMessage,pageId){if(VP.Login.ShouldValidate(controlId,pageId)){var val=$("#modalPopup #"+controlId).val();var regex=null;try{regex=new RegExp(regularExpression,"i");}
catch(err){return true;}
if(val.match(regex)!=null){return true;}
else{if(errorMessage==""){errorMessage="Value not in correct format";}
VP.Login.AddErrorMessage(listId,errorMessage);return false;}}
else{return true;}};VP.Login.ShouldValidate=function(controlId,pageId){if(!VP.Login.IsValidateAllPages){var control=$("#"+VP.Login.ValidatePageId+" #"+controlId,VP.Login.ModalDialog);if(control.length==0){return false;}}
return true;};VP.Login.ValidateTextboxInput=function(controlId,listId,errorMessage,pageId){if(VP.Login.ShouldValidate(controlId,pageId)){var val=$("#"+controlId,VP.Login.ModalDialog).val();if(val==""){if(errorMessage==""){errorMessage="This field is required";}
VP.Login.AddErrorMessage(listId,errorMessage);return false;}
else{return true;}}
else{return true;}};VP.Login.ValidateDropdownInput=function(controlId,listId,errorMessage,pageId){if(VP.Login.ShouldValidate(controlId,pageId)){var val=$("#"+controlId,VP.Login.ModalDialog).val();if(val==""){if(errorMessage==""){errorMessage="This field is required";}
VP.Login.AddErrorMessage(listId,errorMessage);return false;}
else{return true;}}
else{return true;}};VP.Login.RegisterDatePicker=function(datePickerId,startYear,endYear){$(document).ready(function(){$("#"+datePickerId,VP.Login.ModalDialog).datepicker({changeYear:true,yearRange:startYear+':'+endYear});});};VP.Login.ValidateCheckboxlistInput=function(controlId,listId,errorMessage,pageId){if(!isAllErrors){var chk=$("#"+validationPageId+" #"+listId+" input[type=checkbox]",VP.Login.ModalDialog);if(chk.length==0){return true;}}
var status=false;var chkArray=$("#"+listId+" input[type=checkbox]",VP.Login.ModalDialog);for(var i=0;i<chkArray.length;i++){status=$(chkArray[i]).attr('checked')||status;}
if(status==false){if(errorMessage==""){errorMessage="This field is required";}
VP.Login.AddErrorMessage(listId,errorMessage);}
return status;};VP.Login.CheckEmail=function(id,listId){var email=$("#"+id,VP.Login.ModalDialog).val();VP.Login.ClearErrorMessage(listId);if(email!=""){var regularExpression=new RegExp(VP.EmailRegEx);if(email.match(regularExpression)){$.ajax({type:"POST",async:false,cache:false,url:VP.AjaxWebServiceUrl+"/IsUserExist",data:"{'email' : '"+email+"','siteId' : '"+VP.SiteId+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){if(msg.d){VP.Login.AddErrorMessage(listId,"This email is already taken. Please provide another");}}});}}};VP.Login.ValidateRegistrationConfirmPassword=function(password,confirmPassword,pwdListId,cnfPwdListId){if($("#"+password,VP.Login.ModalDialog).val()==$("#"+confirmPassword,VP.Login.ModalDialog).val()){return true;}
else{if(VP.Login.ModalDialog.find("#"+cnfPwdListId+" p.error").length==0){VP.Login.AddErrorMessage(cnfPwdListId,"Passwords does not match");$("#"+password,VP.Login.ModalDialog).val("");$("#"+confirmPassword,VP.Login.ModalDialog).val("");VP.Login.ModalDialog.find("#"+pwdListId).addClass("error");}
return false;}};VP.Login.GetRegisterFormData=function(){var registerFormValues=VP.SiteId;for(var i=0;i<VP.Login.RegisterFields.length;i++){var fieldData=new Array();fieldData=VP.Login.RegisterFields[i].split(":");var fieldType=fieldData[2];switch(fieldType){case"1":if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
else{registerFormValues+=";"+fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
break;case"2":if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
else{registerFormValues+=";"+fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
break;case"3":var checkBoxes=$("#"+fieldData[1]+" .checkbox",VP.Login.ModalDialog);var selectedValues;for(var j=0;j<checkBoxes.length;j++){if(checkBoxes[j].checked){if(typeof(selectedValues)=='undefined'){selectedValues=checkBoxes[j].value;}
else{selectedValues=selectedValues+"|"+checkBoxes[j].value;}}}
if(typeof(selectedValues)=='undefined'){selectedValues="";}
if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+selectedValues;}
else{registerFormValues=";"+fieldData[0]+":"+selectedValues;}
break;case"5":if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
else{registerFormValues=";"+fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
break;case"6":var radioBtns=$("#"+fieldData[1]+" .radio",VP.Login.ModalDialog);for(var j=0;j<radioBtns.length;j++){if(radioBtns[j].checked){if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+radioBtns[j].value;}
else{registerFormValues+=";"+fieldData[0]+":"+radioBtns[j].value;}}}
break;case"12":if(typeof(registerFormValues)=='undefined'){registerFormValues=fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
else{registerFormValues+=";"+fieldData[0]+":"+$("#"+fieldData[1],VP.Login.ModalDialog).val();}
break;}}
return registerFormValues;};VP.Login.Initialize();RegisterNamespace("VP.NavigationMenu");VP.NavigationMenu.CurrentPageTitle="";VP.NavigationMenu.Initialize=function(){$(document).ready(function(){var menuItems=$(".menuLink");var menuIndex;for(var index=0;index<menuItems.length;index++){var title=$(menuItems[index]).attr('title');$(menuItems[index]).addClass(title.replace(/ /gi,""));if(title==VP.NavigationMenu.CurrentPageTitle){$(menuItems[index]).parent().addClass("active");menuIndex=index;}}
$('body').trigger({type:'menuReady',menuItems:menuItems,menuIndex:menuIndex});});}
VP.NavigationMenu.Initialize();RegisterNamespace("VP.VerticalMatrix");VP.VerticalMatrix.listSeperator="";VP.VerticalMatrix.compareMatrixPageUrl="";VP.VerticalMatrix.SelectAllText="";VP.VerticalMatrix.SelectNoneText="";VP.VerticalMatrix.LeadFormUrlForAll="";VP.VerticalMatrix.LeadFormUrlForSelected="";VP.VerticalMatrix.ContentIdParameter="";VP.VerticalMatrix.VerticalMatrixPageUrl="";VP.VerticalMatrix.ItemNameSortDisplayName="";VP.VerticalMatrix.ItemNameSortText="";VP.VerticalMatrix.CompanyNameSortDisplayName="";VP.VerticalMatrix.CompanyNameSortText="";VP.VerticalMatrix.PriceSortDisplayName="";VP.VerticalMatrix.PriceSortText="";VP.VerticalMatrix=function()
{this.matrixContent="";this.checkboxList="";this.requestInfoButtons="";this.selectAllButtons="";this.hiddenProductListId="";this.dropDownSelectedValue="";this.requestInfoLinks="";}
VP.VerticalMatrix.prototype.Init=function(matrixContentId){this.matrixContent=$("#"+matrixContentId);this.checkboxList=$("input:checkbox.action",this.matrixContent);this.requestInfoButtons=$(".btnRequestQuote",this.matrixContent);this.selectAllButtons=$(".selectAll",this.matrixContent);this.requestInfoLinks=$(".requestSelected",this.matrixContent);var that=this;$(this.checkboxList).click(function(event){that.AddRemoveProduct($(this));});$(this.selectAllButtons).click(function(event){that.SelectAll($(this).text());return false;});$(this.requestInfoButtons).click(function(event){that.RequestInfomationForMultipeProduct();});$(this.requestInfoLinks).click(function(event){that.RequestInfomationForMultipeProduct();});$(".btnCompare",this.matrixContent).click(function(event){that.Compare();return false;});$(".compare",this.matrixContent).click(function(event){that.Compare();return false;});$("#selectTop",this.matrixContent).change(function(event){that.Sort($("#selectTop",this.matrixContent).val());});$("#lnkService",this.matrixContent).click(function(event){that.Sort(VP.VerticalMatrix.CompanyNameSortDisplayName);});$("#lnkProduct",this.matrixContent).click(function(event){that.Sort(VP.VerticalMatrix.ItemNameSortDisplayName);});$("#lnkVendor",this.matrixContent).click(function(event){that.Sort(VP.VerticalMatrix.CompanyNameSortDisplayName);});$("#lnkPrice",this.matrixContent).click(function(event){that.Sort(VP.VerticalMatrix.PriceSortDisplayName);});$(".pager a",this.matrixContent).click(function(event){that.AddSelectedProductsToLink($(this));});$("ul.selected li",this.matrixContent).live('click',function(event){var productId=$(event.currentTarget).attr('rel')
if(productId!=undefined){that.checkboxList.each(function(i,domElement){if($(domElement).val()==productId){$(domElement).removeAttr("checked");}});that.RemoveFromSelectedProducts(productId);that.SetLeadFormUrlForRequestInfomation();that.ChangeSelectButtonText();}
return false;});this.SetSelectedSortValue();this.SetCheckBoxValues();this.SetLeadFormUrlForRequestInfomation();this.ChangeSelectButtonText();};VP.VerticalMatrix.prototype.Sort=function(text)
{var sortText;if(text==VP.VerticalMatrix.CompanyNameSortDisplayName)
{sortText=VP.VerticalMatrix.CompanyNameSortText;}
else if(text==VP.VerticalMatrix.PriceSortDisplayName)
{sortText=VP.VerticalMatrix.PriceSortText;}
else if(text==VP.VerticalMatrix.ItemNameSortDisplayName)
{sortText=VP.VerticalMatrix.ItemNameSortText;}
else
{sortText="";}
var navigateUrl=VP.VerticalMatrix.VerticalMatrixPageUrl+"?sortby="+sortText;var productList=$("#"+this.hiddenProductListId).val();if(productList!="")
{navigateUrl+="&sel="+$("#"+this.hiddenProductListId).val();}
location.href=navigateUrl;};VP.VerticalMatrix.prototype.SetSelectedSortValue=function()
{$("#selectTop",this.matrixContent).val(this.dropDownSelectedValue);};VP.VerticalMatrix.prototype.SetCheckBoxValues=function(){if($("#"+this.hiddenProductListId).val()==""){return;}
var selectedProducts=$("#"+this.hiddenProductListId).val().split(VP.VerticalMatrix.listSeperator);var nextTextForButton="";var productId;for(var i=0;i<selectedProducts.length;i++){productId=selectedProducts[i];for(var j=0;j<this.checkboxList.length;j++){if($(this.checkboxList[j]).val()==productId){$(this.checkboxList[j]).attr('checked','checked');}}}};VP.VerticalMatrix.prototype.AddRemoveProduct=function(checkBox)
{var status=$(checkBox).attr('checked');var productId=$(checkBox).val();if(status)
{this.AddToSelectedProducts(productId);}
else
{this.RemoveFromSelectedProducts(productId);}
this.SetLeadFormUrlForRequestInfomation();this.ChangeSelectButtonText();return true;};VP.VerticalMatrix.prototype.Compare=function(){var hdnValue=$("#"+this.hiddenProductListId).val();var selectedProducts=hdnValue.split(VP.VerticalMatrix.listSeperator);if(hdnValue==""){alert("Please select at least one product");}
else if(selectedProducts.length>5){alert("No more than five items can be selected. This could happen if there are multiple item "
+"pages and you have selected items on other pages");}
else{location.href=VP.VerticalMatrix.compareMatrixPageUrl+"&compare="
+$("#"+this.hiddenProductListId).val();}};VP.VerticalMatrix.prototype.AddSelectedProductsToLink=function(PagerLink)
{var url=this.AddSelectedProductsToUrl(PagerLink.attr('href'));PagerLink.attr('href',url);return true;};VP.VerticalMatrix.prototype.AddSelectedProductsToUrl=function(url)
{var urlComponents=url.split("&");var foundSelect=false;var productList=$("#"+this.hiddenProductListId).val();for(var i=0;i<urlComponents.length;i++)
{if(urlComponents[i].indexOf("sel=")>=0)
{urlComponents[i]="sel="+productList;foundSelect=true;}}
if(foundSelect)
{url=urlComponents.join("&");}
else{url+="&sel="+productList;}
return url;};VP.VerticalMatrix.prototype.AddToSelectedProducts=function(productId){var selectedProducts=$("#"+this.hiddenProductListId).val().split(VP.VerticalMatrix.listSeperator);if(this.FoundElementInArray(selectedProducts,productId)){return false;}
else{if($("#"+this.hiddenProductListId).val()==""){$("#"+this.hiddenProductListId).val(productId);}
else{var productList=$("#"+this.hiddenProductListId).val()+VP.VerticalMatrix.listSeperator+productId;$("#"+this.hiddenProductListId).val(productList);}}};VP.VerticalMatrix.prototype.RemoveFromSelectedProducts=function(productId){var selectedProducts=$("#"+this.hiddenProductListId).val().split(VP.VerticalMatrix.listSeperator);var newProductList="";var index=0;for(var i=0;i<selectedProducts.length;i++){if(selectedProducts[i]!=productId){if(index>0){newProductList+=VP.VerticalMatrix.listSeperator;}
newProductList+=selectedProducts[i];index++;}}
$("#"+this.hiddenProductListId).val(newProductList);};VP.VerticalMatrix.prototype.FoundElementInArray=function(array,elementValue)
{for(var i=0;i<array.length;i++)
{if(array[i]==elementValue)
{return true;}}
return false;};VP.VerticalMatrix.prototype.RequestInfomationForMultipeProduct=function()
{if($("#"+this.hiddenProductListId).val()=="")
{alert("Please select at least one product");return false;}};VP.VerticalMatrix.prototype.SetLeadFormUrlForRequestInfomation=function()
{if($("#"+this.hiddenProductListId).val()=="")
{$(this.requestInfoButtons).attr('href',"#");$(this.requestInfoLinks).attr('href',"#");}
else
{var leadFormUrl=VP.VerticalMatrix.LeadFormUrlForSelected;var oldValue=VP.VerticalMatrix.ContentIdParameter+"=";var newValue=oldValue+$("#"+this.hiddenProductListId).val();var navigateUrl=leadFormUrl.replace(oldValue,newValue);for(var i=0;i<this.requestInfoButtons.length;i++)
{$(this.requestInfoButtons[i]).attr('href',navigateUrl);}
for(var j=0;j<this.requestInfoLinks.length;j++)
{$(this.requestInfoLinks[j]).attr('href',navigateUrl);}}};VP.VerticalMatrix.prototype.SelectAll=function(buttonText)
{var nextTextForButton="";for(var i=0;i<this.checkboxList.length;i++)
{if(buttonText==VP.VerticalMatrix.SelectAllText)
{this.checkboxList[i].checked=true;this.AddToSelectedProducts(this.checkboxList[i].value);}
else{this.checkboxList[i].checked=false;this.RemoveFromSelectedProducts(this.checkboxList[i].value);}}
this.SetLeadFormUrlForRequestInfomation();this.ChangeSelectButtonText();};VP.VerticalMatrix.prototype.ChangeSelectButtonText=function()
{var noOfCheckedOnPage=0;for(var i=0;i<this.checkboxList.length;i++)
{if(this.checkboxList[i].checked==true)
{noOfCheckedOnPage=noOfCheckedOnPage+1;}}
if(noOfCheckedOnPage<this.checkboxList.length)
{$(this.selectAllButtons).text(VP.VerticalMatrix.SelectAllText);}
else{$(this.selectAllButtons).text(VP.VerticalMatrix.SelectNoneText);}};(function($){$(document).ready(function(){$('.functionPanel').vpMatrixImages({context:$.vp.domFragments.contentPane});buildToolTip();});function buildToolTip(domElement){$('.productRow').each(function(i,domElement){if($(domElement).find('.imageHolder').length>0){var newImage=$(domElement).find('.imageHolder').html().replace(/52/gi,"400").replace(/39/gi,"300");var titleHTML=$(domElement).find('.title h3').html();var productHref=$(titleHTML).attr('href');var titleText=$(domElement).find('.title h3').text();var vendor=$(domElement).find('.title h4').text();var related=$(domElement).find('.related').html();var action=$(domElement).find('.leadActions').html();var tipContent='<div class="zoomedContent"><div class="image">'+newImage+'</div><div class="actions module"><a class="productLink" href="'+productHref+'">View Details Page</a>'+action+'</div></div>';var textTop="";if(vendor!=""){textTop=titleHTML+' from '+vendor;}
$(domElement).find('.imageHolder').append('<span class="icon zoom compact">Zoom In</span>');$(domElement).find('.imageHolder').hover(function(event){$(event.currentTarget).find('.zoom').fadeIn(200);},function(event){$(event.currentTarget).find('.zoom').fadeOut(200);});$(domElement).find("img").qtip({content:{prerender:false,title:{text:textTop,button:"Close"},text:tipContent},position:{corner:{tooltip:"leftMiddle",target:"rightMiddle"}},show:{delay:0,when:false,solo:true},hide:'unfocus',style:{border:{width:5,radius:10},padding:10,textAlign:'left',tip:true,name:'light',width:442}});$(domElement).find('.zoom').click(function(event){$(event.currentTarget).parents(".imageHolder").find('img').qtip("show");});}});}})(jQuery);;(function($){_options={};_isFirstTime=true;_checkBoxes={};_productList={};_imageLists={};_containers={};_hasMessageShown=false;_imageCartItems=new Array();vpMatrixImages=jQuery.fn.vpMatrixImages=function(options){_options=$.extend({},$.fn.vpMatrixImages.defaults,options);_checkBoxes=$(_options.context).find(':checkbox').click(itemChecked);_productList=$(_options.context).find('div.productRow');$(_options.context).find('.selectAll').click(selectAllClick);_containers=$(this);setCheckBoxesFromQuery();this.each(function(){setupImageLists(this);});setupCheckBoxes();setupHintHover();_isFirstTime=false;return this;};function setupHintHover(){$(_options.context).find(_options.hintSelector).css({'opacity':'.5'}).hover(function(event){$(this).fadeTo(_options.fadeTime,1);},function(event){$(this).fadeTo(_options.fadeTime,.5);})}
function selectAllClick(event){if($(event.currentTarget).text()=='Select All'){_checkBoxes.each(function(i,domElement){if(_imageCartItems.length<_options.compareItemTotal&&$.inArray($(domElement).val(),_imageCartItems)==-1){addItem($(domElement).val());}
else{$(domElement).siblings('div').fadeIn(_options.fadeTime);}
if($.inArray($(domElement).val(),_options.selectedItems)==-1){_options.selectedItems.push($(domElement).val());}});}
else{_checkBoxes.each(function(i,domElement){removeItemFromArray($(domElement).val());if($.inArray($(domElement).val(),_imageCartItems)!=-1){removeItem($(domElement).val());}});}}
function removeAddedImageItemFromArray(arrayElement){for(var i=0;i<_imageCartItems.length;i++){if(_imageCartItems[i]==arrayElement){_imageCartItems.splice(i,1);return true;}}
return false;}
function setupCheckBoxes(){if(_options.selectedItems[0]==""){return;}
for(var i=0;i<_options.selectedItems.length;i++){addItem(_options.selectedItems[i]);}
_checkBoxes.each(function(i,domElement){if($.inArray($(domElement).val(),_options.selectedItems)==-1){$(domElement).removeAttr("checked");}});}
function itemChecked(event){if($(event.currentTarget).is(':checked')){addItem($(event.currentTarget).val());_options.selectedItems.push($(event.currentTarget).val());}
else{removeItemFromArray($(event.currentTarget).val());removeItem($(event.currentTarget).val());}}
function addItem(productId){_checkBoxes.each(function(i,domElement){if($(domElement).val()===productId){$(domElement).siblings('div').fadeIn(_options.fadeTime);}});if(_imageCartItems.length<_options.compareItemTotal){addImage(productId);}
else
if(!_isFirstTime&&!_hasMessageShown){showCompareMaxMessage();}}
function removeItem(productId){_checkBoxes.each(function(i,domElement){if(Number($(domElement).val())==productId){if($(domElement).is(':checked')){$(domElement).removeAttr('checked');}
$(domElement).siblings('div').fadeOut(_options.fadeTime);}});removeImage(productId);if(_imageCartItems.length<_options.compareItemTotal&&_options.selectedItems.length>=_options.compareItemTotal){addItem(_options.selectedItems[_options.compareItemTotal-1]);}}
function removeItemFromArray(arrayElement){for(var i=0;i<_options.selectedItems.length;i++){if(_options.selectedItems[i]==arrayElement){_options.selectedItems.splice(i,1);return true;}}
return false;}
function showCompareMaxMessage(){alert(_options.message);_hasMessageShown=true;}
function setupImageLists(element){domElement=$(element)
domElement.data('imageList',domElement.find('ul.selected'));domElement.data('imageList').find('li');prepareRemoveButtons(domElement);}
function prepareRemoveButtons(domElement){domElement.data('imageList').find('li').live('click mouseenter mouseleave',function(event){if($(event.currentTarget).hasClass('active')>-1){switch(event.type){case'click':removeItemFromArray($(event.currentTarget).attr('rel'));removeItem(Number($(event.currentTarget).attr('rel')));break;case'mouseover':$(event.currentTarget).find('a.close').fadeTo(_options.fadeTime,1);break;case'mouseout':$(event.currentTarget).find('a.close').fadeTo(_options.fadeTime,.5);break;}}});}
function addImage(productId){var imagePath=GetImagePath(productId,_options.imageExtension);_containers.each(function(i,domElement){$($(domElement).data('imageList').find('li:not(:has(img))')[0]).attr('class','active').attr('rel',String(productId)).find('span').append('<a href="#" class="icon compact close">Remove Item</a>').append('<image src="'+imagePath+'" width="'+_options.listItemWidth+'" height="'+Math.round(_options.listItemWidth*.75)+'" style="border:none" title="Click to Remove this Product" />').fadeIn(_options.fadeTime);if(i==1){_imageCartItems.push(productId);}})}
function removeImage(productId){if(isNaN(productId)){return;}
_containers.each(function(i,domElement){var imageElement=$(domElement).data('imageList').find('li[rel="'+productId+'"]');if(imageElement.length==0){return;}
imageElement.animate({width:0,opacity:0},_options.fadeTime,function(){$(this).remove();});$('<li><span></span></li>').css({width:0,opacity:0}).appendTo($(domElement).data('imageList')).animate({opacity:1,width:_options.listItemWidth},_options.fadeTime)
if(i==1){removeAddedImageItemFromArray(productId);}});}
function getProductList(){var url=window.location;var urlComponents=url.href.split("&");var selectedProductString="";var selectedProducts=[];for(var i=0;i<urlComponents.length;i++){if(urlComponents[i].indexOf("sel=")>=0){selectedProductString=urlComponents[i].replace("sel=","");}}
if(selectedProductString!=""){selectedProducts=selectedProductString.split(',');}
return selectedProducts;}
function setCheckBoxesFromQuery(){var selectedProducts=getProductList();_options.selectedItems=selectedProducts;_checkBoxes.each(function(i,domElement){if($.inArray($(domElement).val(),selectedProducts)>-1){$(domElement).attr('checked','true');}});}
function GetImagePath(productId,imageExtension){var imagePath;$.ajax({type:"POST",async:false,cache:false,url:VP.AjaxWebServiceUrl+"/GetMatrixRowImagePath",data:"{'productId' : '"+productId+"', 'imageExtension' : '"+imageExtension+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){imagePath=msg.d;},error:function(XMLHttpRequest,textStatus,errorThrown){var error=XMLHttpRequest;}});return imagePath;}
$.fn.vpMatrixImages.defaults={fadeTime:200,selectedItems:[],listItemWidth:36,message:"You can only select 5 items to compare, although you may request information for more than 5.  Any additional items will not be added to your compare cart.",context:'body',hintSelector:'.hint',productListRowSelector:'div.productRow',productActionsSelector:'.productActions div',imageExtension:"-52x39.jpg",compareItemTotal:5}})(jQuery);;RegisterNamespace("VP.Tag");VP.Tag.TagContentType;VP.Tag.TagContentId;VP.Tag.TagResultsUrl;VP.Tag.TagUserId;VP.Tag.Initialize=function(){$(document).ready(function(){$("#btnAddTag").click(function(){$("#tagError").text("");VP.Tag.AddTag();});$("#txtTagName").keypress(function(event){if(event.which==13){$("#btnAddTag").click();event.returnValue=false;event.cancel=true;event.keyCode=0;return false;}});});};VP.Tag.ValidateTag=function(){if($("#txtTagName").val()==""){$("#rfvTagName").css("display","inline");return false;}
else{$("#rfvTagName").css("display","none");return true;}};VP.Tag.FormatTag=function(){var tagName=$("#txtTagName").val();tagName=tagName.replace(/</g,'');tagName=tagName.replace(/>/g,'');tagName=tagName.replace(/^\s+/,'');tagName=tagName.replace(/\s+$/,'');$("#txtTagName").val(tagName);};VP.Tag.AddTag=function(){VP.Tag.FormatTag();if(VP.Tag.ValidateTag()){var tagName=$("#txtTagName").val();$.ajax({type:"POST",url:VP.AjaxWebServiceUrl+"/AddTag",cache:false,async:false,data:"{'contentType':'"+VP.Tag.TagContentType+"','contentId':'"+VP.Tag.TagContentId+"','tagName':'"+
tagName+"','userId':' "+VP.Tag.TagUserId+"','siteId':'"+VP.SiteId+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){if(msg.d=="00"){$("#tagError").text("Error occured while saving tag.");}
else if(msg.d=="01"){$("#tagError").text("This tag name already exist.");}
else{var tagId=msg.d;var url=VP.Tag.TagResultsUrl.replace(/-TagId-/i,tagId);var newTagHtml="<li class='tagElement'>";newTagHtml+="<a class='tagLink' href='"+url+"'>"+tagName+"</a>";newTagHtml+="</li>";$("#tags").append(newTagHtml);}
$("#txtTagName").val('');}});}};VP.Tag.Initialize();