	var iload = false;
	var skyLposYs = 9;
	var skyRposYs = 9;
	var page_ay = 0;
	var movobjTimer = new Array();

/* Get/Set x/y position from/to element B */
	function get_xPos(elm) {
		var xPos = 0;
		if (document.getElementById(elm) != null) {
			xPos = document.getElementById(elm).offsetLeft;
		}
		return xPos;
	}

	function set_xPos(from,to,dx) {
		if ((document.getElementById(from) != null)&&(document.getElementById(to) != null)) {
			dx += get_xPos(from);
			document.getElementById(to).style.left = dx + "px";
		}
	}

	function get_yPos(elm) {
		var yPos = 0;
		if (document.getElementById(elm) != null) {
			var parElement = document.getElementById(elm);
			while (typeof parElement == 'object' && parElement.tagName != 'BODY') {
				yPos += parElement.offsetTop;
				parElement = parElement.offsetParent;
			}
		}
		return yPos;
	}

	function set_yPos(from,to,dy) {
		if ((document.getElementById(from) != null)&&(document.getElementById(to) != null)) {
			dy += get_yPos(from);
			document.getElementById(to).style.top = dy + "px";
		}
	}
/* Get/Set x/y position from/to element E */


/* Show/Hide Box B */
	var HideTimer = new Array();

	function box_show(from,box,i,dif) {
		window.clearTimeout(HideTimer[i]);
		set_yPos(from,box,dif);
		document.getElementById(box).style.display = "block";
	}
	function box_show2(box) { document.getElementById(box).style.display = "block"; }
	
	function box_hide(box,i,time_hide) { HideTimer[i] = window.setTimeout("box_hide_now('"+box+"')",time_hide); }
	function box_hide_now(box) { document.getElementById(box).style.display = "none"; }

	/* volani funkce "return ! box_show_hide('type1sub')" pojistka při vypnutém scriptu <noscript><style>.xyz{display: block;}</style></noscript> */
	function box_show_hide(box) { 
		state = document.getElementById(box).style.display; 
		if (state == "block") {document.getElementById(box).style.display = "none"}
		else {document.getElementById(box).style.display = "block"};
	return true;}

	function box_show2_hide1(box1,box2) { 
	state = document.getElementById(box2).style.display; 
	if((state=='none')||(state=='')){box_show2(box2);box_hide_now(box1);} else {box_show2(box1); box_hide_now(box2)}
	return true;}

	function box_mouse_over(i) { window.clearTimeout(HideTimer[i]); }
	function box_mouse_out(box,i,time_mouse_out) { HideTimer[i] = window.setTimeout("box_hide_now('"+box+"')",time_mouse_out); }

	function box_mouse_over2(from,i) { document.getElementById(from).className = "mouse-over"; window.clearTimeout(HideTimer[i]); }
	function box_mouse_out2(from,box,i,time_mouse_out) { document.getElementById(from).className = ""; HideTimer[i] = window.setTimeout("box_hide_now('"+box+"')",time_mouse_out); }

	function set_style(to, styl) {
		document.getElementById(to).className = styl;
	}
/* Show/Hide Box E */


/* Move eTarget in detail*/
	function moveetarget() {
		var eTmove = document.getElementById('d-etarget');
		var eTmoved = document.getElementById('eTargetScript');
		var eThide = document.getElementById('d-etarget-main');
		eTmoved.innerHTML = eTmove.innerHTML;
		eThide.style.display = "none";
	}

	function moveAny(what,where,whatHide) {
		anymove = document.getElementById(what);
		anymoved = document.getElementById(where);
		anyhide = document.getElementById(whatHide);
		anymoved.innerHTML = anymove.innerHTML;
		anyhide.style.display = "none";
	}


/* Cookies B */
	var cookieArray = new Array();
	
	function parseCookie() {
		var cookieList=document.cookie.split("; ");
		for (var i=0; i < cookieList.length; i++) {
			var spl = cookieList[i].split("=");
			cookieArray[unescape(spl[0])] = unescape(spl[1]);
			//alert(spl[0] + " = " + cookieArray[unescape(spl[0])]);
		}
	}
	
	function getCookie(name) {
		if (cookieArray[name]) { return cookieArray[name]; } else { return ""; }
	}
	
	function setCookie(name, value, expire) {
		var cookielife = new Date();
		cookielife.setDate(cookielife.getDate() + expire);
		document.cookie = name + "=" + escape(value) + ((expire) ? "; expires=" + cookielife.toGMTString() : "");
	}
	
	parseCookie();
