function getData()
	{		
		$.ajax({
            type: "GET",
            url: "/pages/xmlko2.xml",
            dataType: "xml",
			cache: false,
            success: function(xml) {					
				 var i = 0;
				 $(xml).find('item').each(function(){
					 if(i<3){
                         var title_text = $(this).find('title').text();
						 var img = $(this).find('imgs').text();	
						 var description_text = $(this).find('description').text();
						 var link_text = $(this).find('link').text();
	//   $('<li></li>').html('<a href='+link_text+'>'+ title_text + '</a><br />'+description_text + ' - ' +img_text).appendTo('#resultd ol');
						 pomI = i+1;
						 
						  $.ajax({ type: "post", url: "/pages/proceed.php", async: false, data: "urlRSS="+link_text+"&titleRSS="+title_text+"&perexRSS="+description_text+"&pocRSS="+pomI+"&imgRSS="+img });
					 }
					 i = i+1;
						 
                 });  

			}
		});	
	}

function posun(y) {
		var what = document.getElementById("mapHolder");		
		what.style.backgroundPosition = "0px -"+(y*191)+"px";
}

function smaz(text) {
	if (text) {
		var t = text;
	}
	else {
		var t = "Opravdu chcete vymazat tento záznam?";
	}
		return window.confirm(t);
}


var Effects = {
	
	TopActionSelect : function(e) {
		$("#tAMenuHolder li").each(function(index) {
			if($(this).hasClass("active")){			
				$(this).removeClass("active");
			}	
		});		
		$(this).parent().addClass("active");
		var id = $(this).get(0).id;		
		ajax('tAHolder','/inc/topAAjax.php?type='+id);				
		return false;
	},		
	
	init : function() {
		
		$("#tAHolder div").each(function(index) {
			$(this).hover(function() { $(this).addClass("hover");},	function() {$(this).removeClass("hover");} );
		});	
		$("#allEvents div.action").each(function(index) {
			$(this).hover(function() { $(this).addClass("hover");},	function() {$(this).removeClass("hover");} );
		});	
		$("ul.th li").each(function(index) {
			$(this).hover(function() { $(this).addClass("hover");},	function() {$(this).removeClass("hover");} );
		});			
		
		$("#addButton").hover(function() { $(this).get(0).src="/img/button_pridat_akci_over.gif";},	function() {$(this).get(0).src="/img/button_pridat_akci.gif";} );
		$("#addButton2").hover(function() { $(this).get(0).src="/img/button_pridat_akci_over.gif";},	function() {$(this).get(0).src="/img/button_pridat_akci.gif";} );
		$("#sB").hover(function() { $(this).get(0).src="/img/button_hledej_over.gif";},	function() {$(this).get(0).src="/img/button_hledej.gif";} );
		$("#rss").hover(function() { $(this).get(0).src="/img/ico_rss_big_hover.gif";},	function() {$(this).get(0).src="/img/ico_rss_big_active.gif";} );
			
		
		
		
		
		$("#tAMenuHolder li a").each(function(index) {
			$(this).bind("click",Effects.TopActionSelect);			
			//$(this).bind("mouseout",Efekty.LightOff);
		});	
		
		
	}
	
	
}



function ajax(place, url) {
	$("body").unbind("click");	
	$.ajax({
		url: url,
		cache: true,
		beforeSend : function () {
			if($("#"+place).hasClass("l")){
				$("#"+place).html("<div id=\"loader\"></div>");
			}
		},
		success: function(html){
			$("#"+place).html(html);
			$("body").bind("click",DateTime.removeCal);
			
			 $("#tAHolder div").each(function(index) {
				$(this).hover(function() { $(this).addClass("hover");},	function() {$(this).removeClass("hover");} );
			}); 
		}		
	});
}

function mark(point, html) {
	bounds.extend(point);

	var infoIcon = new GIcon(G_DEFAULT_ICON);
	infoIcon.image = "/img/icko_mini.png";
    infoIcon.iconSize = new GSize(28, 33);
	
	var x = toDg(point.lat(),'lat');
	var y = toDg(point.lng(),'lng');
	html = html + "<br />"+x+"<br />"+y;
	
	markerOptions = { icon:infoIcon };
	var marker = new GMarker(point, markerOptions);	

	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);		
	});
	GEvent.addListener(marker,"mouseover", function() {
		marker.openInfoWindowHtml(html);
	});
	map.addOverlay(marker);
	map.setZoom(map.getBoundsZoomLevel(bounds) - 2);
	map.setCenter(bounds.getCenter());
}	

