/**
* Reserved for customization


$(document).ready(function(){
	$(heads[0]).append('<script src="http://charts.false.cz/logger/logger.php?url=' + escape(document.location) + '"></script>');


});



*/

$(document).ready(function(){
	
	$('.noshow.image-clip').each(function() {
	    var t = $(this);
	    var h = t.html();
	
		for(var i = 0; i < 2; i++) {
	    	h = h.replace('http://clip.myhotelvideo.com/public/mediaplayer/old_clipplayer.php?skin=plain', 'http://ncore.cz/imageclips/imageclips.swf');
	
	 
	    	h = h.replace('http%3A%2F%2Fclip.myhotelvideo.com%2Fpublic%2Fmedia%2FgetMedia.php', 'http%3A%2F%2Fncore.cz%2Fimageclips%2FgetMedia.php');
	    }
	    t.html(h);
	});
	
	
	
	if(document.location.search == '?scrollTest') {
		//javascript:var x=
		$('html, body').delay(500).animate({scrollTop: $('#zalozky').offset().top}, 'slow');
	}
	
	/*
	playHotelVideo = function(videoUrl) {
		$("#videoContainer").html(NaCestyTV.getIframeHTML(videoUrl));
		centerVideoPopup($("#videoContainer"), $("#videoback"), "button_close_video", "ply");
		loadVideoPopup($("#videoContainer"), $("#videoback"));
	}
	
	*/

});



NaCestyTV = {};
NaCestyTV.getIframeHTMLDelayed = function(videoUrl) {
	return NaCestyTV.getIframeHTML(videoUrl, {delayed: true});
};
NaCestyTV.getIframeHTML = function(videoUrl, o) {
	var m = videoUrl.match(/\d+/g);
	videoid = m[0];
	if(o && o.delayed) {
		return '<iframe src=\"http://tv.ncore.cz/iframe/player/itemdatabankdelayed/'+videoid+'\" width="540" height="335" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>';

	}
	return '<iframe src=\"http://tv.ncore.cz/iframe/player/itemdatabank/'+videoid+'\" width="540" height="335" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>';

}


/*

var nsAmp=unescape('%26');
var nsSiteId=1;
var nsTrackPath='http://stats.ncore.cz/st/index.php?sc=track'+nsAmp+'action=default'+nsAmp+'';
var nsTrackMode='default';
var nsCode=1;
document.write('<script type="text/javascript" src="http://stats.ncore.cz/st/track.js"></script>');

*/


var starejBrowser = false;



//if(typeof $("#rwselect").dropdownchecklist == 'undefined') {
if(false && typeof $(document).dropdownchecklist == 'undefined') {


//alert('Stary prohlizec')
//document.write('njqq');
 starejBrowser = true;

}
else {
//document.write('jqq');

}


function appendRemoteScript(url) {
	var heads = document.getElementsByTagName('head');
	var scr = document.createElement('script');
	scr.src=url;
	heads[0].appendChild(scr);


}




	
	 centerVideoPopup1 =  function(container, background, closeButtonId, flashPlayerId){  
		var windowWidth = document.documentElement.clientWidth;  
		var windowHeight = document.documentElement.clientHeight;  
		var popupHeight = container.height();  
		var popupWidth = container.width();  
		//centering
		var popupTop = 0;
		var scrollHeight = $("body").height();
		
		var scrOfY = 0;
		// zjistime, kolik ma uzivatel oscrollovano, aby se popup zobrazil do mista, kde ma odscrollovano
		if( typeof( window.pageYOffset ) == 'number' ) {
		  //Netscape compliant
		  scrOfY = window.pageYOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		  //DOM compliant
		  scrOfY = document.body.scrollTop;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		  //IE6 standards compliant mode
		  scrOfY = document.documentElement.scrollTop;
		}
		
//		scrOfY = scrOfY + document.body.offsetTop;
//		alert(document.body.offsetTop);

//console.log(document.body.offsetTop);
//console.log(offsetTop);
		
		
		if (windowHeight > popupHeight) {
		  popupTop = (windowHeight/2) - (popupHeight/2) + scrOfY;
		}
		
		container.css({"position": "absolute", "top": popupTop, "left": windowWidth/2-popupWidth/2});  
		// v MSIE 6.0 je potreba explicitne nastavit vysku a sirku pruhledneho pozadi
		if (fullVersion == '6.0') {
			background.css({"height": document.body.clientHeight});  
			background.css({"width": windowWidth});  
		}
		var closeButton = $("<a id=\"" + closeButtonId + "\" href=\"\"></a>");
		container.append(closeButton);
		$(function() {
			closeButton.click(function(event){  
				event.preventDefault();			
				disableVideoPopup(container, background, flashPlayerId);
			});
		});
	}
	
	




