// JavaScript Document

function uploadPhotos( photo , current , update ){
	
	//popUp( 425 , 430 , 'uploadPhotos.php' , '?codePhoto='+photo+'&current='+current+'&update='+update );

	popUp( 425 , 430 , '' , 'uploadPhotos.php?codePhoto='+photo+'&current='+current+'&update='+update );
	
}

function deleteImage( photo ){

	document.getElementById("sampleImg"+photo).src = "img/"+photo+".gif";
	document.getElementById('textSample'+photo).innerHTML = 'adicionar';
	document.getElementById('textSample'+photo).href = "javascript:uploadPhotos( "+photo+" , '' )";
	document.getElementById('image'+photo).value = '';
	document.getElementById('deleteImg'+photo).innerHTML = '';

}

function insertPhotos(){
	
	if( document.getElementById("image1").value == "" )
		alert( "Favor inserir uma foto na posição número 1." )
	else
		document.addPhotos.submit();		

}

function updatePhotos( photo , path , name ){
	
	document.getElementById("sampleImg"+photo).src = path;
	document.getElementById('textSample'+photo).innerHTML = 'alterar';
	document.getElementById('textSample'+photo).href = "javascript:uploadPhotos( "+photo+" , '"+name+"' , 1 )";
	document.getElementById('image'+photo).value = name;
	document.getElementById('deleteImg'+photo).innerHTML = '<a href="javascript:deleteImage( '+photo+' )">excluir</a>';

}