var shki = 10;
var shkj = 10;
function shakeWindow(amt){
	//needed for asynchronous animation;
	shki=10;
	shkj = amt;
	setTimeout("shakeNow()",1);
	return true;
}
function shakeNow(){
	if (self.moveBy) {
		if (shki>=0){
			var vx = Math.random()*shki
			var vy = Math.random()*shki
			self.moveBy(vx, vy);
			self.moveBy(-vx, -vy);
			shki--;
			setTimeout("shakeNow()",1);
		}
	}
}


function embedFlashGame(source){
	swfobject.embedSWF('/wp-content/uploads/'+source+'.swf', source+"Game", "640", "300", "9.0.0", "expressInstall.swf",{},{wmode:'transparent'});
	swfobject.embedSWF('/wp-content/uploads/'+source+'_anim.swf', source+"Anim", "100%", "100%", "9.0.0", "expressInstall.swf",{},{wmode:'transparent'});
}

function goFull(source){
//	swfobject.removeSWF(source+'Game');

	$("#"+source+'GameContainer').addClass('gameFullscreen');
	$("#"+source+'AnimContainer').addClass('fullscreen').css('top',$(window).scrollTop()).html('<div id="'+source+'Anim"></div>');
	
	$(window).scroll(function(){
		$('.fullscreen').css('top',$(window).scrollTop());
	})
	swfobject.embedSWF('/wp-content/uploads/'+source+'_anim.swf', source+"Anim", "100%", "100%", "9.0.0", "expressInstall.swf",{},{wmode:'transparent'});
}

function goWindow(source){
//	swfobject.removeSWF(source+'Anim');

	$("#"+source+'GameContainer').removeClass('gameFullscreen').html('<div id="'+source+'Game"></div>');
	$("#"+source+'AnimContainer').removeClass('fullscreen');

	swfobject.embedSWF('/wp-content/uploads/'+source+'.swf', source+"Game", "640", "300", "9.0.0", "expressInstall.swf",{},{wmode:'transparent'});
}



function init() {
	
	jQuery(document).ready(
						
		function() {
			
			setTimeout(setColumnsHeights, 2000);
						
			if(typeof(DD_belatedPNG) != 'undefined') {
	
				pngFix();
				
			}
			
			
			//hide cforms credit
			if($('.linklove').size()) {
				
				$('.linklove').hide();	
				
			}

		}

	);
}

function test() {
	
	alert('test');
	
}

function setColumnsHeights() {
	
	
	
	var content_middle = jQuery('#content div.middle');
	var sidebar_middle = jQuery('#sidebar div.middle');
	
	var highest_div = (content_middle.height() > sidebar_middle.height()) ? content_middle : sidebar_middle;
	var smallest_div = (highest_div == sidebar_middle) ? content_middle : sidebar_middle;
	
	highest_div_height = highest_div.height();
	
	/* account for content iddle padding-top */
	var fix = parseInt(content_middle.css('padding-top').substr(0,content_middle.css('padding-top').length-2));
	
	smallest_div.height(highest_div_height - ((highest_div == sidebar_middle)? fix: -fix));
	
}

function pngFix() {
	
var DD_belatedPNG_selectors_array = [
	
		'#content .middle',  
		'.title-bar .ctr',
		'.tl',
		'.tr',
		'.left', 
		'.right', 
		'.entry',
		'#sidebar .middle',
		'#search',
		'#send-your-blog-button',
		'#bobwidget'
	
	];
	
	var DD_belatedPNG_selectors_str = DD_belatedPNG_selectors_array.join(','); 

	DD_belatedPNG.fix(DD_belatedPNG_selectors_str);
	
}
	

if(typeof(jQuery) == 'undefined') {
	
	alert('jQuery required.');
	
}
else {
	
	init();
	
}