var ieshit=0;

if(-1 != navigator.userAgent.indexOf("MSIE"))
{
	// Internet Explorer
	document.write('<link href="/media/styles/styleie.css" rel="stylesheet" type="text/css" />');
	document.write('<script type="text/javascript" src="/media/scripts/pngFix/jquery.pngFix.pack.js"></script> ');  
	ieshit=1; 
}else{
	// other
	document.write('<link href="/media/styles/style.css" rel="stylesheet" type="text/css" /><link href="/media/styles/layout.css" rel="stylesheet" type="text/css" />');
	
}

var events = [];



//wyszukiwarka z nagłówka
function szukajSubmit(){
		
		var where='';
		where+='od_m='+$('#h_od_m').val();
		where+='&od_d='+$('#h_od_d').val();
		where+='&do_m='+$('#h_do_m').val();
		where+='&do_d='+$('#h_do_d').val();
		
		var region='';
		
		if($('#szukaj_region_sel').val()!=0)region='&region='+$('#szukaj_region_sel').val();
		
		document.location = 'http://www.naturatour.pl/szukaj/termin.html?'+where+region;
	
	//document.location='http://www.naturatour.pl/szukaj/'+$('#szukaj_rodz_sel').val()+'.html';
	
}


$(window).load(function() {
//$(function() {
	
	if(ieshit==1){
	 //$(document).pngFix(); 
	 //$('#headFormBlock').pngFix(); 
	 $('#header').pngFix(); 
	}
	
	$("#blok_rozkladPKP").liquidCanvas(
            "[shadow border gradient] => roundedRect{radius:50}");
	
	$(".bloczek").liquidCanvas(
	"[shadow {width:3; color:'#DCDCD9'; shift:3 } fill{color:#fff} gradient{from:#FAFAFA; to:#FFFAFA;}] => roundedRect{corner:8}");
	
	
	$(".block").liquidCanvas(
				"[shadow {width:3; color:'#DCDCD9'; shift:3 } fill{color:#fff} gradient{from:#FAFAFA; to:#FFFAFA;}] => roundedRect{corner:8}");
	
	
	//btn.init();
	
});

function strstr (haystack, needle, bool) {
    var pos = 0;
    
    haystack += '';
    pos = haystack.indexOf( needle );
    if (pos == -1) {
        return false;
    } else{
        if (bool){
            return haystack.substr( 0, pos );
        } else{
            return haystack.slice( pos );
        }
    }
}


function rozkladPKP(){
	
	$.ajax({
	   type: "POST",
	   url: "/ajax/natura_obiekty/strstr.html",
	   data: "od="+$("#pkp-do").val()+"&do="+$("#pkp-od").val(),
	   success: function(msg){
	     var temp = new Array();
	     
	     temp=msg.split("&&");
	   	//Czw, 13.11.09
	    // $.fn.colorbox({href:'http://rozklad-pkp.pl/index.php?S=%27.'+temp[0]+'.%27&Z=%27.'+temp[1]+'.%27&date=%27.Czw,%2012.11.09.%27&time=%27.16.43.%27&start=1&search=Szukaj&tmp', iframe:true, width:'80%', height:600, open:true});
	   	$.fn.colorbox({href:'http://rozklad-pkp.pl/index.php?S=%27.'+temp[0]+'.%27&Z=%27.'+temp[1]+'.%27&date=%27.'+$("#pkp-data").val()+'.%27&time=%27.'+$('#pkp-godzina').val()+'.%27&start=1&search=Szukaj&tmp', iframe:true, width:'80%', height:600, open:true});
	   	
	   }
	 });
	

}


/**
* Function : dump()
* Arguments: The data - array,hash(associative array),object
*    The level - OPTIONAL
* Returns  : The textual representation of the array.
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*/
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];
 
  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
} 

function phpget( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
