// jQBrowser v0.2: http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(c/a))+String.fromCharCode(c%a+161)};while(c--){if(k[c]){p=p.replace(new RegExp(e(c),'g'),k[c])}}return p}('Ö ¡(){® Ø={\'¥\':¡(){¢ £.¥},\'©\':{\'±\':¡(){¢ £.©.±},\'¯\':¡(){¢ £.©.¯}},\'¬\':¡(){¢ £.¬},\'¶\':¡(){¢ £.¶},\'º\':¡(){¢ £.º},\'Á\':¡(){¢ £.Á},\'À\':¡(){¢ £.À},\'½\':¡(){¢ £.½},\'¾\':¡(){¢ £.¾},\'¼\':¡(){¢ £.¼},\'·\':¡(){¢ £.·},\'Â\':¡(){¢ £.Â},\'³\':¡(){¢ £.³},\'Ä\':¡(){¢ £.Ä},\'Ã\':¡(){¢ £.Ã},\'Å\':¡(){¢ £.Å},\'¸\':¡(){¢ £.¸}};$.¥=Ø;® £={\'¥\':\'¿\',\'©\':{\'±\':²,\'¯\':\'¿\'},\'¬\':\'¿\',\'¶\':§,\'º\':§,\'Á\':§,\'À\':§,\'½\':§,\'¾\':§,\'¼\':§,\'·\':§,\'Â\':§,\'³\':§,\'Ä\':§,\'Ã\':§,\'Å\':§,\'¸\':§};Î(® i=0,«=».ì,°=».í,¦=[{\'¤\':\'Ý\',\'¥\':¡(){¢/Ù/.¨(°)}},{\'¤\':\'Ú\',\'¥\':¡(){¢ Û.³!=²}},{\'¤\':\'È\',\'¥\':¡(){¢/È/.¨(°)}},{\'¤\':\'Ü\',\'¥\':¡(){¢/Þ/.¨(°)}},{\'ª\':\'¶\',\'¤\':\'ß Ñ\',\'¥\':¡(){¢/à á â/.¨(«)},\'©\':¡(){¢ «.¹(/ã(\\d+(?:\\.\\d+)+)/)}},{\'¤\':\'Ì\',\'¥\':¡(){¢/Ì/.¨(«)}},{\'¤\':\'Í\',\'¥\':¡(){¢/Í/.¨(°)}},{\'¤\':\'Ï\',\'¥\':¡(){¢/Ï/.¨(«)}},{\'¤\':\'Ð\',\'¥\':¡(){¢/Ð/.¨(«)}},{\'ª\':\'·\',\'¤\':\'å Ñ\',\'¥\':¡(){¢/Ò/.¨(«)},\'©\':¡(){¢ «.¹(/Ò (\\d+(?:\\.\\d+)+(?:b\\d*)?)/)}},{\'¤\':\'Ó\',\'¥\':¡(){¢/æ|Ó/.¨(«)},\'©\':¡(){¢ «.¹(/è:(\\d+(?:\\.\\d+)+)/)}}];i<¦.Ë;i++){µ(¦[i].¥()){® ª=¦[i].ª?¦[i].ª:¦[i].¤.Õ();£[ª]=É;£.¥=¦[i].¤;® ­;µ(¦[i].©!=²&&(­=¦[i].©())){£.©.¯=­[1];£.©.±=Ê(­[1])}ê{® Ç=Ö ë(¦[i].¤+\'(?:\\\\s|\\\\/)(\\\\d+(?:\\\\.\\\\d+)+(?:(?:a|b)\\\\d*)?)\');­=«.¹(Ç);µ(­!=²){£.©.¯=­[1];£.©.±=Ê(­[1])}}×}};Î(® i=0,´=».ä,¦=[{\'ª\':\'¸\',\'¤\':\'ç\',\'¬\':¡(){¢/é/.¨(´)}},{\'¤\':\'Ô\',\'¬\':¡(){¢/Ô/.¨(´)}},{\'¤\':\'Æ\',\'¬\':¡(){¢/Æ/.¨(´)}}];i<¦.Ë;i++){µ(¦[i].¬()){® ª=¦[i].ª?¦[i].ª:¦[i].¤.Õ();£[ª]=É;£.¬=¦[i].¤;×}}}();',77,77,'function|return|Private|name|browser|data|false|test|version|identifier|ua|OS|result|var|string|ve|number|undefined|opera|pl|if|aol|msie|win|match|camino|navigator|mozilla|icab|konqueror|Unknown|flock|firefox|netscape|linux|safari|mac|Linux|re|iCab|true|parseFloat|length|Flock|Camino|for|Firefox|Netscape|Explorer|MSIE|Mozilla|Mac|toLowerCase|new|break|Public|Apple|Opera|window|Konqueror|Safari|KDE|AOL|America|Online|Browser|rev|platform|Internet|Gecko|Windows|rv|Win|else|RegExp|userAgent|vendor'.split('|')))

