// ***********************************************************************************
// script (c) and written by Radek HULAN
// http://hulan.cz/
// ***********************************************************************************

// use like onclick="return openwin(this.href)"
function openwin(url) {
  if( window.open(url,'','width=800,height=600,left=0,top=0,scrollbars=yes,location=yes,resizable=yes') ) return false; else return true;
}
 
function switchTabs(tab,id) {
	if (id == 'left') {
		$('#a'+tab+'-left').attr("className",'left-hover');
		$('#a'+tab+'-right').attr("className",'right');
		$('#'+tab+'-left').attr("className",'show');
		$('#'+tab+'-right').attr("className",'hide');
	} else {
		$('#a'+tab+'-left').attr("className",'left');
		$('#a'+tab+'-right').attr("className",'right-hover');
		$('#'+tab+'-left').attr("className",'hide');
		$('#'+tab+'-right').attr("className",'show');
	}
}
	
function blogTabs(id) {
	for (var i = 1; i<=3; i=i+1) {
		if (i==id) $('#blogtab'+i).attr('className','tab'+i+'-hover'); else $('#blogtab'+i).attr('className','tab'+i);
		if (i==id) $('#blogcontent'+i).attr('className','show'); else $('#blogcontent'+i).attr('className','hide');
	}
}

var oldCalendarElement = false;
function revealCalendar(ele) {
	var nextSibling = $(ele.parentNode.parentNode.nextSibling);
	if (oldCalendarElement) oldCalendarElement.hide();
	oldCalendarElement = nextSibling;
	nextSibling.show();
}	

function insertComment(id) {
	if (tinyMCE.activeEditor != null && tinyMCE.activeEditor.isHidden() == false)
		tinyMCE.execInstanceCommand('nucleus_cf_body', 'mceInsertContent', false, '['+id+'] ', true);
	else {
   		if (document.getElementById('nucleus_cf_body')) {
       		document.getElementById('nucleus_cf_body').focus();
           	document.getElementById('nucleus_cf_body').value+='['+id+'] ';
		}
	}
}

$(document).ready(function(){ $("a[rel='colorbox']").colorbox({
	onOpen: function(){
		$('object,iframe').each(function(){ 
			$(this).attr('rel', $(this).css('visibility'))
		}).css('visibility','hidden')
	},
  	onClosed: function(){
  		$('object,iframe').each(function(){ 
  			$(this).css('visibility', $(this).attr('rel'))
  		})
  	} 
}); });

