window.onload=function(){
	pg_relations(); 
	emailObject = document.getElementById('phrase')
	if(emailObject){
		blurLabel('phraseLbl',emailObject);
	}
	if($('#map').length > 0) mapLoad();	
	$('img').each(function(){
		if($(this).attr('align') == 'left'){$(this).addClass('leftImg');}	 
		if($(this).attr('align') == 'right'){$(this).addClass('rightImg');}
	});
	
}
$(function(){   
	
	//Cufon.replace(['h1, #headerCon h2', '#headerCon h3', '#headerCon a', '#navigation a', '#navigation span.nav', '#newsContent h2', '#newsCalendarNav h3', '#month', '.boxHeader h2'], {fontFamily: 'Trajan'}, { hover: true, hoverables: {li: true, a: true } });
	$('#newsCalendar tbody tr').each(function(){
		$(this).children('td:last').children('a').css('color', '#c00');
	});
	jQuery.each(jQuery.browser, function(i) {
	  if($.browser.msie && jQuery.browser.version.substr(0,3) < "7"){
		$.ifixpng('design_img/blank.gif');
		$('#atractiffMediaLogotype, #aplaBorder').ifixpng();
	  }
	});
	$('#newsContent ul').jScrollPane({showArrows:true});
	$('.doubleBox').each(function(){
		$(this).children('.box').children(".boxContent").equalHeights();							  
	});
	$('#textSize a').click(function(){
		$('#newsContent ul').jScrollPane({showArrows:true});
		$('.doubleBox').each(function(){
			$(this).children('.box').children(".boxContent").equalHeights();							  
		});		
		return false;
	});
	/*$('#contrast a').click(function(){
		Cufon.replace(['h1, #headerCon h2', '#headerCon h3', '#headerCon a', '#navigation a', '#navigation span.nav', '#newsContent h2', '#newsCalendarNav h3', '#month', '.boxHeader h2'], {fontFamily: 'Trajan'}, { hover: true, hoverables: {li: true, a: true } });							
	});*/
	$('.boxTable tbody tr:not(:last), .boxTable2 tbody tr:not(:last)').children('td').css('border-bottom', '1px solid #ccc');
	$('.printBtn').click(function(){
		window.print();						
	});
	$('#showCommentFrm a').click(function(){
		if($('#commentFrmBox').css('display') == 'none'){$('#commentFrmBox').slideDown('medium');}	
		else{$('#commentFrmBox').slideUp('medium');}
		return false;
	});
	$('.fReply').click(function(){
		if($(this).parents('td').children('.replyFrm').css('display') == 'none'){
			$('.citeFrm, .replyFrm').slideUp('medium');
			$(this).parents('td').children('.replyFrm').slideDown('medium');
			$(this).parents('td').children('.citeFrm').slideUp('medium');
			
		}	
		else{$(this).parents('td').children('.replyFrm').slideUp('medium');}
		return false;
	});
	$('.fCite').click(function(){
		if($(this).parents('td').children('.citeFrm').css('display') == 'none'){
			$('.citeFrm, .replyFrm').slideUp('medium');
			$(this).parents('td').children('.citeFrm').slideDown('medium');
			$(this).parents('td').children('.replyFrm').slideUp('medium');
			
		}	
		else{$(this).parents('td').children('.citeFrm').slideUp('medium');}
		return false;
	});
	//var str = $('td.fContent').html();
	//$('td.fContent').html(str.replace(/:D/g, "<img src=\"emoticons/zeby.gif\" \/>"));
	//$('td.fContent').html(str.replace(/:P/g, "<img src=\"emoticons/jezyk2.gif\" \/>"));

	
	$('.sendToAFriendBtn').click(function(){
		if($('#sendToAFriendFrmBox').css('display') == 'none'){$('#sendToAFriendFrmBox').slideDown('medium');}	
		else{$('#sendToAFriendFrmBox').slideUp('medium');}
		return false;
	});
	//$(".doubleBox .box .boxContent").equalHeights();
	/*$(".columns").resize(function(){
		$(".doubleBox .box .boxContent").equalHeights();
	});*/
	jQuery('#mycarousel, #weather').jcarousel({
		scroll: 1
	});
	$('#atractiffMediaInfo').hover(function(){$(this).find('dd').fadeIn('medium');}, function(){$(this).find('dd').fadeOut('medium');})
	$('#articlePhotosCon a, .contentGallery a').lightBox({fixedNavigation: true});
	$('#aplaImages').cycle({timeout: 8000, pause: 1 });
	//$('#navigation a.active').click(function(){return false;});
	



});
function focusLabel(id,obj){
	var lbl = document.getElementById(id);
	if(obj.value == ''){lbl.style.visibility = 'hidden';}
	
}
function blurLabel(id,obj){
	var lbl = document.getElementById(id);
	if(obj.value != ''){lbl.style.visibility = 'hidden';}
	else{lbl.style.visibility = 'visible';	};
}
function pg_relations(){   
    var linkdb = document.getElementsByTagName('a');
    for(var anch=1; anch<linkdb.length; anch++){ 
        if(linkdb[anch].href.indexOf('.pdf') != -1){ 
            linkdb[anch].onclick=function() {window.open(this.href,'_blank',params); return false}; 
        }
        else if(linkdb[anch].getAttribute('rel')=='external'){ 
            linkdb[anch].onclick=function() {window.open(this.href,'_blank',''); return false};   
        }
    }
}
$(document).ready(function(){
	/*$.datepicker.setDefaults($.datepicker.regional['']);	
	$('#newsCalendar').datepicker(); */
});