function toDg(position, type) {	
	var result = '';
	var degree = Math.floor(Math.abs(position));
	var minutes = Math.floor((Math.abs(position) - degree) * 60);
	var seconds = (((Math.abs(position) - degree) * 60 - minutes) * 60).toFixed(2);
	var extension;	
	if (type == 'lat') {
		if (position > 0 ) {
			extension = 'N';
		} else {
			extension = 'S';
		}
	} else {
		if (position > 0 ) {
			extension = 'O';
		} else {
			extension = 'W';
		}		
	}	
	return degree + '&deg; ' + minutes + '\' ' + seconds + '\'\' ' + extension;	
}

var DateTime = {

	insertData : function(date) {
		var input = $("input.selectedInput").val(date);
		input.removeClass("selectedInput");
		$("#cal").hide();
	},
	removeCal : function(e) {
		$("#cal").hide();
		$("body").unbind("click");
	},
	showCal : function(e) {	
		$("body").unbind("click");
		$("input.calendar").each(function(index) {
			$(this).removeClass("selectedInput");
		});

		$("#cal").show();
		$(this).addClass("selectedInput");
		var obj = $(this).offset();
		
		$("#cal").css("left",obj.left);
		$("#cal").css("top",obj.top + $(this).parent().height());
		//$("#cal").css("left",obj.left-140);
		//$("#cal").css("top",obj.top-170);

		var p = $(this).val().split(".");

		if(p==""){
			//var mesic=11;
			//var rok=2008;
		}
		else{
			if((p[0]!="")&&(p[1]!="")&&(p[2]!="")){	
				var mesic=p[1];
				var rok=p[2];
			}			
		}	
		
		$.ajax({
			url: "/inc/calendarAjax.php",
			data: "month="+mesic+"&year="+rok,
			cache: false,
			success: function(html){
				$("#cal").html(html);
				$("body").bind("click",DateTime.removeCal);
			}
		});	
	},

	init : function() {
		$("#cal").hide();	
		$("input.calendar").each(function(index) {
			input=$(this);
			$(this).bind("click",DateTime.showCal);
		});
	}
}

function smaz(text) {
		if (text) {
			var t = text;
		}
		else {
			var t = "Opravdu chcete vymazat tento zaznam?";
		}
		
		return window.confirm(t);
	}

function newWindow(src,x,y) { return window.open(src,'_blank','width='+x+',height='+y+',resizable=yes,scrollbars=yes'); }
var newwindow = '';


var hrefs = {
	openCrossWindow : function(url, n) {
		if (window.opener && !window.opener.closed) {
			newwindow = window.opener;
			newwindow.location.href = url;
		} else {
			if (!newwindow || newwindow.closed) {
				newwindow = window.open(url, n);
			} else {
				newwindow.location.href = url;
			}
		}
		newwindow.focus();
	},

	init : function() {		
		$("a.external").click(function(event){
			hrefs.openCrossWindow(this,2);
			event.preventDefault();
		    	$(this).fadeOut("slow");
			$(this).fadeIn("slow");
		});
		
		//$("a.ajaxc").fancybox({
		//	'hideOnContentClick': false
		//});

		
		//$('a.modal').click(function() {
		//	window.open(this.href, "map", "width=738, height=410");
		//	return false;
		//});

	}
}

// $Id: bookmark_us.js,v 1.4.2.1 2006/11/17 15:25:18 Gurpartap Exp $
/**
* Bookmark Us - Drupal Add to Bookmarks Module.
* @ Released under GNU/GPL License - http://www.gnu.org/copyleft/gpl.html
* @ copyright (C) 2005 by Michael Carico - All rights reserved
**/


function displayLink(p_type, p_url, p_title, p_link_text) {

  var agt = navigator.userAgent.toLowerCase();
  var p_here = top.location.href

  if (p_type == 3)
  {
    if ((agt.indexOf("opera") != -1)) // || (agt.indexOf("firefox") != -1))
    {
      document.write("<a href=\""+p_here+"\" title=\"" + p_title + "\" rel=\"sidebar\">" + p_link_text + "</a>");
    } else
    {
      document.write("<a href=\"javascript:addBookmark('"+p_title+"',top.location.href);\" title=\"" + p_title + "\" >" + p_link_text + "</a>");
    }
  } else
  {
    if (agt.indexOf("opera") != -1) 
    {
      document.write("<a href=\"" + p_url + "\" title=\"" + p_title + "\" rel=\"sidebar\">" + p_link_text + "</a>");
    } else
    {
      document.write("<a href=\"javascript:addBookmark('"+p_title+"','"+p_url+"');\" title=\"" + p_title + "\" >" + p_link_text + "</a>");
    }
  }
}


