	
		Function.prototype.clone=function(){
			return eval('['+this.toString()+']')[0];
		}
		
		function getBrowser() {
			var browser="unknown";
			var userAgent = navigator.userAgent.toLowerCase();
			if (userAgent.indexOf("opera") > -1)
			browser="Opera";
			else if (userAgent.indexOf("konqueror") > -1)
			browser="Konqueror";
			else if (userAgent.indexOf("firefox") > -1)
			browser="Firefox";
			else if (userAgent.indexOf("netscape") > -1)
			browser="Netscape";
			else if (userAgent.indexOf("msie") > -1)
			browser="Internet Explorer";
			else if (userAgent.indexOf("chrome") > -1)
			browser="Chrome";
			else if (userAgent.indexOf("safari") > -1)
			browser="Safari";
			return browser;
		}


		function pageRefresh() {
		
			$('div#MyBasket-Scroll-Pane').jScrollPane({
            	showArrows: true,
				verticalArrowPositions: 'after',
                horizontalArrowPositions: 'after',
				arrowScrollOnHover: true,
    	        animateTo:true,
				scrollbarWidth:20,
				scrollbarMargin:5
       	});
		
			var basket_items = 0;
			$('.BasketPreviewItemQuantity').each( function() {
				var	quantity = parseInt( $(this).text().replace(/\D/g,'') );
				if (quantity > 0) {
					basket_items += quantity;
				}
			});
			
			$('#MyBasketPreviewTotalItems').text( basket_items );
			
			if (typeof ExtraPageRefreshFunc == 'function') ExtraPageRefreshFunc();
		}
		
		Sys.Net.WebRequestManager.add_completedRequest( pageRefresh );
	
		if (typeof Sys.WebForms != 'undefined') {
			Sys.WebForms.PageRequestManager.getInstance().add_endRequest( pageRefresh );
		}

    	$(document).ready( function() {
		
			$(document).live('DOMSubtreeModified', function() {				
				pageRefresh();
			});	
			
			pageRefresh();
			
		    $('marquee').marquee('pointer').mouseover(function () {
				  $(this).trigger('stop');
			  }).mouseout(function () {
				  $(this).trigger('start');
			  });

			$('#HeaderPopupMenuContainer li.header-popup-selector').hover( 
				function() {
					var hidden_popup = $('div.header-popup-container.hidden', $(this));					
					//if ( hidden_popup.length == 1) { 
						$(this).addClass('active');
						hidden_popup.removeClass('hidden');
						pageRefresh();
					//} 
					return false;
				},
				function() {
					$(this).removeClass('active');
					$('div.header-popup-container').addClass('hidden');
					return false;
				}
			
			);
		});
		
		
	if(!String.prototype.startsWith){
		String.prototype.startsWith = function (str) {
			return !this.indexOf(str);
		}
	}

		
		
	if (typeof prepareFrame == 'function') {
		old_prepareFrame = prepareFrame.clone();
	
		window.prepareFrame = function (iframeID, showFullSize) {		
			
			old_prepareFrame(iframeID, showFullSize);		
			
			if ( $('#' + iframeID).attr('tagName') == 'IFRAME' ) {					
				try {
					var iframe_url = $('#' + iframeID).attr('src');
					var iframe_path = iframe_url.substring(0,iframe_url.lastIndexOf("/")+1);

					$('#' + iframeID).contents().find('*').attr('style', '');
					
					$('#' + iframeID).contents().find('img').each( function() {
						var src = $(this).attr('src');
						if (!src.startsWith('http') && !src.startsWith('/')) {
							src = iframe_path + src;	
						}
						$(this).attr('src', src);
					});					
					
					var iframe_contents = '';
					if ($.browser.msie) {
						iframe_contents = innerXHTML( $('#' + iframeID).contents().find('body')[0] );
					} else {
						iframe_contents = $('#' + iframeID).contents().find('body').html();				
					}
					$('#' + iframeID).replaceWith( iframe_contents );
				} catch(exp) { }
			}
			
			$('.NoteDescription a').each( function() {
				if ( $(this).text() == '') {
					$(this).parent().parent().remove();
				}
			});
			
		}
		
	}
	
	
	$(document).ready( function() {
		
		$('body').addClass('Browser-' + getBrowser());
		
		$('span.SiteProductSearch table.ProductsParamsPanel td.ProductsParamsPanelField input[type="text"]').each( function() {
			$(this).data('bg_image', $(this).css('background-image'));	
			if ( $(this).val() != '') {
				$(this).css('background-image', 'none');
			}
			$(this).focus( function() {
				$(this).css('background-image', 'none');
			});
			$(this).blur( function() {
				if ($(this).val() == '') {
					$(this).css('background-image', $(this).data('bg_image') + '');	
				}
			});
		});
		
	});
		
