	
	/* _sappress mod 0302101730 - add additional javascript code for use by other functions */
		jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
		var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
		expires='; expires='+date.toUTCString();}
		var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
		return cookieValue;}};
	/* _sappress_end */

	/* _sappress mod 0910091126 - have quantity field on product lists automatically submit on qty selection vs having to click add to cart @ bottom of page  */
		$(document).ready(function(){
		   $('.ProductQty select').change(function() {if (window.CheckForm && this.value > 0) {CheckForm('add')}});
		});
	/* _sappress_end */

	/* _sappress mod 0730091011 - add tell a friend functionality to the product page */
		function newWindow(mypage,myname,w,h,features) {

		  if(screen.width){
			  var winl = (screen.width-w)/2;
			  var wint = (screen.height-h)/2;
		  } else {winl = 0;wint =0;}
		  if (winl < 0) winl = 0;
		  if (wint < 0) wint = 0;
		  var settings = 'height=' + h + ',';
		  settings += 'width=' + w + ',';
		  settings += 'top=' + wint + ',';
		  settings += 'left=' + winl + ',';
		  settings += features;
		  win = window.open(mypage,myname,settings);
		  win.window.focus();
		}

		/* Modified to support Opera */
		function bookmarksite(title,url){
			if (window.sidebar) // firefox
				window.sidebar.addPanel(title, url, "");
			else if(window.opera && window.print){ // opera
				var elem = document.createElement('a');
				elem.setAttribute('href',url);
				elem.setAttribute('title',title);
				elem.setAttribute('rel','sidebar');
				elem.click();
			}
			else if(document.all)// ie
				window.external.AddFavorite(url, title);
		}
	/* _sappress_end */

	/* _sappress bug fix 0917091247 - during express checkout, need to scroll section to top when going from confirmation to payment step, otherwise user has to scroll */
		/**
		 * jQuery.ScrollTo - Easy element scrolling using jQuery.
		 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
		 * Dual licensed under MIT and GPL.
		 * Date: 3/9/2009
		 * @author Ariel Flesler
		 * @version 1.4.1
		 *
		 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
		 */
		;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);

		/**
		 * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
		 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
		 * Dual licensed under MIT and GPL.
		 * Date: 3/11/2009
		 * @author Ariel Flesler
		 * @version 1.2.7
		 **/
		;(function($){var l=location.href.replace(/#.*/,'');var g=$.localScroll=function(a){$('body').localScroll(a)};g.defaults={duration:1e3,axis:'y',event:'click',stop:true,target:window,reset:true};g.hash=function(a){if(location.hash){a=$.extend({},g.defaults,a);a.hash=false;if(a.reset){var e=a.duration;delete a.duration;$(a.target).scrollTo(0,a);a.duration=e}i(0,location,a)}};$.fn.localScroll=function(b){b=$.extend({},g.defaults,b);return b.lazy?this.bind(b.event,function(a){var e=$([a.target,a.target.parentNode]).filter(d)[0];if(e)i(a,e,b)}):this.find('a,area').filter(d).bind(b.event,function(a){i(a,this,b)}).end().end();function d(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,'')==l&&(!b.filter||$(this).is(b.filter))}};function i(a,e,b){var d=e.hash.slice(1),f=document.getElementById(d)||document.getElementsByName(d)[0];if(!f)return;if(a)a.preventDefault();var h=$(b.target);if(b.lock&&h.is(':animated')||b.onBefore&&b.onBefore.call(b,a,f,h)===false)return;if(b.stop)h.stop(true);if(b.hash){var j=f.id==d?'id':'name',k=$('<a> </a>').attr(j,d).css({position:'absolute',top:$(window).scrollTop(),left:$(window).scrollLeft()});f[j]='';$('body').prepend(k);location=e.hash;k.remove();f[j]=d}h.scrollTo(f,b).trigger('notify.serialScroll',[f])}})(jQuery);

		$(document).ready(function(){
			if (document.location.href.indexOf('checkout.php') > 0) {	
				$.scrollTo('0px','0px');		//need to scroll to top on checkout page if page is refreshed - by default, browsers scroll to last position
			}
		});
	/* _sappress_end */

	/* _sappress mod 0924091741 */
		// enhance express.checkout.js code so that wis advantage payment module passes content to server using ajax (to keep user on express checkout page for errors) */
		$(document).ready(function(){
			if (typeof(ExpressCheckout) != 'undefined') {

				ExpressCheckout.ProcessPaymentForm = function(provider)
				{
					ExpressCheckout.ShowLoadingIndicator();
					
					$('#CheckoutStepPaymentDetails .ExpressCheckoutContent .ErrorMessage').hide().html('');

					$.ajax({
						async: false,
						url: 'checkout.php?action=process_payment',
						data: 'isajax=true&'+$('#CheckoutStepPaymentDetails form').serialize(),
						type: 'post',
						success: ExpressCheckout.PaymentFormProcessed
					});
					return false;
				};
				
				ExpressCheckout.PaymentFormProcessed = function(xml)
				{	
					//will be triggered if payment succeeded
					if ($('redirecturl', xml).text()) {
						document.location = $('redirecturl', xml).text();
						return true;
					}

					ExpressCheckout.HideLoadingIndicators();
					
					if($('status', xml).text() == 0) {
						if ($('paymentContents', xml).text()) {	
							$('#CheckoutStepPaymentDetails .ExpressCheckoutContent').html($('paymentContents', xml).text());
						}
						$('#CheckoutStepPaymentDetails .ExpressCheckoutContent .InfoMessage').hide();	//this is the intro message; only show when form is first shown
						if ($('disableallinputfields', xml).text()) {	//don't allow to resubmit the form (e.g., if post to advantage partially succeeded)
							$('.ChangeLink').hide();
							$('#CheckoutStepPaymentDetails :input').attr('disabled', 'disabled');
						}
						alert($('message', xml).text().replace('\n', "\n"));
						if($('step', xml).text()) {
							ExpressCheckout.ChangeStep($('step', xml).text());
						}
						return false;
					}

					$('#CheckoutStepPaymentDetails .ExpressCheckoutContent').html($('paymentContents', xml).text());
					$('#CheckoutStepPaymentDetails .ExpressCheckoutContent .InfoMessage').hide();	//this is the intro message; only show when form is first shown
					$('#CheckoutStepPaymentDetails').show();
					if ($('disableallinputfields', xml).text()) {	//don't allow to resubmit the form (e.g., if post to advantage partially succeeded)
						$('.ChangeLink').hide();
						$('#CheckoutStepPaymentDetails :input').attr('disabled', 'disabled');
					}
					ExpressCheckout.completedSteps[ExpressCheckout.completedSteps.length] = 'Confirmation';
					ExpressCheckout.ChangeStep('PaymentDetails');
				};			
			}
		});
	/* _sappress_end */
	
	/* _sappress mod 0925091507 - add ability to edit existing addresses during express checkout */
		function EditCheckoutAddress(selectid) {
			id = $(selectid).val();
			if (id) {
				window.location = '/account.php?action=edit_shipping_address&address_id='+id+'&from=checkout.php'; //note: assumes we're already using https://			
			}
		}
		function DeleteCheckoutAddress(selectid) {
			id = $(selectid).val();
			if (id && confirm("Are you sure you want to delete this address?")) {
				window.location = '/account.php?action=delete_shipping_address&address_id='+id+'&from=checkout.php'; //note: assumes we're already using https://			
			}
		}
		$(document).ready(function() {
			$('html').ajaxStart(function() {
				$('.sectionbutton').attr('disabled', 'disabled');
			});

			$('html').ajaxComplete(function() {
				$('.sectionbutton').removeAttr('disabled');
			});
		});
	/* _sappress_end */

	/* _sappress mod 1006090102 */
		$(document).ready(function() {
			if (window.location.toString().indexOf('#write_review') > 0 && typeof show_product_review_form == 'function') { 
				show_product_review_form();
				$.scrollTo('#write_review', {offset:-100, duration:500});
			}
		});
	/* _sappress_end */
	
	/* _sappress mod 1218090337 - replace no rating image with link enabling them to rate it */
		$(document).ready(function() {
			$('.Rating0').each(function (i) {
				prodlink = $(this).parent().parent().find('a:first').attr('href');
				if (typeof prodlink!=undefined) {	
					if (window.location.toString().indexOf(prodlink) < 0) {
						$(this).html('<a href="'+prodlink+'#write_review?">Be the first to rate this product</a>');
					}
					else {
						$(this).html('<a href="&nbsp" onclick="show_product_review_form();$.scrollTo(\'#write_review\', {offset:-100, duration:500});return false;">Be the first to rate this product</a>');
					}
				}
			});			
		});
	/* _sappress_end */

	/* _sappress mod 1218090431 - adstream - specify OAS_sitepage, OAS_url, OAS_listpos, and OAS_query before calling OAS_AD below */
		var OAS_sitepage = 'www.sap-press.com/index.php';	//'sapinsiderprofiles.wispubs.com/index2.aspx';
		var OAS_url = 'http://oasc04011.247realmedia.com/RealMedia/ads/';
		var OAS_listpos = 'Left,Middle,Right,Top';
		var OAS_query = '';
	
		var OAS_target = '';
		var OAS_rn = new String (Math.random()); OAS_rns = OAS_rn.substring (2, 11);
		function OAS_NORMAL(pos) {
			document.write('<A HREF="' + OAS_url + 'click_nx.ads/' + OAS_sitepage + '/1' +
			OAS_rns + '@' +
			OAS_listpos + '!' + pos + '?' + OAS_query + '" TARGET=' + OAS_target + '>');
			document.write('<IMG SRC="' + OAS_url + 'adstream_nx.ads/' + OAS_sitepage + '/1' +
			OAS_rns + '@' + OAS_listpos + '!' + pos + '?' + OAS_query + '" BORDER=0></A>');
		}
		OAS_version = 11;
		if (navigator.userAgent.indexOf('Mozilla/3') != -1 || navigator.userAgent.indexOf('Mozilla/4.0 WebTV') != -1) {
			OAS_version = 10;
		}
		if (document.location.toString().indexOf('https') < 0) {
			if (OAS_version >= 11) {
				document.write('<SCR' + 'IPT LANGUAGE=JavaScript1.1 SRC="' + OAS_url + 'adstream_mjx.ads/' + OAS_sitepage + '/1' + OAS_rns + '@' + OAS_listpos + '?' + OAS_query + '"><\/SCRIPT>');
			}
		}
		function OAS_AD(pos) {
			if (document.location.toString().indexOf('https') < 0) {
				if (OAS_version >= 11) {
				  OAS_RICH(pos);
				}
				else {
				  OAS_NORMAL(pos);
				}
			}
		}
	/* _sappress_end */
	
	/* _sappress mod 1211091046 */
		$(document).ready(function() {
			topimg = $('li.TopSeller1 .ProductImage img').attr('src');
			if (typeof topimg != 'undefined' && topimg!='') {
				$('.TopSellingImage img').attr('src', topimg);	
			}
			tophref = $('li.TopSeller1 .ProductImage a').attr('href');
			if (typeof tophref != 'undefined' && tophref!='') {
				$('.TopSellingImage a').attr('href', tophref);	
			}
		});
	/* _sappress_end */
	
	/* _sappress mod 0106101034 */
		function limitText(limitField, limitCount, limitNum) {
			if (limitField.value.length > limitNum) {
				limitField.value = limitField.value.substring(0, limitNum);
			} else {
				limitCount.value = limitNum - limitField.value.length;
			}
		}
	/* _sappress_end */

	/* _sappress mod 0111102018 */					
		function ReportCheckoutAJAXError(info) 	{
			info += "request.cookieinfo" + document.cookie + "<br />";
			var data = {title:  "An AJAX error has occurred during checkout",
						body:	"An AJAX error has occurred during checkout. The customer was presented with a javascript alert, and may not have been able to complete checkout. NOTE: The call may have ultimately succeeded during one of the callbacks.<br /><br />Details about the error, if available, were:<br />\n"+info,
						type:  	"generaltechnicalfailure",
						seccode: "2023"};
			$.post("wis.php?action=emailadmin", data);
		}
	/* _sappress_end */	
	
	/* _sappress mod 020210240 - Navigation drop down */
	
		var timeout	= 500;
		var closetimer	= 0;
		var ddmenuitem	= 0;
		
		// open hidden layer
		function mopen(id)
		{	
			// cancel close timer
			mcancelclosetime();
		
			// close old layer
			if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
		
			// get new layer and show it
			ddmenuitem = document.getElementById(id);
			ddmenuitem.style.visibility = 'visible';
		}
		// close showed layer
		function mclose()
		{
			if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
		}
		
		// go close timer
		function mclosetime()
		{
			closetimer = window.setTimeout(mclose, timeout);
		}
		
		// cancel close timer
		function mcancelclosetime()
		{
			if(closetimer)
			{
				window.clearTimeout(closetimer);
				closetimer = null;
			}
		}
		
		// close layer when click-out
		document.onclick = mclose; 
	
	/* _sappress_end */
	
	/* _sappress mod 022312402010 */					
		// Browser Dection Script - Compressed
		var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var i=0;i<a.length;i++){var b=a[i].string;var c=a[i].prop;this.versionSearchString=a[i].versionSearch||a[i].identity;if(b){if(b.indexOf(a[i].subString)!=-1)return a[i].identity}else if(c)return a[i].identity}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(b==-1)return;return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();
	/* _sappress_end */