function addBookmark(title,url) {

  var msg_netscape = "NetScape message";
  var msg_opera    = "This function does not work with this version of Opera.  Please bookmark us manually.";
  var msg_other    = "Your browser does not support automatic bookmarks.  Please bookmark us manually.";
  var agt          = navigator.userAgent.toLowerCase();


  if (agt.indexOf("opera") != -1) 
  {
    if (window.opera && window.print)
    {
      return true;
    } else 
    {
      alert(msg_other);
    }
  }    
  else if (agt.indexOf("firefox") != -1) window.sidebar.addPanel(title,url,"");
  else if ((agt.indexOf("msie") != -1) && (parseInt(navigator.appVersion) >=4)) window.external.AddFavorite(url,title); 
  else if (agt.indexOf("netscape") != -1) window.sidebar.addPanel(title,url,"")         
  else if (window.sidebar && window.sidebar.addPanel) window.sidebar.addPanel(title,url,""); 
  else alert(msg_other);
  
}

var effectsApply = {
	init : function() {		
		$("#addAction").mouseover(function(event){ $(this).get(0).src="/img/pridatAkci2b.gif"; });
		$("#addAction").mouseout(function(event){	$(this).get(0).src="/img/pridatAkci2.gif"; });
	}
}













/**
*
*  AJAX IFRAME METHOD (AIM)
*  http://www.webtoolkit.info/
*
**/

AIM = {
    frame : function(c) {

        var n = 'f' + Math.floor(Math.random() * 99999);
        var d = document.createElement('DIV');
        d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
        document.body.appendChild(d);

        var i = document.getElementById(n);
        if (c && typeof(c.onComplete) == 'function') {
            i.onComplete = c.onComplete;
        }

        return n;
    },

    form : function(f, name) {
        f.setAttribute('target', name);
    },

    submit : function(f, c) {
        AIM.form(f, AIM.frame(c));
        if (c && typeof(c.onStart) == 'function') {
            return c.onStart();
        } else {
            return true;
        }
    },

    loaded : function(id) {
        var i = document.getElementById(id);
        if (i.contentDocument) {
            var d = i.contentDocument;
        } else if (i.contentWindow) {
            var d = i.contentWindow.document;
        } else {
            var d = window.frames[id].document;
        }
        if (d.location.href == "about:blank") {
            return;
        }

        if (typeof(i.onComplete) == 'function') {
            i.onComplete(d.body.innerHTML);
        }
    }
}


function hlasuj(a,v) {		
	var a = a;
	var v = v;
	var url = '/pages/hlasuj.php';
	var pars = '?hlasuj=' + a+'&vote=' + v;
			
	
	$.ajax({
		url: url+pars,
		cache: false,
		success: function(html){
			$("#anketaResult").html(html);
		}
	});		
}
function zobrazSkryj(idecko){
	el=document.getElementById(idecko).style; 
	el.display=(el.display == 'block')?'none':'block';
}

function redesign(color) {		
	var color = color;
	var url = '/pages/redesign.php';
	var pars = '?color='+color;			
	
	$.ajax({
		url: url+pars,
		cache: false,
		success: function(html){
			$('body').get(0).className=color;
		}
	});		
}

function save(kraj,mesto,ulice,cislo,www,email) {		
	var save_kraj = kraj;
	var save_mesto = mesto;
	var save_ulice = ulice;
	var save_cislo = cislo;
	var save_www = www;
	var save_email = email;
	var url = '/pages/save.php';
	var pars = '?save_kraj='+save_kraj+'&save_mesto='+save_mesto+'&save_ulice='+save_ulice+'&save_cislo='+save_cislo+'&save_www='+save_www+'&save_email='+save_email;			
	
	$.ajax({
		type: "POST",
		scriptCharset: "utf-8", 
		url: url+pars,
		cache: false,
		success: function(html){
			alert('Kontaktní údaje byly uloženy a při příští návštěvě se automaticky načtou.');
		}
	});		
}

function rotate() {
	$("#banner-top").fadeOut("slow");		
	time2 = setTimeout("rotateBanner()",3000)
}
function rotateBanner() {
	$("#banner-top").fadeIn("slow");
	var time1 = setTimeout("rotate()",4000);	
}		

