//---------------------------------------------------------------
bimagoMnt = {
	leftNavBarShown: false,
	googleAdWords: {
		label: '',
		inserted: false
	},
	
	showLeftNavBar: function(mode)
	{
		$('left_nav_container').className = 'left_nav_container';
		if (mode)
			this.leftNavBarShown = true;
	},
	
	hideLeftNavBar: function(mode)
	{
		if (this.leftNavBarShown && !mode) {
			this.leftNavBarShown = false;
			return;
		}
		
		$('left_nav_container').className = 'left_nav_container_hidden';
		this.leftNavBarShown = false;
	},
	
	moveCartItemToWishlist: function(elem)
	{
		$(elem).previous().value = 1;
		$('cart_form').submit();
	},
	
	
	insertGoogleAdwords: function()
	{
		if (this.googleAdWords.inserted)
			return;
		
		if (!this.googleAdWords.label.length)
			return;
		
		var txt = '';
		txt += '<div style="display:inline;">';
		txt += '<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/1027512070/?label='+ this.googleAdWords.label +'&amp;guid=ON&amp;script=0"/>';
		txt += '</div>';

		Element.update('googleAdWordsCode', txt);
		this.googleAdWords.inserted = true;
	},
	
	
	toggleSeoBox: function()
	{
		Element.toggle('footer_social_box');
	}
}

//---------------------------------------------------------------
ToolbarPager = {
	baseUrl: '',
	
	goToPage: function(el)
	{
		page = parseInt($(el).previous().value);
		if (isNaN(page))
			return;

		url = this.baseUrl.replace(/&amp;/g, '&').replace(/&p=\d*/, '');
		if (url.indexOf('?') != -1) {
			url += '&p='+page;
		} else
			url += '?p='+page;
		
		setLocation(url);
	}
}


//---------------------------------------------------------------
function changeProductImage(url, full_url)
{
  $('product_image').src = url;
  $('product_image').parentNode.href = full_url;
  $('product_image_zoom').parentNode.href = full_url;
  
  $('pokaz').href=full_url; 
}


/**
 * Test wersji przegladarki i wyswietlenie okna w przypadku pozytywnego wyniku z klepsydra
 * 
 * IE6 legitymuje sie jako wersja 3
 */
function IE6Test(tresc)
{
	document.write('<div onclick="$(\'errorBrowserBG\').style.display = \'none\';" id="errorBrowserBG" style="z-index:998; position:absolute; top:0px; left:0px; width:400px; height:200px; background-color:black">');
	document.write('<div onclick="$(\'errorBrowserBG\').style.display = \'none\';" id="errorBrowser" style="z-index:999;   color:black; position:absolute; top:0px; left:0px; text-align: left; width:400px; height:200px; background:url(../skin/frontend/default/bimago/images/IE/IEerror.png);">');
	document.write('<div style="position:relative; top:6px; left:383px"><a href="#" onclick="$(\'errorBrowserBG\').style.display = \'none\';"><img border=0 src="../skin/frontend/default/bimago/images/IE/IEerrorClose.png"></a></div>');

	document.write('<div style="position:relative; top:40px; left:25px; width: 355px;"><span style="font-weight:bold; font-size:13px; color:black;">'+tresc+'</span></div></div></div>');

	xx = document.documentElement.clientWidth;
    yy = document.documentElement.clientHeight;

    $('errorBrowser').style.left = xx/2-180+"px";
    $('errorBrowser').style.top = yy/2-100+"px";

    $('errorBrowserBG').style.width = xx+"px";
    $('errorBrowserBG').style.height =  yy+"px";
}
