// $Id: acquia-prosper-script.js,v 1.1.2.1 2009/09/03 09:30:00 sociotech Exp $

Drupal.behaviors.prosperBlocks = function (context) {
	$(".prosper-rounded-title h2.block-title").corner("top 5px"); 
	$(".prosper-shoppingcart h2.block-title").corner("top 5px"); 
	$(".prosper-menu-list h2.block-title").corner("top 5px"); 
	$(".prosper-grayborder-darkbackground .inner").corner("7px"); 

//praise widget
	if ($('#praisamator').length) { 
		$('#praisamator').quotator({
			speed : 11000,
			json : 'http://fyera.com/site/sites/all/themes/acquia_prosper/js/untitled.js'
		});
	}
//visitor banner styles fade
	if ($('#visitor-banner').length) { 
		 $('#visitor-banner').innerfade({
			speed: 'slow',
			timeout: 8000,
			type: 'sequence',
			containerheight: '248px'
		});
	}
	//intro-webinar-banner-squeezepage popup
	if ($('#video_overlay').length) {
		$("#video_overlay").overlay({expose: '#fcded4', closeOnClick: false});
	}
        //$("#video_overlay").overlay().load();  uncomment this for onload popup squeeze
		if ($('#video_overlay').length) {
			$("#intro-banner").click(function () { 
				$("#video_overlay").overlay().load();
			});
		}

//input highlighting and styles
	$('input[type="text"]').addClass("idleField");
		$('input[type="text"]').focus(function() {
			$(this).removeClass("idleField").addClass("focusField");
				if (this.value == this.defaultValue){ 
				this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
//adds class / image to filetyppes
	$("a[@href$=pdf]").addClass("pdf");
	$("a[@href$=zip]").addClass("zip");
	$("a[@href$=psd]").addClass("psd");
//roundbox to wrapper
	$('div.roundbox').wrap('<div class="dialog">'+'<div class="bd">'+'<div class="c">'+'<div class="s">'+ '</div>'+'</div><p style="clear:both;">&nbsp;</p>'+'</div>'+'</div>');
	$('div.dialog').prepend('<div class="hd">'+'<div class="c"></div>'+'</div>').append('<div class="ft">'+'<div class="c"></div>'+'</div>');
	

	//  install Flowplayer inside a#player
	if ($('#player').length) { 
		$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.1.5.swf", {
			clip: {
				// use baseUrl so we can play with shorter file names
				baseUrl: 'http://fyera.com',
				// use first frame of the clip as a splash screen
				autoPlay: false,
				autoBuffering: true
			} 
		});
		// get all links that are inside div#clips
		var links = document.getElementById("clips").getElementsByTagName("a");
		// loop those links and alter their click behaviour
		for (var i = 0; i < links.length; i++) {
			links[i].onclick = function() {
				// play the clip specified in href- attribute with Flowplayer
				$f().play(this.getAttribute("href", 2));
				// by returning false normal link behaviour is skipped
				return false;
			};
		}
	}
	

};
	