function movie_player(movie,height,width) {
	var movie=window.open(movie,'','scrollbars=no,menubar=no,height='+height+',width='+width+',resizable=no,toolbar=no,location=no,status=no');
	return false;
}
document.onkeydown = keyBoardNav;
function keyBoardNav(e) {
   if (!document.location.href.match("preview")) {
	return true;
   }
   var KeyID = (window.event) ? event.keyCode : e.keyCode;
   switch(KeyID) {
	case 37:
	case 38:
		prevPicture();
		break;
	case 40:
	case 39:
		nextPicture();
		break;
	default:
		return true;
    }
	
}
function prevPicture() {
	var imgIdx=parseInt($F('imageIndex'))-1;
	changePicture(imgIdx,$F('dir'));
}
function nextPicture() {
	var imgIdx=parseInt($F('imageIndex'))+1
	changePicture(imgIdx,$F('dir'));
}

function changePicture(imgIdx,dir) {
	if (imgIdx<0) {
		imgIdx=previewSrc.length-1;
	} else if (imgIdx>=previewSrc.length) {
		imgIdx=0;
	}
	$('mainPreview').src=previewSrc[imgIdx];
	$('fullLink').href=fullLink[imgIdx];
	$('fullLink').innerHTML=imgSize[imgIdx];
	$('timeStamp').innerHTML=timeStamp[imgIdx];
	$('caption').innerHTML=caption[imgIdx];
	$('htmlHardLink').value=html[imgIdx];
	$('bbCodeHardLink').value=bbCode[imgIdx];
	for (i=-3;i<=3;i++) {
		$('gallery'+i).src=gallerySrc[(imgIdx+i+gallerySrc.length) % gallerySrc.length];
	}
	$('imageIndex').value=imgIdx;
}