// JavaScript Document

$(document).ready(function(){
	
	$('#slideshow').cycle({ 
		fx:    'fade', 
		speed:  1000,
		pause: 1,
		random: 1,
		timeout:  4000 
	});
	
	$('#slideshow').mouseover(function(){
		$('#pauseIcon').fadeIn("slow");;
	});
	
	$('#slideshow').mouseout(function(){
		$('#pauseIcon').fadeOut("slow");;
	});
	
	$('#banner_slideshow').cycle({ 
		fx:			'fade', 
		speed: 		1000,
		pause:		0,
		random: 	1,
		timeout:  	4000,
		height: 	'230px'
	});
	
	$('#share-this > div').hide();
	if( $('#banner_slideshow').length == 0 ){
		$('#share-this > div').css('top','15px');
		$('#share-this > div').css('background-image','url(/sites/all/images/shareThisBubbleFlipped.png)');
		$('#share-this .social-media-icon').css('margin-top','6px');
		shared_top = "30px";
	}else{
		shared_top = "-27px";
	}
	
	$('#share-this').hover(
		function(){
			if( !$.browser.msie ){
			// use this when moved to jQuey 1.3 if( jQuery.support.opacity ){
				$('#share-this > div').css('top','0');
				$('#share-this > div').animate({ 
					opacity: "toggle",
					top: shared_top
				}, 'fast' );
			}else{
				$('#share-this > div').show();
			}
		},
		function(){
			if( !$.browser.msie ){
			// use this when moved to jQuey 1.3 if( jQuery.support.opacity ){
				$('#share-this > div').animate({ 
					opacity: "toggle",
					top: "0"
				}, 'fast' );
			}else{
				$('#share-this > div').hide();
			}
		}
	);
	
});


function popUp(url,w,h,scrol){
	if(!scrol){
		srol = 'auto';
	}
	newwindow = window.open(url,'popUp','toolbar=0,scrollbars='+scrol+',location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+',left='+Math.round((window.screen.width/2)-(w/2))+',top='+Math.round((window.screen.height/2)-(h/2)));
	newwindow.focus();
}