/*
+----------------------
|
| shakeimage
|
|
*/
/*
<style>
.shakeimage{
position:relative
}
</style>
*/

function shakeimage_rand ( n )//between 1 and 100
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}


/*
Shake image script (onMouseover)- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

//configure shake degree (where larger # equals greater shake)
var rector_orig
var rector
var rand_slowdown


var shake_type='updown'
//
if(shake_type=='circular'){
	rector_orig=3
	rector=rector_orig
	rand_slowdown=10
}else if(shake_type=='updown'){
	rector_orig=6
	rector=rector_orig
	rand_slowdown=40
}else if(shake_type=='button'){
	rector_orig=2
	rector=rector_orig
	rand_slowdown=100
}



///////DONE EDITTING///////////
var stopit=0 
var a=1

function init(which){
	stopit=0
	shake=which
	shake.style.left=0
	shake.style.top=0
}

function rattleimage(){
	if ((!document.all&&!document.getElementById)||stopit==1)
	return

	if(shake_type == 'button'){
		shake.style.top=parseInt(shake.style.top)+rector
		shake.style.left=parseInt(shake.style.top)+rector
		rector = 0
	}
	else if (
		(shake_type == 'circular' && (a==1)) ||
		(shake_type == 'updown' && (a==1 || a==2))
	){
		shake.style.top=parseInt(shake.style.top)+rector
	}
	else if (a==2){
		shake.style.left=parseInt(shake.style.left)+rector
	}
	else if (
		(shake_type == 'circular' && (a==3)) ||
		(shake_type == 'updown' && (a==3 || a==4))
	){
		shake.style.top=parseInt(shake.style.top)-rector
	}
	else{
		shake.style.left=parseInt(shake.style.left)-rector
	}
	if (a<4)
	a++
	else
	a=1

	if(shakeimage_rand(100)<rand_slowdown)rector = rector==0 ? 0 : rector-1;

	setTimeout("rattleimage()",50)
}

function stoprattle(which){
	stopit=1
	which.style.left=0
	which.style.top=0
	rector=rector_orig;
}

/*
|
|
|
|
+----------------------
*/


function img_onmouseover_shakeimage(img){
	//alert(img.style.class);
//	img.className='shakeimage';
	img.style.position='relative';
//	changecss(theClass,element,value)
	//img.onClick="top.focus()";

	init(img);
	rattleimage();

	return;





	img.width+=+10; 
	img.height+=10;
} 
function img_onmouseout_shakeimage(img){

	stoprattle(img);
	top.focus();
		
	return;





	img.width+=-10; 
	img.height+=-10;
}
