/*--------------------------------------------------|
| smartCMS 2 | www.darktown.pl                      |
|---------------------------------------------------|
| Copyright (c) 2002-2008 Marcin Borkowski          |
|                                                   |
| All rights reserved.                              |
| Updated: 17.02.2008                               |
|--------------------------------------------------*/


function hoverOption(id,sp) {
	/*
	if(sp == "normal") {
		if(id.getElementsByTagName("p")[0]) {
			id.getElementsByTagName("p")[0].style.color = "#666666";
		}
		id.style.backgroundColor = "transparent";
	}
	else {
		if(id.getElementsByTagName("p")[0]) {
			id.getElementsByTagName("p")[0].style.color = "#000000";
		}
		id.style.backgroundColor = "#F0F0F0";
	}
	*/
}
function getURL(loc) {
	document.location.href = loc;
}
function showPicDescription(desc) {
	//document.getElementById("picDesc").innerHTML = desc;
}
       			function load() {
				if(document.getElementById("map")) {
       				if (GBrowserIsCompatible()) {
       					var map = new GMap2(document.getElementById("map"));
       					map.addControl(new GSmallMapControl());
       					map.setCenter(new GLatLng(52.179498, 21.193464), 15);
       					// Create our "tiny" marker icon
       					var icon = new GIcon();
       					icon.image = "http://labs.google.com/ridefinder/images/mm_20_blue.png";
       					icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
       					icon.iconSize = new GSize(12, 20);
       					icon.shadowSize = new GSize(22, 20);
       					icon.iconAnchor = new GPoint(6, 20);
       					icon.infoWindowAnchor = new GPoint(5, 1);
       
       					// Our info window content		
                                              var info =  "<p align='center'><img src='http://oriko.pl/w/gfx/logo_normal.jpg' alt='' style='margin-bottom:15px;'/></p>"; 
                                              var point = new GLatLng(52.179498, 21.193464);  
                                              var marker = new GMarker(point);  
                                              GEvent.addListener(marker, "click", function() {  
                                              marker.openInfoWindowHtml(info);});  
                                              map.addOverlay(marker);  
                                              // wywietl dymek po zaadowaniu strony  
                                              marker.openInfoWindowHtml(info);  
       				}
				}
       			}

var newsBegin = 0;
function nextNews(lang) {
	newsBegin += 4;
	advAJAX.get({
		url: "ajaxnews.php",
		lang : lang,
		sf : newsBegin,
		onSuccess : function(obj) { if(obj.responseText.length > 44) { document.getElementById("nius").innerHTML = obj.responseText; } else { newsBegin -= 4; } },
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}
function prevNews(lang) {
	newsBegin -= 4;
	if(newsBegin < 0) {
		newsBegin = 0;
	}
	advAJAX.get({
		url: "ajaxnews.php",
		lang : lang,
		sf : newsBegin,
		onSuccess : function(obj) { if(obj.responseText.length > 44) { document.getElementById("nius").innerHTML = obj.responseText; } else { newsBegin += 4; }},
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}
function showMap() {
	mapWindow = window.open('mapa.php', 'mapWindow', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width=600, height=400')	
}
function addToBasket(pid,title) {
	advAJAX.get({
		url: "../../../addtobasket.php",
		pid : pid,
		title : title,
		onSuccess : function(obj) { document.getElementById("shopBasket").innerHTML = obj.responseText; if(title) { alert("Nowa zawartość w koszyku:\n" + title); } },
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}
function createOrder() {
	advAJAX.get({
		url: "../../../order.php",
		onLoading : function(obj) { document.getElementById("items").innerHTML = "<div class=\"loadingInfo\"><img src=\"../../../gfx/ajax-loader.gif\" alt=\"loading ...\"/> proszę czekać, trwa przetwarzanie danych ...</div>" },
		onSuccess : function(obj) { document.getElementById("items").innerHTML = obj.responseText; },
		onError : function(obj) { alert("Error: " + obj.status); }		
	});	
}
function cleanBasket() {
	var clean = 1;
	var pid = "loading";
	advAJAX.get({
		url: "../../../addtobasket.php",
		pid : pid,
		clean : clean,		
		onSuccess : function(obj) { document.getElementById("shopBasket").innerHTML = obj.responseText; alert("Koszyk został opróżniony."); },
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}
function actOrder(id,count) {
	advAJAX.get({
		url: "../../../orderactualize.php",
		id : id,
		count : count,		
		onSuccess : function(obj) { },
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}
