function orderPhoto( photo_id, from_details ) {

	if( USER_LOGGED_IN ) {
	
		createWindow( {'url' : ( ROOT_URL + 'index.php?act=order.single.create&from_details=' + ( from_details ? '1' : '0' ) + '&selected_photo=' + photo_id ), 'width' : 800, 'height' : 600 } );
		
	} else {
	
		window.location.href = ROOT_URL + 'index.php?act=user.registration';
	
	}

}


function getCheckedCount() {

	var ret_val = 0;
	var form_ref = document.forms['photos_form'];
	var idx = 0;
	
	while( form_ref.elements[idx] ) {
		if( form_ref.elements[idx].checked ) {
			ret_val++;
		}
		idx++;
	}
	
	return( ret_val );

}


function doRemove( act ) {
	
	var form_ref = document.forms['photos_form'];
	
	if( getCheckedCount() == 0 ) {
		
		alert( no_checked_alert );
		
	} else {
		
		try{
			
			form_ref.act.value = act;
			form_ref.submit();
			
		} catch( e ) {
			// ex
		}
		
	}

}

function doOrder( act ) {

	var form_ref = document.forms['photos_form'];
	
	if( getCheckedCount() == 0 ) {
		
		alert( no_checked_alert );
		
	} else {
		
		try{
			
			form_ref.act.value = act;
			form_ref.submit();
			
		} catch( e ) {
			// ex
		}
		
	}

}

function checkAll() {

	var form_ref = document.forms['photos_form'];
	var idx = 0;
	
	if( form_ref ) {
	
		while( form_ref.elements[idx] ) {
			try{
				form_ref.elements[idx].checked = true;
			} catch( e ) {
				// ex
			}
			idx++;
		}
	}

}

function unCheckAll() {

	var form_ref = document.forms['photos_form'];
	var idx = 0;
	
	if( form_ref ) {
	
		while( form_ref.elements[idx] ) {
			try{
				form_ref.elements[idx].checked = false;
			} catch( e ) {
				// ex
			}
			idx++;
		}
	}
	
}