/* Cookies E */


/* Stylesheets B */
	var iHNedStyle;
	var iHNedStyleCount=2;

	function setStylesheet(id) {
		var spl;
		var str;
		
		if (!id) id = 1;
		
		for (var i=1; i < 4; i++) {
			if (document.getElementById("stylesheet" + i)) {
				str = document.getElementById("stylesheet" + i).href;
				spl = str.split("_");
				document.getElementById("stylesheet" + i).href = spl[0] + "_" + id + ".css";
				setCookie("stylesheet", id, 1000);
			}
		}
		if (iload) { setHTML(id); }
	}

	function changeStylesheet() {
		iHNedStyle++;
		if (iHNedStyle>iHNedStyleCount) iHNedStyle = 1;
		setStylesheet(iHNedStyle);
	}

	function setHTML(id) {
		var spl;
		var str;
		//zmeny v html
		if (document.getElementById("logo")) {
			str = document.getElementById("logo").src;
			spl = str.split("_");
			document.getElementById("logo").src = spl[0] + "_" + (id ? id : "1") + ".gif";
		}
		if (document.getElementById("design2")) {
			if (id == 2) {
				document.getElementById("design2").innerHTML = "Alternativní grafiku pro iHNed.cz dodala <a href='http://www.mediafactory.cz/'>MEDIA FACTORY</a>.";
			} else {
				document.getElementById("design2").innerHTML = "";
			}
		}
	}

	iHNedStyle = parseInt(getCookie("stylesheet"));
	if (!iHNedStyle) iHNedStyle = 1; 
	if (iHNedStyle!=1) setStylesheet(iHNedStyle);
/* Stylesheets E */


/* Rotator B */
function Rotator (name, w, h, d, x, y, c, s, p, obj) {
	this.NAME = name;
	this.WIDTH = w;
	this.HEIGHT= h;
	this.DIRECTION = d;
	this.X = x;
	this.Y = y;
	this.COUNT = c;
	this.SPEED = s;
	this.PAUSE = p;
	this.OBJ_ID = obj;
	
	this.DX = 0;
	this.DY = 0;
	this.TimerID = 0;
	this.STOPonPAUSE = false;
	this.AX = new Array(this.COUNT);
	this.AY = new Array(this.COUNT);
	
	this.on = rotator_on;
	this.off = rotator_off;
	this.rotuj = rotator_rotuj;
	this.setdirection = rotator_setdirection;
	this.stoponpause = rotator_stoponpause;
	
	if (this.DIRECTION=="up") { this.DY = -1; }
	if (this.DIRECTION=="down") { this.DY = 1; }
	if (this.DIRECTION=="left") { this.DX = -1; }
	if (this.DIRECTION=="right") { this.DX = 1; }
	
	this.AX1 = this.DX * this.WIDTH;
	this.AY1 = this.DY * this.HEIGHT;
	
	for (var i=0; i < this.COUNT; i++) {
		this.AX[i] = this.DX*i*this.WIDTH*(-1);
		this.AY[i] = this.DY*i*this.HEIGHT*(-1);
	}
	
	if (((w==x)&&(this.DX)) || ((h==y)&&(this.DY))) {
		this.TimerID = setTimeout(this.NAME + ".rotuj()", 1);
	} else {
		this.TimerID = setTimeout(this.NAME + ".rotuj()", this.PAUSE);
	}
}

function rotator_on() {
	this.STOPonPAUSE = false;
	clearTimeout(this.TimerID);
	this.TimerID = setTimeout(this.NAME + ".rotuj()", this.SPEED);
}

function rotator_off() {
	clearTimeout(this.TimerID);
}

function rotator_stoponpause() {
	this.STOPonPAUSE = true;
}