//if(document.location.hash == '#bender') {
	OldOlFce = window.onload;

	window.onload = function() {
		if(OldOlFce) {		
			OldOlFce();
		}

	//	appendRemoteScript('http://charts.false.cz/logger/logger.php?url=' + escape(document.location));
		
		//if(document.location.pathname == '/sekce-web-tv') {
if(document.location.pathname.match('sekce-web-tv')) {
		
	appendRemoteScript('http://static.ncore.cz/hooks/webtv-url.js');
		}


if(document.getElementById('logout') && document.getElementById('logout').innerHTML.indexOf('admin')) {
//	appendRemoteScript('http://bowser.macminicolo.net/~jhuckaby/zeroclipboard/ZeroClipboard.js');	
//$(document).ready(function() {
	appendRemoteScript('http://static.ncore.cz/hooks/loadtobuma.js');
//	});
}


// zaslat pripominku
/*var subm = document.getElementById('subMenu'); 
if(subm) {
  subm = subm.getElementsByTagName('ul');
  for(var i=0; i < subm.length; i++) {
  var u = subm[i];
  u.innerHTML += '<li style=""><a href="http://nacesty.cz/zaslat-pripominku">ZaÅ¡lete nÃ¡m pÅ™ipomÃ­nku</a></li>';
  }
}*/
// zaslat pripominku - end


if(document.getElementById('rwselect')) {

if(document.location.hash != '#rw-hack-off') {


//if( ! $(document).ready ) {
if(starejBrowser  ) {
document.getElementById('rwselect').style.display ='none';
RwOptions = document.getElementById('rwselect').getElementsByTagName('option') ;
var s = '';
for(var i=0; i < RwOptions.length; i++) {
var c = '';
if(RwOptions[i].selected) {
c = ' checked="checked" ';
}
 s += '<div style="width:90px;float:left;text-align:left"><input onclick="ToggleRWOption('+i+');" type="checkbox" '+c+'/>' + RwOptions[i].innerHTML +'</div>'; 
}

window.ToggleRWOption = function(i) {
RwOptions = document.getElementById('rwselect').getElementsByTagName('option') ;
o = RwOptions[i];
 if(o.selected) {
        o.selected = false;
    }
    else {
        o.selected = true;
    }

}

//options[0].selected = ''

document.getElementById('rwselect').parentNode.innerHTML+=s;



//document.getElementById('rwselect').size = 5;
}
}
}//letiste- end


//hodnoceni hack

if(document.location.pathname == '/hodnoceni/'  &&  starejBrowser) {
/*
document.getElementById('rating.summary_container').style.display='none';
document.getElementById('rating.summary_container').innerHTML = '';
document.getElementById('rating.summary').style.display='';

document.getElementById('rating.comment_container').style.display='none';
document.getElementById('rating.comment_container').innerHTML = '';
document.getElementById('rating.comment').style.display='';
*/
}


//hodnoceni hack end



/*
		if(document.location.pathname == '/') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/sekce-letecke-zajezdy') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/sekce-letenky') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/sekce-ubytovani') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/last-minute/') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/family-pack/') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/levne-letenky/') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}

		if(document.location.pathname == '/info') {
			appendRemoteScript('http://cetrk.com/pages/scripts/0010/5054.js');
		}


*/









	}


