  function saveCookie(name,value,days) {
	if (days) {
		var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires="; expires="+date.toGMTString()
	} else expires=""
	document.cookie=name+"="+value+expires+"; path=/"
}

function readCookie(name) {
	var nameEQ=name+"="
	var ca=document.cookie.split(';')
	for(var i=0;i<ca.length;i++) {
		var c=ca[i];
		while (c.charAt(0)==' ') c=c.substring(1,c.length)
		if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length)
	}
	return null
}

function switchA(elm, url)
{
	var formAction = gE(elm).action;
	
	if(url == formAction)
	return null;
	
	gE(elm).action=url;
}

function saveBookmark(id){
	bookmark_string=bookmark_string+','+id;
	saveCookie('bookmarks',bookmark_string,15);
}

function hideAd(id){
	adE=gE(id);
	var adsize=getElmSize(adE);
	cur_w=adsize['x'];
	cur_h=adsize['y']-80;
	dest_w=1;
	dest_h=1;
	timer = setInterval("hide_anim(adE)",10);
}

function delBookmark(id){
bookmark_array=bookmark_string.split(',');
bookmark_string="";
	for (i=0;i<bookmark_array.length;i++){
		if (bookmark_array[i]!=id)bookmark_string=bookmark_string+","+bookmark_array[i];	
	}

bookmarks_count--;
if (bookmarks_count==0){
bookmark_string="";
hE(fav_ads_linkE);
}
saveCookie('bookmarks',bookmark_string,15);
}





function st(ad){
adE=gE(ad);
var adposition=getElmPosition(adE);
var adsize=getElmSize(adE);



cur_x=adposition['x'];
cur_y=adposition['y'];
cur_w=adsize['x'];
cur_h=adsize['y'];

sX(borderE,cur_x);
sY(borderE,cur_y);
sW(borderE,cur_w);
sH(borderE,cur_h);
sE(borderE);

dest_x=linkposition['x'];
dest_y=linkposition['y'];
dest_w=linksize['x'];
dest_h=linksize['y'];

timer = setInterval("book_anim()",10);

}




function book_anim() {

del=10;//rychlost animacie

if (cur_x != dest_x) {if (cur_x < dest_x) cur_x += Math.ceil((dest_x - cur_x)/del);else cur_x += Math.floor((dest_x - cur_x)/del);}
if (cur_y != dest_y) {if (cur_y < dest_y) cur_y += Math.ceil((dest_y - cur_y)/del);else cur_y += Math.floor((dest_y - cur_y)/del);}
if (cur_w != dest_w) {if (cur_w < dest_w) cur_w += Math.ceil((dest_w - cur_w)/del);else cur_w += Math.floor((dest_w - cur_w)/del);}
if (cur_h != dest_h) {if (cur_h < dest_h) cur_h += Math.ceil((dest_h - cur_h)/del);else cur_h += Math.floor((dest_h - cur_h)/del);}

if (cur_x == dest_x&&cur_y == dest_y){
	clearInterval(timer);
	hE(borderE);
	sE(fav_ads_linkE);
}

sX(borderE,cur_x);
sY(borderE,cur_y);
sW(borderE,cur_w);
sH(borderE,cur_h);

}


function hide_anim() {

del=10;//rychlost animacie

if (cur_w != dest_w) {if (cur_w < dest_w) cur_w += Math.ceil((dest_w - cur_w)/del);else cur_w += Math.floor((dest_w - cur_w)/del);}
if (cur_h != dest_h) {if (cur_h < dest_h) cur_h += Math.ceil((dest_h - cur_h)/del);else cur_h += Math.floor((dest_h - cur_h)/del);}

if (cur_w == dest_w&&cur_h == dest_h){
	clearInterval(timer);
	hE(adE);
}

sW(adE,cur_w);
sH(adE,cur_h);

}

Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};


function start(n){
n1=n;n2=(n%3)+1;n3=((n+1)%3)+1;
nexth=n2;
clearTimeout(c);
if (run&&(cy == dy)){
	cy=0;
	dy=-rh;
		for (i=1;i<=hotnum;i++){
			if(!static.inArray(i)){
				eval ("from"+i+"E=gE('h"+i+n1+"');sE(from"+i+"E);");
				eval ("to"+i+"E=gE('h"+i+n2+"');sY(to"+i+"E,rh);sE(to"+i+"E);");
				eval ("h"+i+"E=gE('h"+i+n3+"');hE(h"+i+"E);");
				}
		}
		hot_timer = setInterval("hot_anim()",30);
		eval ("c=setTimeout('start("+n2+")', hot_rotation_interval);")
}
else{
eval ("c=setTimeout('start("+n+")', 1000);")
}
}


function hot_anim(){
del=8;
if (cy != dy) {if (cy < dy) cy += Math.ceil((dy - cy)/del);else cy += Math.floor((dy - cy)/del);}
for (i=1;i<=hotnum;i++){
	if(!static.inArray(i)){
		eval("sY(from"+i+"E,cy);");
		eval("sY(to"+i+"E,cy+rh);");
		}
}
if (cy == dy){
	clearInterval(hot_timer);
}
}  