jQuery.noConflict();
																				
if (jQuery.browser.msie()) {
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $LastChangedDate: 2007-07-21 18:44:59 -0500 (Sat, 21 Jul 2007) $
* $Rev: 2446 $
*
* Version 2.1.1
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(b($){$.m.E=$.m.g=b(s){h($.x.10&&/6.0/.I(D.B)){s=$.w({c:\'3\',5:\'3\',8:\'3\',d:\'3\',k:M,e:\'F:i;\'},s||{});C a=b(n){f n&&n.t==r?n+\'4\':n},p=\'<o Y="g"W="0"R="-1"e="\'+s.e+\'"\'+\'Q="P:O;N:L;z-H:-1;\'+(s.k!==i?\'G:J(K=\\\'0\\\');\':\'\')+\'c:\'+(s.c==\'3\'?\'7(((l(2.9.j.A)||0)*-1)+\\\'4\\\')\':a(s.c))+\';\'+\'5:\'+(s.5==\'3\'?\'7(((l(2.9.j.y)||0)*-1)+\\\'4\\\')\':a(s.5))+\';\'+\'8:\'+(s.8==\'3\'?\'7(2.9.S+\\\'4\\\')\':a(s.8))+\';\'+\'d:\'+(s.d==\'3\'?\'7(2.9.v+\\\'4\\\')\':a(s.d))+\';\'+\'"/>\';f 2.T(b(){h($(\'> o.g\',2).U==0)2.V(q.X(p),2.u)})}f 2}})(Z);',62,63,'||this|auto|px|left||expression|width|parentNode||function|top|height|src|return|bgiframe|if|false|currentStyle|opacity|parseInt|fn||iframe|html|document|Number||constructor|firstChild|offsetHeight|extend|browser|borderLeftWidth||borderTopWidth|userAgent|var|navigator|bgIframe|javascript|filter|index|test|Alpha|Opacity|absolute|true|position|block|display|style|tabindex|offsetWidth|each|length|insertBefore|frameborder|createElement|class|jQuery|msie'.split('|'),0,{}))
	
}

function openPopUp(src,myWidth,myHeight){
		window.open(src,'TravelOne.pl','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,fullscreen=no,channelmode=no,width='+myWidth+',height='+myHeight+',top=0,left=0');
}

function otworz(tekst, node) {
	if(jQuery(node).parent("h5.ui-state-active").size() > 0 || node == undefined)
		location.href=tekst;
}

function mainmenu(){
	jQuery(" #nav ul ").css({display: "none"}); // Opera Fix
	
	jQuery(" #nav li").hover(function(){
		jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
		jQuery(this).find('a.belka').addClass("hover");
		
		if (jQuery(this).find('ul:first').length) {
			hideFlashes();
		}
	},function(){
		jQuery(this).find('ul:first').css({visibility: "hidden"});
		jQuery(this).find('a.belka').removeClass("hover");
		
		if (jQuery(this).find('ul:first').length) {
			showFlashes();
		}
	});
	

	// jesli hover na boksie 'inne panstwa'
	jQuery(" #all").hover(function(){
		jQuery('li.innepanstwa').find('a.belka').addClass("hover");	
	},function(){
		jQuery('li.innepanstwa').find('a.belka').removeClass("hover");
	});
	
	// jesli hover na zakładce lub boksie 'inne panstwa'
	jQuery('.innepanstwa').hover(function(){
		showInnePanstwa();
	},function(){
		hideInnePanstwa();
	});
}

function showInnePanstwa() {
	hideFlashes();
	jQuery(" #all ").css({visibility: "visible",display: "none"}).show();
	
}

function hideInnePanstwa() {
	jQuery(" #all ").css({visibility: "hidden"});
	showFlashes();
}

function showFlashes() {
	if (jQuery.browser.linux()) {
		jQuery("#mapka").css({display: "block"});
		jQuery("#bannerAdNet").css({display: "block"});
		jQuery("#plakaty_main").css({display: "block"});
		jQuery("#pasek_promocyjny").css({display: "block"});
		jQuery('.of_tab_btm_rezerwuj').css({display: "block"});
		jQuery("#maps-box-main").css({display: "block"});
		jQuery("#infolinia-left").css({display: "block"});
		jQuery("#slideshow").css({display: "block"});
		jQuery("#my-top").css({display: "block"});
		jQuery("#sylwester-banner").css({display: "block"});
		jQuery("#media-box-sylwester").show();
		//jQuery("#header4").show();
		//jQuery("#spr-clmn-phn-nmbr").show();
		
	}
	
	if (jQuery.browser.msie() || jQuery.browser.linux()) {
		jQuery("#myGallery").css({display: "block"});
	}
}

function hideFlashes() {
	if (jQuery.browser.linux()) {
		jQuery("#mapka").css({display: "none"});
		jQuery("#bannerAdNet").css({display: "none"});
		jQuery("#plakaty_main").css({display: "none"});
		jQuery("#pasek_promocyjny").css({display: "none"});
		jQuery('.of_tab_btm_rezerwuj').css({display: "none"});
		jQuery("#maps-box-main").css({display: "none"});
		jQuery("#infolinia-left").css({display: "none"});
		jQuery("#slideshow").css({display: "none"});
		jQuery("#my-top").css({display: "none"});
		jQuery("#sylwester-banner").css({display: "none"});
		jQuery("#media-box-sylwester").hide();
		//jQuery("#header4").hide();
		//jQuery("#spr-clmn-phn-nmbr").hide();
	}
	
	if (jQuery.browser.msie() || jQuery.browser.linux()) {
		jQuery("#myGallery").css({display: "none"});
	}
}

function loadSuperColumn(){
	var params = {
        quality: "high",
        allowscriptaccess: "always",
		wmode: "transparent"
    };
    swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/infolinia_superkolumna.swf", "spr-clmn-phn-nmbr", "200", "135", "9.0.0", "", "", params, "");
    swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/infolinia_superkolumna_skyone.swf", "spr-clmn-phn-nmbr-sky", "200", "135", "9.0.0", "", "", params, "");
	swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/infolinia_superkolumna_hotelone.swf", "spr-clmn-phn-nmbr-hotelone", "200", "135", "9.0.0", "", "", params, "");
	 swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/infolinia_superkolumna_skione.swf", "spr-clmn-phn-nmbr-ski", "200", "135", "9.0.0", "", "", params, "");
	swfobject.embedSWF("http://www.villaone.pl/flash/superkolumna/infolinia_superkolumna_villaone.swf", "spr-clmn-phn-nmbr-villaone", "200", "135", "9.0.0", "", "", params, "");
	var params = {
        quality: "high",
        allowscriptaccess: "always"
	};    
	swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/pit_laureat.swf", "spr-clmn-pit", "200", "150", "9.0.0", "", "", params, "");
    //swfobject.embedSWF("http://www.travelone.pl/flash/superkolumna/superkolumna_down.swf", "spr-clmn-logos", "204", "80", "9.0.0", "", "", params, "");
}

function readySuperColumn(){
	jQuery("#spr-clmn-accrdn").accordion();
	jQuery("#spr-clmn-nwslttr-form1 input[name='email']").attr("value","Podaj swój adres e-mail");
	jQuery("#spr-clmn-nwslttr-form1 input[name='email']").focus(function(){this.value = "";})
	jQuery("#spr-clmn-nwslttr-form1 input[name='email']").blur(function(){if(this.value=="") this.value = "Podaj swój adres e-mail";})
	
	jQuery("#spr-clmn-nwslttr-zapisz").click(function(){jQuery("#spr-clmn-nwslttr-form1").submit();});
	jQuery("#spr-clmn-nwslttr-wypisz").click(function(){
		jQuery("#spr-clmn-nwslttr-form2 input[name='email']").val(jQuery("#spr-clmn-nwslttr-form1 input[name='email']").val());
		jQuery("#spr-clmn-nwslttr-form2").submit();});
}

function loadHeader(){}

function readyHeader(){
	var params = {
	        quality: "high",
	        allowscriptaccess: "always"
			
	    };
	headerName = "http://www.travelone.pl/flash/header/infolinia_naglowek.swf";
	if(varArray["subdomain"] == "bilety-lotnicze" || varArray["panstwoID"] == "skyone")
		headerName = "http://www.travelone.pl/flash/header/infolinia_naglowek_sky.swf";
	swfobject.embedSWF(headerName, "header4", "194", "83", "9.0.0", "", "", params, "");
	swfobject.embedSWF(headerName, "n2", "194", "83", "9.0.0", "", "", params, "");
	mainmenu();
	if (jQuery.browser.msie()) {
		jQuery('.fix-z-index').bgiframe();
	}
	jQuery("input[name='q']").attr("value","Wpisz słowo / kod oferty");
	jQuery("input[name='q']").focus(function(){this.value = "";})
	jQuery("input[name='q']").blur(function(){if(this.value=="") this.value = "Wpisz słowo / kod oferty";})
	
}

function loadFooter(){
	var params = {
        quality: "high",
        allowScriptAccess: "always",
		wmode: "transparent"
    };
    swfobject.embedSWF("http://www.travelone.pl/flash/pasek_color.swf", "footer-pasek-tourop", "750", "60", "9.0.0", "", "", params, "");
}

function readyFooter(){
	jQuery("#stopka").addClass("ui-widget");
}

jQuery(document).ready(function(){
    readyHeader();
	readyMain();
	readySuperColumn();
	readyFooter();
});


jQuery(window).load(function(){
    loadHeader();
    loadMain();
	loadSuperColumn();
	loadFooter();
	initDialog();
});

function initDialog(){
	if(jQuery("#dialog").size() == 1){
	jQuery("#dialog").dialog({
		//width: 754,
		autoOpen: false,
		bgiframe: true,
		draggable: false,
		resizable: false,
		title: '', 
		modal: true,
		open: function(event, ui) {
			hideFlashes();
			jQuery("#header4").hide();
            jQuery("#spr-clmn-phn-nmbr, #spr-clmn-pit").hide();
			jQuery(".ui-widget-overlay").click(function(){ 
				jQuery("#dialog").dialog('close'); 
			});
		},
		close: function(event, ui) {
			showFlashes();
			jQuery("#header4").show();
			jQuery("#spr-clmn-phn-nmbr, #spr-clmn-pit").show();
		}
	});
	
	//jQuery(".ui-dialog-titlebar-close")
	jQuery(".ui-dialog").append(jQuery(".ui-dialog-titlebar-close"));
	jQuery(".ui-dialog-titlebar").remove();
	
	jQuery("a[href='http://www.travelone.pl/gwarancjaceny.html'], a[href='http://www.travelone.pl/gwarancja_ceny.html']").each(function(){
		jQuery(this).click(function(){
			showDialog("http://www.travelone.pl/gwarancjaceny.html", 460, 500);
			return false;
		});
	});
	
	jQuery("a[href='http://www.austria.pl/feedback.xml']").each(function(){
		jQuery(this).click(function(){
			showDialog("http://www.austria.pl/feedback.xml", 450, 520);
			return false;
		});
	});
	}
}

function showDialog(newUrl, height, width){
	jQuery("#dialog:empty").append('<iframe frameborder="0" scrolling="no" src/>');
	jQuery("#dialog iframe").attr("width",width + "px");
	jQuery("#dialog iframe").attr("height",height + "px");
	jQuery("#dialog").dialog('option', 'width', width);
	jQuery("#dialog").dialog("open");
	jQuery("#dialog iframe").attr("src",newUrl);
	
}
