var ajax = new sack();

function getSelect2(sel) {
	// Show the loading div
	$("#contentLoading").show();
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('select2').options.length = 0;		
	if(countryCode.length>0){
		ajax.requestFile = 'action.php?action=get_select_box&id='+countryCode+'&select=2';	// Specifying which file to get
		ajax.onCompletion = createSelect2;	// Specify function that will be executed after file has been found
		ajax.runAJAX();		// Execute AJAX function
	}
}

function createSelect2() {
	var obj = document.getElementById('select2');	
	eval(ajax.response);	// Executing the response from Ajax as Javascript code
	document.getElementById('select3').options.length = 0;
	ajax.requestFile = 'action.php?action=get_select_box&select=3';	// Specifying which file to get
	ajax.onCompletion = createSelect3;	// Specify function that will be executed after file has been found
	ajax.runAJAX();		// Execute AJAX function
	//$("#contentLoading").fadeOut("fast");
}

function createSelect3() {
	var obj = document.getElementById('select3');	
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
	$("#contentLoading").fadeOut("fast");
}

function loadContentA() {
// Show the loading div
$("#contentLoading").show();
// Hide the links
// Stops the user clicking more than once and putting
// excessive load on the server
$("#contentLinks").hide();
// Delete any pre-existingtable
$("#contentArea").empty();

// Load the data
$.get("test.php", {type: "A"}, function(data) {
// When the Ajax call finishes:
// fade out the loading div
$("#contentLoading").fadeOut("fast");
// bring back the links for the user to click on
$("#contentLinks").show();
// append the table of data to the contentArea div
$("#contentArea").append(data);
// tie the table sorter functionality to the table
$("#summaryData").tablesorter();
});
}
function addbookmark(title,address) {
		if (window.sidebar) //  dla firefoksa
		   window.sidebar.addPanel(title, address, "");
		else if(window.opera && window.print) { // dla opery
		   var elem = document.createElement('a');
		   elem.setAttribute('href',address);
		   elem.setAttribute('title',title);
		   elem.setAttribute('rel','sidebar');
		   elem.click();
		} 
		else if(document.all)// dla internet explorera
		   window.external.AddFavorite(address, title);
	}

