/* detekce Flash */
function isFlash(ver) {
	var state = false;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : false;
	if (plugin) {
		state = (parseInt(plugin.description.substring(plugin.description.indexOf(".")-2)) >= ver)? true : false;
	}
	else if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("MSIE 4") == -1 && navigator.appVersion.indexOf("Macintosh") == -1 && navigator.appVersion.indexOf("68K") == -1) {
		eval('try { var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + ver); state = true; } catch(e) {  }');
	}
	return state;
}

function writeFlashEngine() {
	if ( isFlash(6) && (navigator.userAgent.toLowerCase().indexOf("opera") <= -1)  )  {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="117" height="38" id="engine" align="middle">\n');
		document.write('		<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('		<param name="movie" value="/swf/u/engine.swf" />\n');
		document.write('		<param name="quality" value="high" />\n');
		document.write('		<param name="bgcolor" value="#ffffff" />\n');
		document.write('		<embed src="/swf/u/engine.swf" quality="high" bgcolor="#ffffff"  width="117" height="38" name="engine" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		document.write('</object>\n');
	}
}
function writeFlashPlayer(_site) {
	if ( isFlash(6) && (navigator.userAgent.toLowerCase().indexOf("opera") <= -1)  )  {
		if (parent.frames[0])	{
			var _lc_st = "&lc_st=0";
			if (window.parent.getPlay())	window.parent.setPlay();
			if (_site.indexOf("srv") <= -1)	{
				document.write('<div class="f-right"><a href="'+_site+'" title="Vypnout player" target="_top" class="off"><span>Vypnout player</span></a></div>\n');
			}
			document.write('<div class="obj">\n');
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="500" height="26" id="controller" align="middle">\n');
			document.write('	<param name="allowScriptAccess" value="sameDomain" />\n');
			document.write('	<param name="movie" value="/swf/u/player2.swf?playlist=/swf/u/mp3/playlist.xml'+_lc_st+'" />\n');
			document.write('	<param name="quality" value="high" />\n');
			document.write('	<param name="bgcolor" value="#ffffff" />\n');
			document.write('	<embed src="/swf/u/player2.swf?playlist=/swf/u/mp3/playlist.xml'+_lc_st+'" quality="high" bgcolor="#ffffff"  width="500" height="26" name="controller" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
			document.write('</object>\n');
			document.write('</div>\n');
		} else {
			if (_site.indexOf("srv") <= -1)	{
				document.write('<div class="f-right"><a href="/frameset'+_site+'" title="Zobrazit player" class="on"><span>Zobrazit player</span></a></div>\n');
			}
		}
	}
}
function writeFlashMenu() {
	if ( isFlash(6) && (navigator.userAgent.toLowerCase().indexOf("opera") <= -1)  )  {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="780" height="455" id="hp-flash" align="middle">\n');
		document.write('	<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('	<param name="movie" value="/swf/u/hp.swf?xdata=/swf/u/data/data.xml&amp;lang=cs&amp;search=1" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />\n');
		document.write('	<embed src="/swf/u/hp.swf?xdata=/swf/u/data/data.xml&amp;lang=cs&amp;search=1" quality="high" bgcolor="#ffffff"  width="780" height="455" name="hp-flash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
		document.write('</object>\n');
	} else {
		document.write('<hr>\n');
		document.write('<div id="content-bg">\n');
		document.write('	<div id="hp">\n');
		document.write('		<div id="menu">\n');
		document.write(basicMenu);
		document.write('	</div>\n');
		document.write('	</div>\n');
		document.write('</div>\n');
	}
}

function writeFlash(ver,src,w,h,name,q,bgcol) {
	document.writeln('<object width="'+ w +'" height="'+ h +'" id="'+ name +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ ver +',0,0,0">');
	document.writeln('	<param name="movie" value="'+ src +'">');
	document.writeln('	<param name="quality" value="'+ q +'">');
	document.writeln('  <param name="menu" value="false">');
	document.writeln('	<param name="bgcolor" value="'+ bgcol +'">');
	document.writeln('	<embed src="'+ src +'" width="'+ w +'" height="'+ h +'" name="'+ name +'" quality="'+ q +'" menu="false" bgcolor="'+ bgcol +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	document.writeln('</object>');
}

/* Player motivu */
var motives = new Array();
var imgCnt, rNum;
var imgNo = new Array();

function bgPlayerOn(ent,index) {
	rNum = index;
	imgCnt = ( motives[rNum].length ) ? motives[rNum].length : 1;
	if ( imgCnt <= 1 ) return;
	ent.className = 'decor-ovr';
}
function showNo() {
	if ( imgNo[rNum] > imgCnt || imgNo[rNum] < 0 ) return;
	document.getElementById("img"+rNum).src = motives[rNum][imgNo[rNum]];
}
function showNext() {
	imgNo[rNum] = (!imgNo[rNum] && imgNo[rNum]!=0) ? 1 : imgNo[rNum]+1;
	if ( imgNo[rNum] >= imgCnt ) { imgNo[rNum] = 0; }
	showNo();
}
function showPrevious() {
	imgNo[rNum] = (!imgNo[rNum]) ? imgCnt-1 : imgNo[rNum]-1;
	if ( imgNo[rNum] < 0 ) { imgNo[rNum] = imgCnt-1; }
	showNo();
}

function getCenterW(width) {
	return parseInt( eval( (screen.width-parseInt(width))/2 ) );
}

function getCenterH(height) {
	return parseInt( eval( (screen.height-parseInt(height))/2 ) );
}
function openWin( name, path, width, height, scroll ) {
		if (!scroll || scroll != 'yes') { scroll = 'no' };
		var _win = window.open(path,name,'scrollbars=' + scroll + ',resizable=no,resize=no,width='+width+',height='+height+',screenX='+getCenterW(width)+',screenY='+getCenterH(height)+',top='+getCenterH(height)+',left='+getCenterW(width)+',locationbar=no,directories=no,dependent=yes' );
		if (_win)	_win.focus();
}
function maxWin( name, path ) {
		var _win = window.open(path,name,'scrollbars=yes,resizable=yes,resize=yes,width='+((screen.width)-8)+',height='+screen.height+',top=0,left=0,locationbar=no,directories=no,dependent=yes' );
		if (_win)	_win.focus();
}
function wopen(url) {
		okno=window.open(url,"cc_popup","width=468,height=570,minheight:50,screenX="+getCenterW(468)+",screenY="+getCenterH(570)+",top="+getCenterH(570)+",left="+getCenterW(468)+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes");
		okno.focus();
}
function openPopup(url) {
		popupOkno = openWin("hp_popup",url,752,472,'no');
}
/* THO onclick="openWin('personalni_politika', '/cs/kariera/personalni-politika.shtml', 734, 619, 'yes'); return false;" */
function openWinInMenu(sec) {
		if(sec==1){
			openOkno = openWin('personalni_politika','/cs/kariera/personalni-politika.shtml', 734, 619, 'yes');
		}
}
function go2URL(_url) {
	document.location.href = _url;
	return false;
}

function disableSubmitButton() {
	var id = "mail_submit";
	var e = document.getElementById(id);
	if (e) {
		e.disabled = true;
		e.style.cursor = 'wait';
	}
}
function startSubmitButton() {
	var id = "mail_submit";
	var e = document.getElementById(id);
	if (e) {
		e.disabled = false;
		e.style.cursor = 'pointer';
	}
}

// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<style type="text/css">\n'
	else if (id=="END") return '</style>'
	var str = (left!=null && top!=null)? '#'+id+' { position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' { position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	//bc:if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=6 && color!=null) str += (is.ns4)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length==9 && other!=null) str += ' '+other+';'
	str += ' }\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}

/*rotace banneru */
function bannerRotateInit() {
		bannerRotate();
}

function bannerRotate() {
if (bannerRotator == bannerCount) {	bannerRotator = 0;	}
if (ie55) document.images.mcz_banner.filters[0].apply();
document.images['mcz_banner'].src = bannerImg[bannerRotator];
document.images['mcz_banner'].alt = bannerAlt[bannerRotator];
if (ie55) document.images.mcz_banner.filters[0].play();

if(document.getElementById("ill_href"))
{
 document.getElementById("ill_href").href =  bannerURL[bannerRotator];
 document.getElementById("ill_href").onclick = bannerClick[bannerRotator];
}

bannerRotator++;
window.setTimeout('bannerRotate();',bannerDelay+pixelDelay);
}
/* Teaser HP */
function doPlayVar(args){
	document.getElementById("flwPlayer").SetVariable("flvPlay.plays", args);
}

function _showLoc(loc) { document.getElementById(loc).style.display = "block"; }
function _hideLoc(loc) { 
	document.getElementById(loc).style.display = "none";
	if(ie55) doPlayVar("true");
}
/* Cookie function */
function qSet_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	 * 60 * 60 * 24 */
	if ( expires )
	{
	expires = expires * 1000;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
/* /Cookie function */

/* HP MP3 Player */
/*
if( navigator.appName == "Microsoft Internet Explorer" ){
	var checkie = 'y';
}else{
	var checkie = 'n';
}
function autoPlay(mp3) { 
		var check = Get_Cookie('hp_play_mp3');
		if (check != 'run'){
			// nastavme cooekie pro HP play
			var ck_name = 'hp_play_mp3';
			var ck_value = 'run';
			var ck_expires = 300; // sec 300 == 5 minut
			var ck_path = '/';
			var ck_domain = '';
			var ck_secure = '';
			qSet_Cookie( ck_name, ck_value, ck_expires, ck_path, ck_domain, ck_secure );
			// cooekie pro all page
			var cc_name = 'statusPlay';
			var cc_value = '1';
			var cc_expires = 300; // sec 300 == 5 min
			var cc_path = '/';
			var cc_domain = '';
			var cc_secure = '';
			qSet_Cookie( cc_name, cc_value, cc_expires, cc_path, cc_domain, cc_secure );
			// spustme hudbu
			document.images['HP_music'].src = '/img/cs/csol/HP_music_on.gif';
			document.images['HP_music'].alt = 'Vypnout hudbu';
			document.images['HP_music'].title = 'Vypnout hudbu';
			if(checkie=='y'){
				document.links('HP_music_link').href = 'javascript:playHPmp3("XMas","1","hp");';
			}else{
				document.links['HP_music_link'].href = 'javascript:playHPmp3("XMas","1","hp");';
			}
			window.parent.frames[1].document.HPMP3Player.SetVariable("MP3Play.co", 'XMas|1');
		}
}

function playHPmp3(mp3,statusPlay,page)	{
	if(statusPlay=='1'||statusPlay=='0'){
		var ck_name = 'statusPlay';
		var ck_value = statusPlay;
		var ck_expires = 300; // sec 300 == 5 min
		var ck_path = '/';
		var ck_domain = '';
		var ck_secure = '';
		qSet_Cookie( ck_name, ck_value, ck_expires, ck_path, ck_domain, ck_secure );
	}
	var statusPlay = Get_Cookie('statusPlay');
	var img='';
	if(page=='hp'){
		img='csol/HP_music_on.gif';
		img2='csol/HP_music_off.gif';
	}else{
		if(document.getElementById('a-blak')){
			img='music_on_blak.gif'
			img2='music_off_blak.gif'
		}else{
			img='music_on.gif'
			img2='music_off.gif'
		}
	}
	if(statusPlay=='1') {	
		document.images['HP_music'].src = '/img/cs/'+img;
		document.images['HP_music'].alt = 'Vypnout hudbu';
		document.images['HP_music'].title = 'Vypnout hudbu';
		if(checkie=='y'){
			document.links('HP_music_link').href = 'javascript:playHPmp3("XMas","0","'+page+'");';
		}else{
			document.links['HP_music_link'].href = 'javascript:playHPmp3("XMas","0","'+page+'");';
		}
	}else if(statusPlay=='0'){
		document.images['HP_music'].src = '/img/cs/'+img2;
		document.images['HP_music'].alt = 'Spustit hudbu';
		document.images['HP_music'].title = 'Spustit hudbu';
		if(checkie=='y'){
			document.links('HP_music_link').href = 'javascript:playHPmp3("XMas","1","'+page+'");';
		}else{
			document.links['HP_music_link'].href = 'javascript:playHPmp3("XMas","1","'+page+'");';
		}
	}else{
		document.images['HP_music'].src = '/img/cs/'+img2;
		document.images['HP_music'].alt = 'Spustit hudbu';
		document.images['HP_music'].title = 'Spustit hudbu';
		if(checkie=='y'){
			document.links('HP_music_link').href = 'javascript:playHPmp3("XMas","1","'+page+'");';
		}else{
			document.links['HP_music_link'].href = 'javascript:playHPmp3("XMas","1","'+page+'");';
		}
	}
	mp3 = mp3 + '|' + statusPlay;	
	window.parent.frames[1].document.HPMP3Player.SetVariable("MP3Play.co", mp3);
}

function writeMP3PlayerLink(page) {
	var img='';
	if(page=='hp'){
		img='csol/HP_music_on.gif';
		img2='csol/HP_music_off.gif';
	}else{
		if(document.getElementById('a-blak')){
			img='music_on_blak.gif'
			img2='music_off_blak.gif'
		}else{
			img='music_on.gif'
			img2='music_off.gif'
		}
	}
	var statusPlay = Get_Cookie('statusPlay');
	if(statusPlay=='1') {	
		window.parent.frames[1].document.HPMP3Player.SetVariable("MP3Play.co", 'XMas|1');
		document.write('<a name="HP_music_link" href="javascript:playHPmp3(\'XMas\',\'0\',\''+page+'\');"><img name="HP_music" src="/img/cs/'+img+'" alt="Vypnout hudbu" title="Vypnout hudbu"></a>');
	}else if(statusPlay=='0'){
		document.write('<a name="HP_music_link" href="javascript:playHPmp3(\'XMas\',\'1\',\''+page+'\');"><img name="HP_music" src="/img/cs/'+img2+'" alt="Spustit hudbu" title="Spustit hudbu"></a>');
	}else{
		document.write('<a name="HP_music_link" href="javascript:playHPmp3(\'XMas\',\'1\',\''+page+'\');"><img name="HP_music" src="/img/cs/'+img2+'" alt="Spustit hudbu" title="Spustit hudbu"></a>');
	}
}

function writeHPMP3Player() {
	if ( isFlash(7) && (navigator.userAgent.toLowerCase().indexOf("opera") <= -1)  )  {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" id="HPMP3Player">\n');
		document.write('    	<param name="movie" value="/swf/u/hp_mp3_player.swf"><param name=quality value="high">\n');
		document.write('    	<embed src="/swf/u/hp_mp3_player.swf" quality="high" width="1" height="1" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" name="HPMP3Player" swLiveConnect="true"></embed>\n');
		document.write('</object>\n');
	}
}
*/
/* PF */
function openPf( name, path, width, height, scroll, page ) {
		playHPmp3('XMas','0',page);
		openWin( name, path, width, height, scroll );
}
function mailStatus(status)	{
	alert(getMailStatusText(status));
}
function startSubmitButton() {
	/*var id = "mail_submit";
	var e = document.getElementById(id);
	if (e) {
		e.disabled = false;
		e.style.cursor = 'pointer';
	}*/
	return false;
}







