jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};

jQuery.fn.slideFadeDown = function(speed, easing, callback) {
   return this.animate({opacity: 'show', height: 'show'}, speed, easing, callback);
};

jQuery.fn.slideFadeUp = function(speed, easing, callback) {
   return this.animate({opacity: 'hide', height: 'hide'}, speed, easing, callback);
};

function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\\\/g,'\\');
str=str.replace(/\\0/g,'\0');
return str;
}

/* ############################ */
var lastHash = "";
var lastIHash = "";
var readyToSyncIframe = false;
var manualHashChange = false;
function syncIframe(hash) {
	$('#hash-iframe').attr('src','/content/iframe.php?uid='+getHashLocationName());
}

function getHashLocationName() {		
		return document.location.hash.replace("#","");		
	}   	

jQuery.fn.initHashCallback = function(callback,interval,callBackOnStart) {
	// add iframe
	if ($.browser.msie) $("<iframe>").attr('id','hash-iframe').css('display','none').attr('src','/content/iframe.php?uid='+document.location.hash.replace("#","")).appendTo('body');
		
	lastHash = getHashLocationName();
	lastIHash = getIHash();
	
		
	function getIHash() {
		var src = ""
		if ($.browser.msie) $('#hash-iframe').contents().each(function(){
			src = String($(this).text().split("=")[1]).replace(' ','');			
		});
		return src;
	}
	function callBackTimer() {		
		var hash = getHashLocationName();	
		var iHash = ""
		if ($.browser.msie) {
				iHash = getIHash();
		}
		if (hash!=lastHash) {
			//syncIframe();						
			callback(hash);			
			lastHash = hash;
		}
		if (iHash!=lastIHash) {							
			if (iHash!="") document.location.hash = iHash;			
			lastIHash = iHash;			
		}
	}
	setInterval(callBackTimer, interval);	
	
	if (callBackOnStart) {		
		callback(getHashLocationName());
	}   
}
/* ############################ */


// zobrazeni divu v prohlizecich bez nojs a noscript

	$(document).ready(function(){
		$('div.js-only').each(function(){
			var html = $(this).html();
			if (html!=null && html!==undefined) {
				html = html.replace('<!--','').replace('-->','');
				$(this).html(html);
			}
		});
	});


// height in opera bug solution - http://dev.jquery.com/ticket/3046
var height_ = jQuery.fn.height;
jQuery.fn.height = function() {
    if ( this[0] == window && jQuery.browser.opera && jQuery.browser.version >= 9.50)
        return window.innerHeight;
    else return height_.apply($(this[0]));
};


	String.prototype.replaceAll = function(strTarget,strSubString){
		var strText = this;
		var intIndexOfMatch = strText.indexOf( strTarget );
		
		while (intIndexOfMatch != -1){
			strText = strText.replace( strTarget, strSubString )
			intIndexOfMatch = strText.indexOf( strTarget );		
		}

		return( strText );
	}

	function strtr(text, what, by){ 
		if (text!==undefined) {
			text = text.replace(" - ","-").toLowerCase();
			for (var i=0; i<what.length;i++){
					text = text.replaceAll(what.charAt(i), by.charAt(i));
			}
			return text;	
		} else {
			return "";
		}
	}
