// <!--
// Browser identification
var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_ns    = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') ==-1));
var is_ns4up = (is_ns && (is_major >= 4));
var is_ie    = (agt.indexOf("msie") != -1);
var is_ie4up = (is_ie  && (is_major >= 4));
var is_docom = (document.getElementById);
var is_nn6   = (!document.all && document.getElementById);
if (is_ie) {
        is_docom = 0;
}
if (is_docom) {
        is_ns    = 0;   
        is_ns4up = 0;   
}

// PopUp Menus...
var LAYER = 0;
var lastMenu = false;
var timeOut = 1000;   
var timeoutId = false;

//NS4 = (document.layers) ? 1 : 0;
//IE = (document.all) ? 1 : 0;
NS = (is_ns4up) ? 1 : 0;
IE = (is_ie4up) ? 1 : 0;
DC = (is_docom) ? 1 : 0;
NN6 = (is_nn6)  ? 1 : 0;
LAYER = (NS || IE || DC || NN6) ? 1 : 0;

if (IE || NN6) {
  SHOW = "visible";
  HIDE = "hidden";
} else if (NS || DC) {
  SHOW = "show";
  HIDE = "hide";
}


// Floating menu
function createLayers(menuName,topPos) {
        if (LAYER) {
         	if (NS) {
 			screenWidth = window.innerWidth;
        		document.layers[menuName].left = 165;
                        document.layers[menuName].top  = topPos;
                } else if (DC || NN6) {
                        screenWidth = window.innerWidth;
                        document.getElementById(menuName).style.left = 165;
 			document.getElementById(menuName).style.top  = topPos;
        	} else if (IE) {
          		//topPos = topPos + 15;
                       	screenWidth = document.body.clientWidth + 18;
          		document.all[menuName].style.pixelLeft = 165;
          		document.all[menuName].style.pixelTop  = topPos;
           	}
        }
}



function kick(menuName,status,topPos) {
        if (LAYER) {
                if (status) {
                        createLayers(menuName,topPos);
                        if (NS) {
                                document.layers[menuName].visibility = SHOW;
                	} else if (DC || NN6) {
                   		document.getElementById(menuName).style.visibility = SHOW;
                  	} else if (IE) {
                      		document.all[menuName].style.visibility = SHOW;
                	}
                } else {
 			if (NS) {
                                document.layers[menuName].visibility = HIDE;
			} else if (DC || NN6) {
                		document.getElementById(menuName).style.visibility = HIDE;
                        } else if (IE) {
                    		document.all[menuName].style.visibility = HIDE;
         	        }
 		}
        }
}





function popUp(menuName,show,topPos) {
	if (LAYER) {
		if (lastMenu) {
			kick(lastMenu,false,topPos);
		}
		if (show) {
			kick(menuName,true,topPos);
		}
	lastMenu = menuName;
	clearTimeout(timeoutId);
	}
}

function hide(menuName,topPos) {
	toFunc = "popUp('" + menuName + "',false,'" + topPos + "')";
	timeoutId = setTimeout (toFunc,timeOut);
}

// Live...
function eradio(file) {
var w=260;
var h=300;
var l=(40);
var t=(20);

        window.open (file,'_blank','scrollbars=0,status=0,menubar=0,resizable=0,location=0,toolbar=0,width=' + w + 
',height=' + h + ',left=' + l + ',top=' + t);}

// forum
function pop_forum_form(file) {
var w=450;
var h=600;
var l=(40);
var t=(20);

window.name="_target";
        window.open (file,'_blank','scrollbars=0,status=0,menubar=0,resizable=1,location=0,toolbar=0,width=' + w + 
',height=' + h + ',left=' + l + ',top=' + t);}


// Livex.
function xradio(file) {
var w=300;
var h=500;
var l=(screen.width-w-40);
var t=(20);

        window.open (file,'_blank','scrollbars=1,status=0,menubar=0,resizable=1,location=0,toolbar=0,width=' + w + 
',height=' + h + ',left=' + l + ',top=' + t);}

// Contact
function kontakt(file) {
var w=300;
var h=405;
var l=(screen.width-w-40);
var t=(20);

        window.open (file,'_blank','scrollbars=0,status=0,menubar=0,resizable=1,location=0,toolbar=0,width=' + w + 
',height=' + h + ',left=' + l + ',top=' + t);}

// Print
function printpopup(id) {
var w=214;
var h=310;
var l=(screen.width-w-40);
var t=(20);

        window.open ('/_print/' + id,'_blank');
}

