/*
 *
 * Copyright (c) 2008 UberPrints, Inc.
 *
 * Portions of this code Copyright (c) 2007 Cody Lindley:
 *     Thickbox 3.1 - One Box To Rule Them All.
 *     By Cody Lindley (http://www.codylindley.com)
 *     Copyright (c) 2007 cody lindley
 *     Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 *
 */
var global_previewWidth=720;var global_previewHeight=420;var iGlobalProductCount;$(document).ready(initPreviewWin);function initPreviewWin(){$("a.productPreview").click(function(a){a.preventDefault();this.blur();showPreview(this.href,this)});$("div.productPreview").click(function(a){a.preventDefault();this.blur();showPreview(this.title,this)})}function showPreview(b,d){var a=b.match(/\?(.+)/)[1];var f=parseQueryString(a);var g=f.id;var h=d.id.indexOf("__");var c=h+2;var j=d.id.substring(c,d.id.length);b="/catalog/product/view.asp?id="+g;if($("#previewWin").css("display")=="block"){return refreshProduct(g)}if(typeof document.body.style.maxHeight==="undefined"){$("body","html").css({height:"100%",width:"100%"});$("html").css("overflow","hidden");if(document.getElementById("UP_HideSelect")===null){$("body").append("<iframe id='UP_HideSelect'></iframe><div id='pageOverlay'></div><div id='previewWin'></div>");$("#pageOverlay").click(TB_remove)}}else{if(document.getElementById("pageOverlay")===null){$("body").append("<div id='pageOverlay'></div><div id='previewWin'></div>");$("#pageOverlay").click(TB_remove)}}$("#previewWin").css("width",global_previewWidth+"px");$("#previewWin").css("height",global_previewHeight+"px");if(tb_detectMacXFF()){$("#pageOverlay").addClass("TB_overlayMacFFBGHack")}else{$("#pageOverlay").addClass("TB_overlayBG")}if($("#UP_load").attr("id")){}else{$("body").append("<div id='UP_load' align='center'><img src='/images/global/preload/load-med-bl.gif' /><br/>Loading...</div>")}var e=global_previewWidth-30,i=global_previewHeight-50;if(!document.getElementById("PP_ajaxContent")){$("#previewWin").append("<div id='PP_title' style='height:20px'><div id='closeWin-div'><a href='#' id='PP_closeWindowButton'>x close window</a></div></div><div id='product_overlay' style='display:none;'></div><div id='PP_ajaxContent' style='width:"+e+"px;height:"+i+"px;'></div><div id='PP_footer' style='height:20px'><div id='PP_footerPrevious'><a href='#' id='PP_previousButton'>&laquo;&nbsp;Previous Product</a></div><div id='PP_footerNext'><a href='#' id='PP_nextButton'>Next Product&nbsp;&raquo;</a></div></div>");$("#PP_ajaxContent").height(i)}else{$("#PP_ajaxContent").attr("innerHTML","")}$("#PP_closeWindowButton").attr("innerHTML","x close window");$("#PP_closeWindowButton").css("color","");$("#PP_closeWindowButton").click(function(){TB_remove();return false});$("#PP_previousButton").click(function(){nextProduct(-1);return false});$("#PP_previousButton").bind("focus",function(){this.blur();return false});$("#PP_nextButton").click(function(){nextProduct(1);return false});$("#PP_nextButton").bind("focus",function(){this.blur();return false});TB_position();$("#previewWin").css({display:"block"});$("#UP_load").show();loadProduct(g,b,function(){TB_position();$("#UP_load").hide();$("#previewWin").css({display:"block"});$("#PP_footer").css("opacity",100)},j)}function loadProduct(c,a,d,b){sCurrentProduct=c;if(b){iGlobalProductCount=parseInt(b)}$("#PP_ajaxContent").load(a,d);$("#PP_closeWindowButton").attr("innerHTML","x close window");$("#PP_closeWindowButton").css("color","");$("#PP_closeWindowButton").unbind("click");$("#PP_closeWindowButton").click(function(){TB_remove();return false})}function TB_remove(){$("#PP_closeWindowButton").unbind("click");$("#PP_previousButton").unbind("click");$("#PP_nextButton").unbind("click");$("#PP_previousButton").unbind("focus");$("#PP_nextButton").unbind("focus");$("#previewWin").fadeOut("fast",function(){$("#previewWin,#pageOverlay,#UP_HideSelect").trigger("unload").unbind().remove()});$("#UP_load").hide();$("#product_overlay").hide();if(typeof document.body.style.maxHeight=="undefined"){$("body","html").css({height:"auto",width:"auto"});$("html").css("overflow","")}document.onkeydown="";document.onkeyup="";return false}function TB_position(){$("#previewWin").css({marginLeft:"-"+parseInt((global_previewWidth/2),10)+"px",width:global_previewWidth+"px"});if(!(jQuery.browser.msie&&jQuery.browser.version<7)){$("#previewWin").css({marginTop:"-"+parseInt((global_previewHeight/2),10)+"px"})}}function positionLoading(c,a){var b=100;var d=100;$("#UP_load").css({left:(c-b)/2,top:(a-d)/2}).css({display:"block"})}function parseQueryString(c){if(!c){return{}}var e={};var b=c.split(/[;&]/);for(var a=0;a<b.length;a++){var d=b[a].split("=");if(!d||d.length!=2){continue}e[unescape(d[0])]=unescape(d[1]).replace(/\+/g," ")}return e}function showColorInfo(b,a,c){alert("hey")}function showColorsPreview(a,b){if(!$("#inner_"+b).attr("id")){$("#"+b).append('<div id="inner_'+b+'"></div>');$("#inner_"+b).load("/catalog/product/colors.asp?p="+a+"&r=1"+Math.random())}else{}$("#"+b).show()}function hideColorsPreview(a){$("#"+a).hide()}function tb_detectMacXFF(){var b=navigator.userAgent.toLowerCase();if(/firefox[\/\s](\d+\.\d+)/.test(b)){var a=new Number(RegExp.$1);if(a<3&&b.indexOf("mac")!=-1){return true}}};