function popup_friend(site) {
	window.open('/popup_friend.xml?site=/'+site, 400, 300)
}

function popup_product(symbol) {
	popup_friend(symbol+',products.xml');
}


function favorite(name,url)
{
	if (window.external) window.external.AddFavorite(url, name)
	if (window.sidebar) window.sidebar.addPanel(name, url, "");
}


function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    { 
	    c_start=c_start + c_name.length+1; 
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    } 
	  }
	return "";
}

function setlang(lang) {
	setCookie('quantum_lang_code',lang,30);
	if (lang=='en') {
		setcurrency(2);
	} else if (lang=='de') {
		setcurrency(2);
	} else {
		setcurrency(1);
	}
	//http_request('/flush_cache.xml');
	window.location.reload();
}

function setcurrency(currency) {
	setCookie('quantum_currency',currency,30);
	//http_request('/flush_cache.xml');
	window.location.reload();
}

function init() {
	expand_menu();
}


function http_request(url) {
	if (window.XMLHttpRequest) {
		var xmlhttp = new XMLHttpRequest(); 
	} else if (window.ActiveXObject) { 
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.open('POST', url, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if (xmlhttp.status == 200) {
				window.location.reload();
			} else {
				draw_popup(url);
			}
		}
	}
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.send(null);
	draw_wait();
}



function ajax_get(url,div) {
	if (window.XMLHttpRequest) {
		var xmlhttp = new XMLHttpRequest(); 
	} else if (window.ActiveXObject) { 
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	t=document.getElementById(div);
	xmlhttp.open('POST', url, true);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if (t) {
				t.innerHTML=xmlhttp.responseText;
				return true;
			}
		}
	}
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.send(null);
	t.innerHTML='<div align="center"><br /><img src="/images/ajax.gif" /></div>';
}

function n_ajax_get(url,div) {
	new Ajax.Request(url, {
	  method: 'POST',
	  onComplete: function(transport) {
		t=document.getElementById(div);
		t.innerHTML=transport.responseText;
		if (div=="categories_left") {
			if(typeof mark_nodes == 'function') {
				mark_nodes();
			}
		}
	  }
	});
}


function draw_popup(url){
	var caption='&#160;';
	var modal=true;
	var width="1000";
	var height="650";
	var draw_this=(OLns4?'<form action="javascript:void(0);" id="popup">':'')
	+'<div style="font-size:4px;;line-height:2px;">&nbsp;<br \/><br \/><\/div>'
	+'<div align="center" style="overflow-y: scroll;"><img src="' + url + '" /></div>'
	+(OLns4?'<\/form>':'');

	overlib(draw_this, EXCLUSIVEOVERRIDE, WIDTH, width, HEIGHT, height, caption?CAPTION:DONOTHING, caption?caption:DONOTHING,CLOSECLICK, CLOSETEXT,'<img src="/quantum/images/console/menu_bar/taskDelete.gif" border="0" width"14" height="14"/>',
	CAPTIONPADDING,4, TEXTPADDING,10, BGCLASS,'olbgD', BORDER,1,
	CGCLASS,'olcgD', CAPTIONFONTCLASS,'olcapD', CLOSEFONTCLASS,'olcloD',
	FGCLASS,'olfgD', TEXTFONTCLASS,'oltxtD',
	SHADOW, SHADOWCOLOR,'#A0A0A0', modal?MODAL:DONOTHING,
	 STICKY, EXCLUSIVE, SCROLL, MIDX,0, MIDY,0,MODALCOLOR,'#000');
}



function switch_wojewodztwo1(kraj) {

	if (kraj.value!= "20" ) {
		obj=document.getElementById('wojewodztwo');
		obj.value='17';
		obj.disabled=true;
		if (d1 && d2) {
			d1.style.display='none';
			d2.style.display='';
		}
	} else {
		obj=document.getElementById('wojewodztwo');
		obj.disabled=false;
		if (d1 && d2) {
			d1.style.display='';
			d2.style.display='none';
		}

	}
}


function set_last_category(category) {

	setCookie('quantum_last_category',category,30);

}

function mark(id) {
	o=document.getElementById('link_'+id);
	if (o) {
		o.style.color="#0B5D91";
	}

}

