// <!--

function myokno(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.lastIndexOf("/") > 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;
}


// 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]);
}


var rnpudaje;
function rnpplayer(rnpudaje) {
window.open(rnpudaje[0]+'&br='+rnpudaje[6]+'&s='+rnpudaje[7],'_blank',"scrollbars=0,status=0,menubar=0,resizable=1,location=0,toolbar=0,left="+rnpudaje[2]+",top="+rnpudaje[3]+",width="+rnpudaje[4]+",height="+rnpudaje[5]);
}


// forum
function pop_forum_form(file) {
var w=380;
var h=400;
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);}



// 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);
}


// 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);}


// window.screen.width,window.screen.height

//window popup - GALERIE
var pole;
function galerie(pole) {
var titlebody = "height="+pole[1]+",width="+pole[0]+",resizable=1,scroll=auto,scrollbars=0";
newwindow=window.open('','name',titlebody);
newwindow.document.write('<html><head><title>Galerie</title></head><body text="#000000" bgColor="white" leftMargin="0" topMargin="0" MARGINHEIGHT="0 " MARGINWIDTH="0">');
//newwindow.document.write('<div align="center" style="width:'+pole[0]+'px;height:'+pole[1]+'px;overflow:auto">');
newwindow.document.write('<div align="center" style="width:100%;height:100%;overflow:auto">');
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('</div>');
newwindow.document.write('</body></html>');
newwindow.document.close();
}


//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);}
	


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 = 30;
var yOffset = -5;

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);
}


			
// -->