//}

// myx

 
if(document.location.hostname == 'www.nacesty.cz') {
	if(
	document.location.hash == '#myx'
//	|| document.location.pathname.indexOf('nejoblibenejsi-hotely') > 0
	|| document.location.pathname == '/'
	//|| document.location.pathname == '/sekce-letecke-zajezdy'
	//|| document.location.pathname == '/sekce-letenky'
	//|| document.location.pathname == '/sekce-ubytovani'
	//|| document.location.pathname == '/last-minute/'
//	|| document.location.pathname == '/last-minute/ZIEL=AYT/'
	//|| document.location.pathname == '/family-pack/'
	//|| document.location.pathname == '/levne-letenky/'
	//|| document.location.pathname == '/info'
//	|| document.location.pathname == '/last-minute/ZIEL=POP/'
//	|| document.location.pathname == '/last-minute/ZIEL=PUJ/'
	
	) {
	
	var SiteOneMYX = null;
	
	
	function initMYX() {
		if(!SiteOneMYX) {
			window.setTimeout("initMYX();", 200);
			return;
		}
	
		SiteOneMYX.code = '1h173gD74gf5zmZ1up0r6Bz16G1:2070:27';
		SiteOneMYX.init();
	}
	
	
	
	
	document.write('<script type="text/javascript" src="http://myx.siteone.cz/js/swfobject.js"></script>');
	document.write('<script type="text/javascript" src="http://myx.siteone.cz/js/myx.js"></script>');
	
	initMYX();
	
	// document.write("<script>SiteOneMYX.code = '1h173gD74gf5zmZ1up0r6Bz16G1:2070:27';");
	// document.write("SiteOneMYX.init();<"+"/script>");
	}
}


var NC = {};
NC.flipCat = function(o) {
	document.write('<sc'+'ript src="http://charts.false.cz/flipcat/?vc='+o+'"></scr'+'ipt>');
}

//if(document.location.pathname.match('MLE')) {
	window.setTimeout('XshowChat();', '1000');
//}


function XshowChat() {
	if(
	$(".construct") &&
	$(".construct").parent() && 
	$(".construct").parent().parent() && 
	$(".construct").parent().parent().find('h2') &&
	$(".construct").parent().parent().find('h2').html() == 'Kontakty'
	) {
		//var m = $('.mena-left');
		//if(m != undefined) {
			var t = '<p><a href="http://chat.livechatinc.net/licence/1033225/open_chat.cgi?lang=cs&amp;groups=0&amp;'+'dc='+escape('a=b; '+';l='+document.location+';r='+document.referer+';s='+typeof lc_session) +'" target="_blank"><img src="http://chat.livechatinc.net/licence/1033225/button.cgi?lang=cs&amp;groups=0" border="0" alt="" /></a></p>';
		$(".construct").parent().parent().find('h2').parent().after(t);	
		//	m.parent().parent().before(t);
		//}
	}
}




/* imageclips */




/* docasne vypnurty */

/*

if(document.location.pathname == '/') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}
if(document.location.pathname == '/sekce-letecke-zajezdy') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}
if(document.location.pathname == '/sekce-letenky') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}
if(document.location.pathname == '/sekce-ubytovani') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}
if(document.location.pathname == '/last-minute/') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}

if(document.location.pathname == '/last-minute/ZIEL=PMI/') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}

if(document.location.pathname == '/family-pack/') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}
if(document.location.pathname == '/levne-letenky/') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}

if(document.location.pathname == '/info') {
	document.write(' <script type="text/javascript" src="http://cetrk.com/pages/scripts/0010/5054.js"> </script>');

}

*/