function rotator_setdirection(d) {
	if (this.DIRECTION != d) {
		this.DIRECTION = d;
		this.DX = 0;
		this.DY = 0;
		if (this.DIRECTION=="up") { this.DY = -1; }
		if (this.DIRECTION=="down") { this.DY = 1; }
		if (this.DIRECTION=="left") { this.DX = -1; }
		if (this.DIRECTION=="right") { this.DX = 1; }
		this.AX1 += (this.DX * this.WIDTH * this.COUNT);
		this.AY1 += (this.DY * this.HEIGHT * this.COUNT);
		clearTimeout(this.TimerID);
	}
}

function rotator_rotuj() {
	var next = this.SPEED;
	var paus = false;
	
	for (var i=0; i < this.COUNT; i++) {
		if (this.DX) {
			if ( ( (this.AX[i] <= this.AX1)&&(this.DX < 0) ) || ( (this.AX[i] >= this.AX1)&&(this.DX > 0) ) ) {
				if (this.AX[i] != this.AX1) this.AX[i] = this.AX1;
				this.AX[i] += (this.DX * this.WIDTH * (-1) * this.COUNT); next = this.PAUSE; paus = true;
			}
		}
		if (this.DY) {
			if ( ( (this.AY[i] <= this.AY1)&&(this.DY < 0) ) || ( (this.AY[i] >= this.AY1)&&(this.DY > 0) ) ) {
				if (this.AY[i] != this.AY1) this.AY[i] = this.AY1;
				this.AY[i] += (this.DY * this.HEIGHT * (-1) * this.COUNT); next = this.PAUSE; paus = true;
			}
		}
	}
	if (!paus) {
		for (i=0; i < this.COUNT; i++) {
			if (this.DX) {
				this.AX[i] += (this.DX * this.X);
				document.getElementById(this.OBJ_ID + i).style.left = this.AX[i]+"px";
			}
			if (this.DY) {
				this.AY[i] += (this.DY * this.Y);
				document.getElementById(this.OBJ_ID + i).style.top = this.AY[i]+"px";
			}
		}
	}
	
	this.TimerID = setTimeout(this.NAME + ".rotuj()", next);
	
	if (this.STOPonPAUSE && paus) clearTimeout(this.TimerID);
}
/* Rotator E */

/* CharMen B*/

function ShowCharMen() {
	if (this.SCOUNT==0) {
		document.getElementById(this.NAMES+this.MCOUNT).style.display = 'none';
		this.MCOUNT++;
		if(this.MCOUNT==this.ITEMS) {this.MCOUNT=0};
		document.getElementById(this.NAMES+this.MCOUNT).style.display = 'inline';
	}
	if(this.SCOUNT<=this.CHARNAMES[this.MCOUNT].length) {
		document.getElementById(this.NAMES+this.MCOUNT).innerHTML = this.CHARURLS[this.MCOUNT]+this.CHARNAMES[this.MCOUNT].substr(0,this.SCOUNT++)+'</a>';
		this.STIMER=setTimeout(this.OBJ + ".RUN()",this.CHARSPEED);
	} else {
		this.SCOUNT=0;
		if (this.MARKED==0) { this.STIMER=setTimeout(this.OBJ + ".RUN()",this.TITLESPEED); }
	}
}

function CharMen_on() {
	this.MARKED = 0;
	clearTimeout(this.STIMER);
	this.STIMER = setTimeout(this.OBJ + ".RUN()",this.CHARSPEED);
}

function CharMen_off() {
	this.MARKED = 1;
}

function CharMen_prev() {
	clearTimeout(this.STIMER);
	this.SCOUNT=0;
	document.getElementById(this.NAMES+this.MCOUNT).style.display = 'none';
	if(this.MCOUNT==1) {
		this.MCOUNT=this.ITEMS-1; 
	} else {
		if(this.MCOUNT==0) {
			this.MCOUNT=this.ITEMS-2;
			if(this.MCOUNT<0) {
				this.MCOUNT=0;
			}
		} else {
			this.MCOUNT -= 2;
		}
	}
	this.STIMER=setTimeout(this.OBJ + ".RUN()",this.CHARSPEED);
}

function CharMen_next() {
	clearTimeout(this.STIMER);
	this.SCOUNT=0;
	this.STIMER=setTimeout(this.OBJ + ".RUN()",this.CHARSPEED);
}

