/*!
 * Bridgestone Golf Ball Selection Widget
 * Copyright 2010, Bridgestone Golf Inc.
 *
 * The min version requires the JQuery Libraries to be Installed to execute properly:
 * http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js 
 *
 * Use this js file if you already load JQuery on your site.
 * Use the bswidget.js file to load the widget with embedded JQuery 1.4.3. 
 */
var BSG = window.BSG || {}, Settings; BSG.Widget = function (a) { Settings = a }; BSG.Widget.prototype.render = function () { document.write('<div id="bsgWidgetWrapper"></div>') }; function addLinkParam(a, c, d) { return "," + c + "=" + (a != null ? a : d) } function buildParams() { var a = "regKey=" + (Settings.regKey != null ? Settings.regKey : ""); a += ",linkSelf=" + (Settings.linkSelf != null ? Settings.linkSelf : "false"); a += ",buyButtonShow=" + (Settings.buyButtonShow != null ? Settings.buyButtonShow : "true"); a += ",buyButtonText=" + (Settings.buyButtonText != null ? Settings.buyButtonText : ""); a += ",emailButtonShow=" + (Settings.emailButtonShow != null ? Settings.emailButtonShow : "true"); a += ",emailSubscribeShow=" + (Settings.emailSubscribeShow != null ? Settings.emailSubscribeShow : "true"); a += addLinkParam(Settings.links != null ? Settings.links.b330 : null, "b330", "http://www.bridgestonegolf.com/product/balls/tour-b330"); a += addLinkParam(Settings.links != null ? Settings.links.b330s : null, "b330s", "http://www.bridgestonegolf.com/product/balls/tour-b330-s"); a += addLinkParam(Settings.links != null ? Settings.links.b330rx : null, "b330rx", "http://www.bridgestonegolf.com/product/balls/tour-b330-rx"); a += addLinkParam(Settings.links != null ? Settings.links.b330rxs : null, "b330rxs", "http://www.bridgestonegolf.com/product/balls/tour-b330-rxs"); a += addLinkParam(Settings.links != null ? Settings.links.e5 : null, "e5", "http://www.bridgestonegolf.com/product/balls/e5"); a += addLinkParam(Settings.links != null ? Settings.links.e6 : null, "e6", "http://www.bridgestonegolf.com/product/balls/e6"); a += addLinkParam(Settings.links != null ? Settings.links.e7 : null, "e7", "http://www.bridgestonegolf.com/product/balls/e7"); return a } function getLinkImage() { return '<img src="' + (Settings.banner != null ? Settings.banner : "http://widget.bridgestonegolf.com/images/guide/logo.png") + '" width="' + (Settings.bannerWidth != null ? Settings.bannerWidth : "77px") + '" height="' + (Settings.bannerHeight != null ? Settings.bannerHeight : "100px") + '" border="0" alt="Bridgestone Golf Ball Selection Guide" />' } function addLoaderImage() { jQuery("#bsgWidgetDialog").append('<img id="bsgWidgetLoader" src="http://widget.bridgestonegolf.com/images/guide/loader.gif" />'); jQuery("#bsgWidgetLoader").css({ margin: "180px 0 0 280px" }) } function addCloseButton() { jQuery("#bsgWidgetDialog").append('<a id="bsgWidgetClose" onclick="closeBsgWidget();"><img src="http://widget.bridgestonegolf.com/images/guide/transparent.gif" width="28" height="25" border="0" alt="" /></a>'); jQuery("#bsgWidgetClose").css({ "float": "right", "margin-right": "47px", cursor: "pointer" }) } function closeBsgWidget() { jQuery("#bsgWidgetMask, #bsgWidgetDialog").fadeOut(500); jQuery("#bsgWidget").remove() } function onSilverlightError(a, c) { var d = ResourceStrings.ErrorLoad; if (c != null) c.errorCode == 8001 ? d = ResourceStrings.Upgrade + '<br/><br/><a href="http://go.microsoft.com/fwlink/?LinkID=124807"><img src="http://widget.bridgestonegolf.com/images/guide/button-install.gif" border="0" /></a><br/><br/>' + ResourceStrings.BrowseRestart : c.errorCode == 8002 ? d = ResourceStrings.SLRestart : d += "<br/><br/>" + ResourceStrings.Notify + ' <a style="color:#ffcc33;" href="mailto:contact@bridgestonegolf.com">Bridgestone Golf</a>.<br/><br/><span style="font-size:10px;color:#666;">Error Code: ' + c.errorCode + ". " + c.errorMessage + "</span>"; jQuery("#bsgWidgetDialog").empty(); addCloseButton(); jQuery("#bsgWidgetDialog").append('<div id="bsgWidgetInstall" style="margin:150px 100px 40px 40px;font-size:16px;">' + d + "</div>") } jQuery(document).ready(function () { var a = "http://widget.bridgestonegolf.com/js/bsgwidget.strings.js"; Settings.culture != null && (Settings.culture == "ja-jp" ? a = "http://widget.bridgestonegolf.com/js/bsgwidget.strings.ja-jp.js" : Settings.culture == "es-es" && (a = "http://widget.bridgestonegolf.com/js/bsgwidget.strings.es-es.js")); jQuery.getScript(a, function () { var a = '<a id="bsgWidgetLink" href="#">' + getLinkImage() + "</a>"; jQuery("#bsgWidgetWrapper").append(a); a = '<div id="bsgWidgetDialog" style="z-index:' + (Settings.zIndexDialog != null ? Settings.zIndexDialog : "9999") + ';"></div>'; a += '<div id="bsgWidgetMask" style="z-index:' + (Settings.zIndexDialog != null ? Settings.zIndexDialog - 1 : "9000") + ';"></div>'; (Settings.renderInPageRoot != null ? Settings.renderInPageRoot : 1) ? jQuery("body").append(a) : jQuery("#bsgWidgetWrapper").append(a); jQuery("#bsgWidgetDialog").css({ display: "none", position: "absolute", color: "#ffffff", background: "url(http://widget.bridgestonegolf.com/images/guide/background.gif) no-repeat", "font-family": "Verdana, sans-serif", width: "700px", height: "492px", left: "50%", "margin-left": "-325px" }); jQuery("#bsgWidgetMask").css({ display: "none", position: "absolute", "background-color": "#666", left: "0", top: "0", width: "100%", height: jQuery(document).height() }); jQuery("a[id=bsgWidgetLink]").click(function (a) { addLoaderImage(); a.preventDefault(); jQuery("#bsgWidgetMask").fadeIn(1E3); jQuery("#bsgWidgetMask").fadeTo("slow", 0.8); var a = jQuery(window).scrollTop(), c = jQuery(window).height(), e = jQuery("#bsgWidgetDialog").height(); jQuery("#bsgWidgetDialog").css("top", c / 2 + a - e / 2); jQuery("#bsgWidgetDialog").fadeIn(750, function () { jQuery("#bsgWidgetDialog").empty(); addCloseButton(); var a = Settings.widgetUrl != null ? Settings.widgetUrl : "http://widget.bridgestonegolf.com/clientbin/bridgestone.ballselection.widget.xap", b = ""; b += '<object id="bsgWidget" data="data:application/x-silverlight," type="application/x-silverlight" width="700" height="464">'; b += '<param name="source" value="' + a + '"/>'; b += '<param name="background" value="Transparent" />'; b += '<param name="windowless" value="true" />'; b += '<param name="minRuntimeVersion" value="4.0.50401.0" />'; b += '<param name="autoUpgrade" value="false" />'; b += '<param name="enableHtmlAccess" value="true" />'; b += '<param name="onerror" value="onSilverlightError" />'; b += '<param name="initparams" value="' + buildParams() + '" />'; b += Settings.culture != null ? '<param name="culture" value="' + Settings.culture + '" />' : ""; b += Settings.culture != null ? '<param name="uiculture" value="' + Settings.culture + '" />' : ""; b += '<div id="bsgWidgetInstall" style="margin:150px 100px 40px 40px;font-size:16px;">' + ResourceStrings.Install + '<br/><br/><a href="http://go.microsoft.com/fwlink/?LinkID=124807"><img src="http://widget.bridgestonegolf.com/images/guide/button-install.gif" border="0" /></a><br/><br/>' + ResourceStrings.BrowseRestart + "</div>"; b += "</object>"; jQuery("#bsgWidgetDialog").append(b); jQuery("#bsgWidget").css({ outline: "0" }) }) }) }) });
