// Photo changer

function showPhoto(main, photo) {
	
	var main_photo = document.getElementById(main);
	var new_photo = photo;
	
	//main_photo.src = "../../" + new_photo;
	main_photo.src =  new_photo;
	
	return false;
}

function select_current(photo, a, action, t, pid) {	
		var photosrc = photo.src;
		photosrc = photosrc.replace('&width=100', '&width=400');
if (action == 'over') {
		if (document.getElementById('main_photo').src!=photosrc) {
			photo.style.border = '1px solid #990000';
		}
	}
	else if(action == 'out') {
		if (document.getElementById('main_photo').src!=photosrc) {
			photo.style.border = '';
		}
	}
	else if(action == 'init') {

/*
		if (t=='set'){
			var main_photo = document.getElementById('main_photo');
			var new_photo = photo.src;
			main_photo.src =  new_photo.replace('&width=100', '&width=400');
			for (i=0;i<a;i++) {
				var imgx = document.getElementsByName('imgx')[i];
				imgx.style.border = '';
			}
		photo.style.border = '1px solid #FF0000';
		}
		else if (t=='unset') {
		photo.style.border = '';
		}
*/

			var photosrc = photo.src;
			photosrc = photosrc.replace('&width=100', '&width=400');
			if (document.getElementById('main_photo').src==photosrc) {
				photo.style.border = '1px solid #FF0000';
			}
			
		
		
		
		
		
	}
	else {
		for (i=0;i<a;i++) {
			var imgx = document.getElementsByName('imgx')[i];
			if (imgx) {
				imgx.style.border = '';
			}
		}
		photo.style.border = '1px solid #FF0000';
		var photo_title = document.getElementById('photo_title');
		photo_title.innerHTML = t;
		var photo_note = document.getElementById('photo_note_area');
		photo_note.innerHTML = t;
		var f_pid = document.getElementById('f_pid');
		f_pid.value = pid;
		var pn = document.getElementById('photo_note');
		if (pn.style.visibility=='visible') {sh('photo_note');}
		var a_org = document.getElementById('a_org');
		a_org.href = "javascript:newPopUp('photo.php?pid=" + pid + "&org=true', 'Photo', '800', '600', '', 'cen', 'cen' );";
		//a_org.onClick = "javascript:newPopUp('photo.php?pid=" + pid + "&org=true', 'Photo', '800', '600', '', 'cen', 'cen' );";
	
	}
	
}
