var siteURL = 'http://www.sarpol.pl/';

function getElement(id)
{
	with (document) var element = getElementById ? getElementById(id) : all ? all[id] : layer[id];
	if(!element.style) element.style = element;
	return element;
}

function hideElement(name)
{
	getElement(name).style.display = 'none';
}

function viewElement(name)
{
	getElement(name).style.display = 'block';
}

function elementOnOff(name)
{
	if (getElement(name).style.display == 'none')
		getElement(name).style.display = 'block';
	else
		getElement(name).style.display = 'none';
}

function menuOff(name)
{
	getElement(name).style.visibility = 'hidden';
}

function menuOn(name)
{
	getElement(name).style.visibility = 'visible';
}

function number_format(number, decimals, dec_point, thousands_sep)
{
	var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
	var d = dec_point == undefined ? "." : dec_point;
	var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
	var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}


$(document).ready (function() {

	$('#porownaj-table tr:even td').addClass('tabledark');
	$('#porownaj-table tr:last td').addClass('cenabrutto');
	$('#porownaj-table tr:last').prev().children().addClass('cenanetto');
/*	$('#porownaj-table tr td:contains(zł)').addClass('cena'); */

	$('table.print-parametres tr:even td').addClass('tabledark');
	$('#tabletech-dane table tr:even td').addClass('tabledark');
	$('#tabletech-dane table tr td:contains(:)').addClass('tablecap');
/*	$('#tabletech-dane table tr td:eq(1)').addClass('tablecap');  */
	$('.tablepolecane tr>td').addClass('border-top');
	$('.tablepolecane tr:eq(0) td').addClass('nonborder');

	$('#techtable tr td').hover(function() {
		$(this).removeClass('bg_off').addClass('bg_on');
	}, function() {
		$(this).removeClass('bg_on').addClass('bg_off');
	});

	$('#techtable tr td a').click(function() {
		$('#techtable tr td').removeClass('on');
		$(this).parent().addClass('on');
		return false;
	});

	function viewactivate(nazwa) {
		var ktora = $(nazwa);
		ktora = '';
		$('.techtable-content').hide();
		$(ktora).show();

		}

	$('#techtable tr td a').click(function() {
		$('.techtable-content').hide();
		switch (this.id) {
 			case 'dane':
			$('#tabletech-dane').show();
			break;

			case 'opis':
			$('#tabletech-opis').show();
			break;

			case 'wyposazenie':
			$('#tabletech-wyposazenie').show();
			break;

			case 'pliki':
			$('#tabletech-pliki').show();
			break;

			case 'polecamy':
			$('#tabletech-polecamy').show();
			break;

			case 'inne':
			$('#tabletech-inne').show();
			break;
		}
	});


});

function showInIframe(url, width, height, othersite)
{
	if(!arguments[1]) width = 500;
	if(!arguments[2]) height = 60;
	if(!arguments[3]) othersite = false;
	$.fancybox({'width':width,'height':height,'href':((othersite == true) ? '' : siteURL)+url,'type':'iframe'});
}