// Send Email
function mailem(id) {
var w=300;
var h=500;
var l=(screen.width-w-40);
var t=(20);

        window.open ('/_mailem/' +
id,'_blank','scrollbars=0,status=0,menubar=0,resizable=0,location=0,toolbar=0,width=' + w + ',height=' + h +
',left=' + l + ',top=' + t);
}

// popup okno - obecne
var info;
function okno(info) {
window.open(info[0],'_blank',"scrollbars=1,status=0,menubar=0,resizable=1,location=0,toolbar=0,left="+info[2]+",top="+info[3]+",width="+info[4]+",height="+info[5]);
}




//window popup - GALERIE s Titulkem, Podtitulkem a autorem
var pole;
function galerie(pole) {

var vyska = parseInt(pole[1])+100;
var sirka = pole[0];
var titlebody = "height="+vyska+",width="+sirka+",resizable=1,scrollbars=auto";
var imgInfo = "<div class='popupImgInfo'><strong>"+pole[2]+"</strong><br /><span>"+pole[4]+"</span><br /><span class='date'>"+pole[8]+",</span>&nbsp;Autor:&nbsp;<a href='"+pole[7]+"' title='"+pole[5]+"&nbsp;"+pole[6]+"'>"+pole[5]+pole[6]+"</a></div>"; 

newwindow=window.open('','name',titlebody);
newwindow.document.write('<html><head><title>Galerie</title><link rel="stylesheet" href="/default/default/kostra.css" type="text/css" media="all"/><link rel="stylesheet" href="/default/default/styly.css" type="text/css" media="all"/><link rel="stylesheet" href="/zelenavlna/default/barvy.css" type="text/css" media="all"/></head><body style="background-color:#E6E7E6" leftMargin="0" topMargin="0" MARGINHEIGHT="0 " MARGINWIDTH="0">');
newwindow.document.write('<div align="center">');
//newwindow.document.write(imgInfo);
newwindow.document.write('<img title="po kliknutí se popup okno zavøe"  onclick="window.close()"  border="0" src="http://media.rozhlas.cz/_obrazek/');
newwindow.document.write(pole[3]);
newwindow.document.write('" />');
newwindow.document.write(imgInfo);
newwindow.document.write('</div>');
newwindow.document.write('</body></html>');
newwindow.document.close();
}


//automaticke popup okenko
function okenko(sir,vys,adr){
 //okenko se statusem
 var xsirka=window.screen.width; var xvyska=window.screen.height;
 var xleft=Math.round((xsirka-sir)/2)

 var modif = 12;
 if (parseInt(vys)+150 > xvyska) modif = 42;
 var xtop=Math.round((xvyska-vys)/2)-modif

 if (adr.indexOf("/") > 0) {
  var cc = adr.lastIndexOf("/")+1;
  var jmn = adr.substr(cc, 4);
 }
 else {
  var jmn = adr.substr(0, adr.indexOf("."));
 }

 var parametry = "left="+xleft+",top="+xtop+",width="+sir+",height="+vys+",toolbar=0,directories=0,menubar=0,scrollbars=yes,location=0,status=1,resizable=1"

 var okenko=window.open(adr,jmn,parametry);
 //return okenko;
}



