$(function(){

	// parent element acts like child link
	$('.parent-click, #top-nav ul ul li, #app-button-1, #app-button-4, .foot-button, .presenters-name').click(function(){
		link = $(this).find('a').attr('href');
		window.location = link;
	});

	// Pie
	if (window.PIE) {
		$('.rounded-10px').each(function() {
			PIE.attach(this);
		});
	}


	// News Ticker
	//$('#js-news').ticker();


	// for jtweetsanywhere
    jQuery('#twitter-feed').jTweetsAnywhere({
		username: 'broradio',
		count: 1
    });

	jQuery(".paging br").remove();


	// parent element acts like child link
/*
	jQuery( ".ticker-item" ).click( function(){
		link = jQuery( this ).find( "a" ).attr( "href" );
		window.location = link;
	});
*/

});

//gallery image change
function clickdisplay(classe,ide){
	i = 1;
	jQuery(classe).each(function(){
	
		jQuery(this).attr('title',i);
		i++;

	});

	jQuery(classe).click(function(){
		var_title = jQuery(this).attr('title');
		jQuery(ide+' li').hide();
		jQuery(ide+var_title).fadeIn('slow');
	});
}




$(document).ready(function(){

	// Clear default function
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
	        // Textareas don't read val() function from jquery so we use normal js
	        if(default_value == ""){
	          default_value = this.value;
	        }
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val("");
			});
			$(this).blur(function(){
				if ($(this).val() == "") $(this).val(default_value);
			});
		});
	};
	
	$('input.clear-default').clearDefault();
	$('textarea.clear-default').clearDefault();

	//gallery

	// clickdisplay(".gallery-box","#pen");

	//slideshow

	jQuery('#index-banner-image ul').innerfade({speed:2000,timeout:5000,type:'sequence',containerheight:'310px'});

	//gallery
    $('#gallery-preview-inner-2').cycle({
		timeout: 'disable',
		pager:  '#gallery',
		pagerAnchorBuilder: function(idx, slide) {
			// return selector string for existing anchor 
			return '#gallery a:eq(' + idx + ')'; 
		}

	});


	//colorbox
	$("#gallery-preview-inner-2 a").colorbox({
		rel:'colorbox-group'
	});



});




