/* jquery popups */
(function($){$.fn.popup = function(instanceSettings){return this.each(function(){$(this).click(function(){$.fn.popup.defaultSettings = {centerBrowser:0,centerScreen:0,height:500,left:0,location:0,menubar:0,resizable:1,scrollbars:0,status:0,width:500,windowName:null,windowURL:null,top:0,toolbar:0};settings = $.extend({}, $.fn.popup.defaultSettings, instanceSettings || {});var windowFeatures =    'height=' + settings.height + ',width=' + settings.width + ',toolbar=' + settings.toolbar + ',scrollbars=' + settings.scrollbars + ',status=' + settings.status +  ',resizable=' + settings.resizable + ',location=' + settings.location + ',menuBar=' + settings.menubar;settings.windowName = this.name || settings.windowName;settings.windowURL = this.href || settings.windowURL;var centeredY,centeredX;if(settings.centerBrowser){if ($.browser.msie) {centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));}else{centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));}window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();}else if(settings.centerScreen){centeredY = (screen.height - settings.height)/2;centeredX = (screen.width - settings.width)/2;window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();}else{window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();}return false;});});};})(jQuery);

$(document).ready(function() {
	$('a.thickbox').nyroModal();
  $("a.tour").popup({width: 700,height: 525,left:20,top:20});
	$('#praguewinetrophy,#francisco,#mundus,#concours,#vinalies,#vinitaly,#chall,#jarovin,#valtice,#litomerice,#litomerice,#vinex,#salon,#juvenale,#vino,#vinoforum,#ljubljana,#londyn,#makro,#obal2007').css("width","600px").parent(".text").parent(".article").hide();
  $("a[rel='external']").attr({target: "_blank"});
	$("#menu a[rel='external']").wrap("<span class='external'></span>");
	
	
  $('.noJSblockPhotoDownload').addClass('blockPhotoDownload');
  $('.blockPhotoDownload').removeClass('noJSblockPhotoDownload');
  
  $('.blockPhotoDownload').hide();
  $('.blockPhotoDownload').fadeTo(1, 0.0);
  $('.showDownloadBlock').click(function(){
    $('.blockPhotoDownload').hide();
    $('#block'+$(this).attr("id")).show();
    $('.blockPhotoDownload').fadeTo(200, 0.0);    
    $('#block'+$(this).attr("id")).fadeTo(200, 0.9);   
    return false;
  });
  
  $('.blockPhotoDownload').click(function(){
    
    $('.blockPhotoDownload').hide();
    $('.blockPhotoDownload').fadeTo(200, 0);
  });

  $('#cards .close').click(function(){
	  $('#cards').slideUp();
  });


});



jQuery.fn.highlight=function(b){function a(e,j){var l=0;if(e.nodeType==3){var k=e.data.toUpperCase().indexOf(j);if(k>=0){var h=document.createElement("span");h.className="highlight";var f=e.splitText(k);var c=f.splitText(j.length);var d=f.cloneNode(true);h.appendChild(d);f.parentNode.replaceChild(h,f);l=1}}else{if(e.nodeType==1&&e.childNodes&&!/(script|style)/i.test(e.tagName)){for(var g=0;g<e.childNodes.length;++g){g+=a(e.childNodes[g],j)}}}return l}return this.each(function(){a(this,b.toUpperCase())})};jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;with(this.parentNode){replaceChild(this.firstChild,this);normalize()}}).end()};