// Vysilace
function vysilace(file) {
var w=600;
var h=580;
var l=(screen.width-w-40);
var t=(20);

        window.open (file,'_blank','scrollbars=1,status=0,menubar=0,resizable=0,location=0,toolbar=0,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t);}



//audiokosik
function audio(file) {
var w=300;
var h=120;
var l=(screen.width-w-200);
var t=(200);

window.open ('http://www2.rozhlas.cz/ondemand/pridat.php?'+file,'_blank','scrollbars=1,status=0,menubar=0,resizable=1,location=0,toolbar=0,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t);}
	

var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
function ticker() {
 var i,k,msg=val;
 k=(2000/msg.length)+1;
 for(i=0;i<=k;i++) msg+=" "+msg;
 document.form2.ticker.value=
 msg.substring(position,position+2000);
 if(position++==2000) position=0;
 id=setTimeout("ticker()",2000/22);
  }
 function action() {
     if(!pause) {
         clearTimeout(id);
     pause=1;
  }
  else {
  ticker();
  pause=0;
  }
  }

// ---- Popup na Zive vysilani ----
function popup_zive(file,sirka,vyska) {
	//alert (file);
	var w=sirka;
	var h=vyska;
	var l=(screen.width-w-200);
	var t=(20);

	        window.open (file,'_blank','scrollbars=0,status=0,menubar=0,resizable=0,location=0,toolbar=0,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t);
			}



function testPROHL(id){
        if (!(document.all && document.getElementById)){
	                document.writeln('<td class="text" style="padding:16px 4px 0px 15px;vertical-align:top;width:36px;"><object type="application/x-shockwave-flash" data="/img/flash/musicplayer/button/musicplayer.swf?playlist_url=http://www.rozhlas.cz/export/xspf2/?id='+id+'" width="17" height="17"><param name="movie" value="/img/flash/musicplayer/button/musicplayer.swf?playlist_url=http://www.rozhlas.cz/export/xspf2/?id='+id+'"/><param name="quality" value="high"/></object></td>');

			        }

				}

			


function getStyleObject(objectId) {
	            // cross-browser function to get an object's style object given its id
		                    if(document.getElementById && document.getElementById(objectId)) {
					                    // W3C DOM
							                    return document.getElementById(objectId).style;
									                        } else if (document.all && document.all(objectId)) {
													                // MSIE 4 DOM
															                return document.all(objectId).style;
																	            } else if (document.layers && document.layers[objectId]) {
																			                    // NN 4 DOM.. note: this won't find nested layers
																					                    return document.layers[objectId];
																							                        } else {
																											                return false;
																													                            }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
	            // get a reference to the cross-browser style object and make sure the object exists
		                    var styleObject = getStyleObject(objectId);
				                        if(styleObject) {
								                        styleObject.visibility = newVisibility;
											                        return true;
														                    } else {
																	                    // we couldn't find the object, so we can't change its visibility
																			                    return false;
																					                                                                        }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
	            // get a reference to the cross-browser style object and make sure the object exists
		                    var styleObject = getStyleObject(objectId);
				                        if(styleObject) {
								                                styleObject.left = newXCoordinate;
												                                        styleObject.top = newYCoordinate;
																	                                                return true;
																							                                                    } else {
																														                                                                    // we couldn't find the object, so we can't very well move it
																																						                                                                            return false;
																																															                                                                                }
} // moveObject



var xOffset = 0;
var yOffset = 0;

function showPopup (targetObjectId, eventObj) {
	            if(eventObj) {
			                    // hide any currently-visible popups
					                    hideCurrentPopup();
							                    // stop event from bubbling up any farther
									                    eventObj.cancelBubble = true;
										            // move popup div to current cursor position
											            // (add scrollTop to account for scrolling for IE)
				                var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
				                var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
				                //moveObject(targetObjectId, newXCoordinate, newYCoordinate);
																			                    // and make it visible
																					                    if( changeObjectVisibility(targetObjectId, 'visible') ) {
																								                // if we successfully showed the popup
																										            // store its Id on a globally-accessible object
																											                window.currentlyVisiblePopup = targetObjectId;
																													            return true;
																														            } else {
																																                // we couldn't show the popup, boo hoo!
																																		        return false;
																																			        }
																																				        } else {
																																						        // there was no event object, so we won't be able to position anything, so give up
																																							        return false;
																																								        }
} // showPopup

function hideCurrentPopup() {
	            // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
		                    if(window.currentlyVisiblePopup) {
					                            changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
								                            window.currentlyVisiblePopup = false;
											                        }
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
	            // this ugly little hack resizes a blank div to make sure you can click
		                    // anywhere in the window for Mac MSIE 5
				                        if ((navigator.appVersion.indexOf('MSIE 5') != -1)
								                        && (navigator.platform.indexOf('Mac') != -1)
											                        && getStyleObject('blankDiv')) {
								                        window.onresize = explorerMacResizeFix;
											                    }
													                            resizeBlankDiv();
																                        // this next function creates a placeholder object for older browsers
																			                createFakeEventObj();
}

function createFakeEventObj() {
	            // create a fake event object for older browsers to avoid errors in function call
		                    // when we need to pass the event object to functions
				                        if (!window.event) {
								                        window.event = false;
											                            }
} // createFakeEventObj

function resizeBlankDiv() {
	            // resize blank placeholder div so IE 5 on mac will get all clicks in window
		                    if ((navigator.appVersion.indexOf('MSIE 5') != -1)
					                    && (navigator.platform.indexOf('Mac') != -1)
							                    && getStyleObject('blankDiv')) {
					                    getStyleObject('blankDiv').width = document.body.clientWidth - 20;
							                    getStyleObject('blankDiv').height = document.body.clientHeight - 20;
									                                                }
}

function explorerMacResizeFix () {
	location.reload(false);
}


// -->

