function saveank(aoid,ankid)
{
	var apath = location.href.split("#");
	var l = apath[0].length;
	var path = apath[0];
	if (apath[0].indexOf('?')>0)
	{
		if (apath[0].substring(l-1,l)!='?') path += '&';
	}
	else path += '?';
	path += "aoid="+aoid+"&ankid="+ankid;
	location.href = path;
}


/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ SWITCH CUSTOM DIVs
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
function switchCard(prefix, id)
{
	var card;
	var tab;
        
        var sw = document.getElementById(prefix + "switchedCard");
        if (!sw) return;
        var switchedCard = sw.value;

	if (switchedCard != 0) {
		card = document.getElementById(prefix + "card" + switchedCard);
		tab = document.getElementById(prefix + "tab" + switchedCard);
		
		tab.className = prefix +  "tab" + "ON";
		
		card.style.display = 'none';
	}
	switchedCard = id;
	

	if (switchedCard != 0) {
		card = document.getElementById(prefix + "card" + switchedCard);
		tab = document.getElementById(prefix + "tab" + switchedCard);
		card.style.display = 'block';
		tab.className = prefix +  "tab" + "OFF";
		
	}								
	
	sw.value = id;
}
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ END
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/

function urlize(str) {
  //to lowercase
  str = str.toLowerCase();
  
  //replace czech characters (more can be added)
  str = str_replace("ě","e",str);
  str = str_replace("š","s",str);
  str = str_replace("č","c",str);
  str = str_replace("ř","r",str);
  str = str_replace("ž","z",str);
  str = str_replace("ý","y",str);
  str = str_replace("á","a",str);
  str = str_replace("í","i",str);
  str = str_replace("é","e",str);
  str = str_replace("ú","u",str);
  str = str_replace("ů","u",str);
  str = str_replace("ó","o",str);
  str = str_replace("ď","d",str);
  str = str_replace("ť","t",str);
  str = str_replace("ň","n",str);
  
  
  //special chars replacement
  str = str_replace("<br>","_",str);
  str = str_replace(" ","_",str);
  str = str_replace("&","_",str);
  str = str_replace(",","_",str);
  str = str_replace("-","_",str);

  str = str_replace("__","_",str);
  
   
   //get rid of non ASCII chars
   var ret = "";
   var i;
   for (i=0;i<=str.length-1;i++){
		
		n = str.charCodeAt(i);
		if ((n>47 && n<58) ||  (n>64 && n<91) || (n>96 && n<123) || n == 95) ret+=str.charAt(i);
		else ret+="_";

   }
   str = ret;

  str = str_replace("__","_",str);
  str = str_replace("__","_",str);
  str = str_replace("__","_",str);
  str = str_replace("__","_",str);
  str = str_replace("__","_",str);

  
  str = trim(str);
  if (str == "_") str = "";
  return str;
}