function CharMen(obj,count_items,name_item,CharSpeed,TitleSpeed) {
	this.OBJ = obj;
	this.ITEMS = count_items;
	this.NAMES = name_item;
	this.CHARSPEED = CharSpeed;
	this.TITLESPEED = TitleSpeed;
	this.CHARNAMES = new Array(this.ITEMS);
	this.CHARURLS = new Array(this.ITEMS);
	this.MCOUNT = 0;
	this.STIMER = 0;
	this.SCOUNT = 0;
	this.MARKED = 0;
	this.RUN = ShowCharMen;
	this.STOP = CharMen_off;
	this.CONTINUE = CharMen_on;
	this.PREV = CharMen_prev;
	this.NEXT = CharMen_next;
	
	for ( ch=0; ch<this.ITEMS; ch++ ) {
		this.CHARNAMES[ch] = document.getElementById(this.NAMES + ch).innerHTML;
		this.CHARURLS[ch] = this.CHARNAMES[ch].substring(this.CHARNAMES[ch].indexOf('<'), this.CHARNAMES[ch].indexOf('>',this.CHARNAMES[ch].indexOf('<') + 1) + 1);
		this.CHARNAMES[ch] = this.CHARNAMES[ch].substring(this.CHARNAMES[ch].indexOf('>') + 1, this.CHARNAMES[ch].lastIndexOf('<'));
		
		document.getElementById(this.NAMES + ch).innerHTML = '';
		document.getElementById(this.NAMES + ch).style.display = 'none';
	}

	if(this.MCOUNT<=this.ITEMS) {this.STIMER=setTimeout(this.OBJ + ".RUN()",this.CHARSPEED);}
}
/* Charmen E */


function objmover(what,sx,sy,ex,ey,dx,dy,sp,id) {
	clearTimeout(movobjTimer[id]);
	if (sx<ex) {sx+=dx;} else {sx-=dx;}
	if (sy<ey) {sy+=dy;} else {sy-=dy;}
	if(dx){$(what).css("left",sx+"px");}
	if(dy){$(what).css("top",sy+"px");}
	if((sx!=ex)||(sy!=ey)) movobjTimer[id] = setTimeout('objmover("'+what+'",'+sx+','+sy+','+ex+','+ey+','+dx+','+dy+','+sp+','+id+')',sp);
}

function full_img_init(sml,src,tit,w,h) {
	$(sml).click(function(){
		var str = "<div><img src="+src+" alt='' width='"+w+"' height='"+h+"' title='"+tit+"' /><span>&nbsp;</span></div>";
		var dx = get_xPos("ihned")+5;
		$('#d-big-foto').html(str).css("top",(page_ay+25)+"px").css("left",(dx+20)+"px");
		$("#d-big-foto-bg").css("top",(page_ay+5)+"px").css("left",dx+"px").css("width",(w+40)+"px").css("height",(h+40)+"px").fadeTo(0, 0.95).show("fast");
		$('#d-big-foto').show("normal");
	});
}


/* On load */
function on_load() {
	iload = true;
	set_yPos("top","r-spon", 23);
}

function on_load2() {
	iload = true;
	set_xPos("ihned","r-sky", 999);
	if (document.getElementById("col3line") != null) setTimeout('document.getElementById("col3line").style.height = (get_yPos("foot") - get_yPos("col3line") - 4) + "px"', 1000);
	
	//var skyl = $("#r-sky-l .reklama DIV").html();
	var skyl = get_yPos("sky-l-end");
	if ((skyl>100) || (skyl<0)) {
		set_xPos("ihned","r-sky-l", -119);
		$("#r-sky-ozn").css("display","none");
		$("#r-sky").css("padding-left","2px");
	}
}

window.onresize = function() { set_xPos("ihned","r-sky", 999); set_xPos("ihned","r-sky-l", -119); }

$(document).ready(function(){

	$("#d-big-foto").click(function(){
		$("#d-big-foto-bg").hide("normal");
		$("#d-big-foto").hide("normal");
	});

});

$(window).scroll(function(){
	page_ay = document.body.scrollTop;
});